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 convergence/chat@0.2.5

Permissions in 0.2.5

  • 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
  • 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

views/pending.ts8.2 KB
// The list of held inputs over the prompt box and a semantic usage-limit
// notice. Native admission/unknown delivery remains visible without
// fictitious edit/withdraw.
import * as Effect from "effect/Effect";
import { html } from "convergence";
import type { Chat, ContentBlock, Element, PendingInput } from "convergence";
import type { ChatView } from "../controller.ts";
import { autoSend, editable, inputLabel, pending, policyOf } from "../scheduler-policy.ts";
import { editableComposition, steeringReason } from "../composition.ts";
import { clickable, column, fill, revealOnHover, row, RAISED } from "./styles.ts";
import { resetsIn } from "./usage.ts";

const descriptions = (blocks: readonly ContentBlock[]) => blocks.filter((block) => block.type !== "text").map((block) => {
  switch (block.type) {
    case "image": return `Image · ${block.mimeType}`;
    case "audio": return `Audio · ${block.mimeType}`;
    case "file_ref": case "resource": return block.path;
    case "skill": return `$${block.name}${block.input ? ` ${block.input}` : ""}`;
  }
});
export function renderPending(v: ChatView, chat: Chat): Element[] {
  const scheduler = v.controller.scheduler, snapshot = scheduler.snapshots[chat.id], composer = v.controller.composer(chat.id);
  const act = <A, E>(effect: Effect.Effect<A, E>) => v.ctx.run(effect.pipe(Effect.catch((error) => scheduler.report(chat.id, error))));
  const reason = steeringReason(v.controller, chat);
  // Input handed to the agent is the user's message in the transcript; a
  // card for it too would read as a queue until the agent reports pickup.
  const shown = new Set(v.controller.state.transcripts[chat.id]?.items.map((item) => item.id));
  const handed = (input: PendingInput) =>
    (input.id === composer.outgoing?.id && composer.outgoing.preview && !input.error) ||
    (shown.has(input.id) && !editable(input) && !input.error);
  // One line per input: what it says, cut to the width, and what makes it
  // more than a prompt waiting its turn. Its actions follow on the right,
  // the one that sends it now always visible.
  const line = (icon: string, text: string, status: string, actions: (Element | null)[] = []) => html`
    <div ...${row} gap="small" minHeight=${28} paddingLeft="small" ...${clickable}>
      <icon name=${icon} small tone="muted" />
      <div ...${fill}><text style="body" size="xs" truncate text=${text} /></div>
      ${status ? html`<text style="body" size="xs" tone="muted" text=${status} />` : null}
      ${actions}
    </div>`;
  const extras = (texts: string[]) =>
    texts.length ? html`<div ...${row} gap="small" paddingLeft=${28} flexWrap="wrap">${texts.map((text) => html`<text style="body" size="xs" tone="muted" text=${text} />`)}</div>` : null;
  const rows = snapshot ? pending(snapshot).filter((input) => !handed(input)).map((input) => {
    const canEdit = editable(input), edit = canEdit && composer.pendingEdit?.id === input.id ? composer.pendingEdit : undefined;
    const save = Effect.fn("Chat.savePendingEdit")(function* () {
      if (!edit) return;
      yield* scheduler.edit(input, edit.revision, edit.text);
      composer.pendingEdit = undefined;
      v.ctx.update();
    });
    const icon = input.intent === "steer" ? "corner-down-left" : "list-plus";
    const actions = canEdit ? [
      html`
        <div ...${row} ...${revealOnHover}>
          <button id=${`edit-input-${input.id}`} icon="pencil" small variant="ghost" tooltip="Edit" onClick=${() => { composer.pendingEdit = { id: input.id, revision: snapshot.revision, text: editableComposition(input).text }; v.ctx.update(); }} />
          <button id=${`remove-input-${input.id}`} icon="x" small variant="ghost" tooltip="Remove" onClick=${() => act(scheduler.change({ chatId: chat.id, inputId: input.id, revision: snapshot.revision, remove: true }))} />
        </div>`,
      input.intent === "steer" ? html`<button id=${`demote-${input.id}`} icon="list-plus" small variant="ghost" tooltip="Move back to the queue" onClick=${() => act(scheduler.change({ chatId: chat.id, inputId: input.id, revision: snapshot.revision, intent: "queue" }))} />` : null,
      html`<button id=${`promote-${input.id}`} icon="arrow-right" small variant="ghost" disabled=${!!reason} tooltip=${reason ?? (v.controller.isRunning(chat) ? "Steer now; your draft stays" : "Send now; your draft stays")} onClick=${() => act(scheduler.promote(chat.id, input.id, snapshot.revision))} />`,
    ] : [];
    if (edit) return html`
      <div ...${column} gap="small" paddingY="small">
        <input id=${`edit-pending-${input.id}`} multiline value=${edit.text} onChange=${(event: { value: string }) => { edit.text = event.value; }} />
        <div ...${row} gap="small">
          <button id=${`save-pending-${input.id}`} label="Save" small onClick=${() => act(save())} />
          <button id=${`cancel-pending-${input.id}`} label="Cancel edit" small variant="ghost" onClick=${() => { composer.pendingEdit = undefined; v.ctx.update(); }} />
        </div>
      </div>`;
    return html`<div ...${column}>${line(icon, v.controller.plainText(input.blocks), inputLabel(input), actions)}${extras(descriptions(input.blocks))}</div>`;
  }) : [];
  const outgoing = composer.outgoing;
  // Local intent is visible before persistence, but only host evidence grants
  // edit/remove authority. Clearing the submission identity acknowledges even
  // a steer merged into another input; an exact-id event can take over sooner.
  if (outgoing?.intent && composer.submission && !shown.has(outgoing.id) && !snapshot?.inputs.some((input) => input.id === outgoing.id) && !composer.queue.some((input) => input.id === outgoing.id)) {
    rows.push(html`
      <div ...${column}>
        ${line(outgoing.intent === "steer" ? "corner-down-left" : "list-plus", outgoing.text, outgoing.intent === "steer" ? "Steer · saving" : "Saving")}
        ${extras([...descriptions(outgoing.blocks ?? []), ...outgoing.attachments.map((image) => `Image · ${image.mimeType}`)])}
      </div>`);
  }
  if (!rows.length) return [];
  // The list sits on the prompt box's top edge, inset from its sides.
  return [html`
    <div ...${column} marginX="medium" padding="small" paddingX="medium" background="muted" borderTopLeftRadius="xl" borderTopRightRadius="xl" ...${RAISED}>
      <div ...${row} minHeight=${24} paddingLeft="small"><text style="body" size="xs" weight=${500} tone="muted" text="Queued" /></div>
      ${rows}
    </div>`];
}

