Official
claude
Claude Code agent provider: runs the Claude Code CLI headless for each account.
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/claude@0.2.6
Permissions in 0.2.6
Files
replies.ts5.9 KB
// Native UUIDs identify retractions; row ids identify the text to replace.
import type { Emission, TranscriptItem } from "./types.ts";
import type * as wire from "./wire.ts";
export interface ReplyRow {
id: string;
type: "text" | "reasoning" | "other";
text: string;
task: string | null;
}
export class Replies {
rows = new Map<string, ReplyRow[]>();
cleared = new Set<string>();
applied = new Set<string>();
replaced = new Set<string>();
destinations = new Map<string, ReplyRow>();
order = new Map<string, number>();
thinking = new Map<string, { index: number; item: number; text: string }>();
liveRows(message: wire.Record, before: number, task: string | null): ReplyRow[] {
const content = message.message?.content;
const messageId = message.message?.id ?? "message";
if (!Array.isArray(content)) return [];
return content.map((block, position) => {
const index = content.length === 1 ? before : position;
const previous = this.thinking.get(messageId);
const joins = block.type === "thinking" && previous?.index === index - 1;
const item = joins ? previous.item : index;
const text = String(block.text ?? block.thinking ?? "");
if (block.type === "thinking") this.thinking.set(messageId, { index, item, text });
else this.thinking.delete(messageId);
return { id: `${messageId}:${item}`, task, text,
type: block.type === "text" ? "text" : block.type === "thinking" ? "reasoning" : "other" };
});
}
apply(message: wire.Record, rows: ReplyRow[] = []): Emission[] {
const uuid = message.uuid;
if (uuid && rows.length && !this.applied.has(uuid)) this.rows.set(uuid, rows);
for (const row of rows) if (!this.order.has(row.id)) this.order.set(row.id, this.order.size);
const edits: Emission[] = [];
const write = (row: ReplyRow, text: string) => {
if (row.type === "other") return;
row.text = text;
edits.push({ task: row.task, kind: {
event: row.type === "text" ? "text_delta" : "reasoning_delta", itemId: row.id, text, mode: "replace",
} });
};
const clear = (ids: readonly string[]) => {
for (const id of ids) {
if (this.cleared.has(id)) continue;
this.cleared.add(id);
for (const row of this.rows.get(id) ?? []) write(row, "");
}
};
if (message.type === "system" || (message.type === "user" && (message.isSynthetic === true || message.isMeta === true)))
clear(message.retracted_message_uuids ?? message.retractedWireUuids ?? message.retractedMessageUuids ?? []);
if (message.type !== "assistant" || (uuid && this.applied.has(uuid))) return edits;
const supersedes = message.supersedes ?? message.supersedesUuids ?? [];
const messageId = message.message?.id;
const target = supersedes.filter((id) => !this.replaced.has(id)).flatMap((id) => this.rows.get(id) ?? [])
.filter((row) => row.type === "text").sort((a, b) => this.order.get(a.id)! - this.order.get(b.id)!)[0];
clear(supersedes);
for (const id of supersedes) this.replaced.add(id);
if (target && messageId) this.destinations.set(messageId, target);
const destination = target ?? (messageId ? this.destinations.get(messageId) : undefined);
const textRows = rows.filter((row) => row.type === "text");
if (!destination || !textRows.length) return edits;
if (uuid) this.applied.add(uuid);
const text = textRows.map((row) => row.text).join("\n");
for (const row of textRows) if (row.id !== destination.id) write(row, "");
write(destination, destination.text ? `${destination.text}\n${text}` : text);
if (uuid) this.rows.set(uuid, [destination, ...rows.filter((row) => row.type !== "text")]);
return edits;
}
}
/// History keeps the same empty rows and the same replacement position as a run.
export function reviseReplies(records: wire.Record[], items: TranscriptItem[], streamed: WeakMap<TranscriptItem, string>) {
if (!records.some((record) => record.supersedes?.length || record.supersedesUuids?.length ||
record.retracted_message_uuids?.length || record.retractedWireUuids?.length || record.retractedMessageUuids?.length)) return;
const byUuid = new Map<string, TranscriptItem[]>();
const byId = new Map(items.map((item) => [item.id, item]));
for (const item of items) {
const uuid = item.id.split(":")[0]!;
const rows = byUuid.get(uuid) ?? [];
rows.push(item);
byUuid.set(uuid, rows);
}
const replies = new Replies();
const byStream = new Map(items.map((item) => [streamed.get(item), item]));
const counts = new Map<string, number>();
const rowOf = (item: TranscriptItem): ReplyRow => ({
id: item.id, type: item.role === "assistant" ? "text" : item.role === "reasoning" ? "reasoning" : "other",
text: item.role === "assistant" || item.role === "reasoning" ? item.text : "", task: null,
});
for (const record of records) {
const rows = (byUuid.get(record.uuid ?? "") ?? []).map(rowOf);
if (record.type === "assistant") {
const messageId = record.message?.id ?? "message";
const before = counts.get(messageId) ?? 0;
const live = replies.liveRows(record, before, null);
counts.set(messageId, live.length === 1 ? before + 1 : Math.max(before, live.length));
live.forEach((row, index) => {
const item = byStream.get(row.id);
if (!item) return;
const native = rows.find((row) => row.id === item.id) ?? rowOf(item);
if (!rows.includes(native)) rows.push(native);
// Claude's qh/RDt normalizer replaces a multi-block UUID's last 12 digits with the block index.
if (live.length > 1 && record.uuid)
replies.rows.set(`${record.uuid.slice(0, 24)}${index.toString(16).padStart(12, "0")}`, [native]);
});
}
for (const { kind } of replies.apply(record, rows)) {
if (kind.event !== "text_delta" && kind.event !== "reasoning_delta") continue;
const item = byId.get(kind.itemId);
if (item?.role === "assistant" || item?.role === "reasoning") item.text = kind.text;
}
}
}Versions
| Version | Published | Plugin API | Size | Permissions | Status |
|---|---|---|---|---|---|
| 0.2.7latest | Nov 21, 2026 | >=5 <6 | 207.5 KB | 4 permissions | Listed |
| 0.2.6 | Nov 16, 2026 | >=5 <6 | 206 KB | 4 permissions | Listed |
| 0.2.5 | Nov 11, 2026 | >=5 <6 | 168.3 KB | 4 permissions | Listed |
| 0.2.4 | Nov 9, 2026 | >=5 <6 | 166.1 KB | 4 permissions | Listed |
| 0.2.3 | Oct 27, 2026 | >=2 <4 | 151.6 KB | 4 permissions | Listed |
No comments yet.