export function renderLimit(v: ChatView, chat: Chat): Element | null {
  const scheduler = v.controller.scheduler, snapshot = scheduler.snapshots[chat.id];
  const state = snapshot ? policyOf(snapshot) : undefined, wait = state?.wait;
  const active = scheduler.activeLimits[chat.id];
  const grace = !!active && (snapshot?.running || v.controller.isRunning(chat)) && (!active.runId || active.runId === snapshot?.runId);
  if (!wait && !grace) return null;
  const enabled = autoSend(scheduler.preferences, chat.agentId);
  const reset = wait?.resetAt ?? (grace ? active?.evidence.resetsAt : undefined);
  const countdown = resetsIn(reset);
  const resetText = countdown && reset ? `Reset ${countdown === "now" ? "reported for now" : `in ${countdown}`} · ${new Date(reset).toLocaleString()}` : "Reset time unavailable";
  const status = grace ? "Usage limit reported · still working / retrying" : scheduler.checking.has(chat.id) ? "Checking availability…" :
    state?.pause || wait?.status === "paused" ? "Automatic send paused" : !enabled ? "Auto-send disabled for this agent" : wait?.status === "attempting" ? wait.reason : wait?.status === "failed" ? "Recovery check failed" : "Waiting for usage-limit recovery";
  return html`
    <div ...${column} gap="small" padding="medium" background="warning/10" borderRadius="md" border=${{ width: 1, color: "warning/30" }}>
      <div ...${row} gap="small"><icon name="clock" small tone="warning" /><text style="body" size="xs" tone="warning">${status}</text></div>
      <text style="body" size="xs" tone="muted">${resetText}</text>
      <text style="body" size="xs" tone="muted">${state?.pause ?? wait?.reason ?? active?.evidence.reason}</text>
      <checkbox id=${`auto-limit-${chat.id}`} label="Auto-send pending input after recovery · all chats for this agent" checked=${enabled}
        onChange=${(event: { value: boolean }) => v.ctx.run(scheduler.setAutoSend(chat.agentId, event.value))} />
    </div>`;
}

Versions

VersionPublishedPlugin APISizePermissionsStatus
0.2.5latestNov 21, 2026>=2 <4174.6 KB5 permissionsListed
0.2.4Oct 25, 2026>=2 <4174.2 KB5 permissionsListed
0.2.3Oct 24, 2026>=2 <4165.4 KB5 permissionsListed
0.2.2Oct 23, 2026>=2 <4165 KB5 permissionsListed
0.2.1Oct 6, 2026>=2 <3111.8 KB5 permissionsListed
0.2.0Oct 5, 2026>=2 <3105.1 KB5 permissionsListed

Reviews and comments

0 threads · 0 reviews

No comments yet.