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.7
Permissions in 0.2.7
Files
files.ts3.9 KB
// Best-effort reads of Claude's records through the scoped broker service.
// Missing and ungranted files retain the original null/empty semantics.
import * as Effect from "effect/Effect";
import * as wire from "./wire.ts";
import { Fs } from "divergence/effect";
const quiet = Effect.fnUntraced(function* <A, E extends { readonly _tag: string; readonly message: string }, R>(
effect: Effect.Effect<A, E, R>,
) {
return yield* effect.pipe(
// Claude's own files are optional: unreadable history is absent history.
Effect.catch((error) =>
Effect.sync(() => {
if (error._tag === "PermissionNotGranted") console.debug(`claude: ${error.message}`);
return null;
}),
),
);
});
/// The most of a file one read asks for. One message between the host and
/// this plugin carries at most 64 MiB, and a long transcript is larger, so
/// a larger file is read in pieces of this size.
export const CHUNK = 16 * 1024 * 1024;
const decoder = new TextDecoder();
export function apiFiles() {
const bytes = Effect.fn("Claude.files.bytes")(function* (path: string) {
const fs = yield* Fs;
const stat = yield* quiet(fs.stat(path));
if (!stat || stat.size <= CHUNK) return yield* quiet(fs.read(path, { encoding: "binary" }));
const whole = new Uint8Array(stat.size);
let filled = 0;
while (filled < stat.size) {
const piece = yield* quiet(fs.read(path, { encoding: "binary", offset: filled, length: CHUNK }));
if (!piece) return null;
if (!piece.length) break; // The file shrank since its size was read.
const taken = piece.subarray(0, stat.size - filled);
whole.set(taken, filled);
filled += taken.length;
}
return whole.subarray(0, filled);
});
return {
text: Effect.fn("Claude.files.text")(function* (path: string) {
const read = yield* bytes(path);
return read === null ? null : decoder.decode(read);
}),
bytes,
/// `length` bytes from `offset` (fewer at the end of the file). A host
/// without ranged reads answers the whole file.
range: Effect.fn("Claude.files.range")(function* (path: string, offset: number, length: number) {
return yield* quiet((yield* Fs).read(path, { encoding: "binary", offset, length }));
}),
list: Effect.fn("Claude.files.list")(function* (path: string) {
return yield* quiet((yield* Fs).list(path));
}),
stat: Effect.fn("Claude.files.stat")(function* (path: string) {
return yield* quiet((yield* Fs).stat(path));
}),
};
}
export type Files = ReturnType<typeof apiFiles>;
export const readJson = Effect.fn("Claude.readJson")(function* (files: Files, path: string) {
const text = yield* files.text(path);
if (text === null) return null;
try {
const value: unknown = JSON.parse(text);
return value;
} catch {
return null;
}
});
export const readLines = Effect.fn("Claude.readLines")(function* (files: Files, path: string) {
const text = yield* files.text(path);
return text === null ? [] : parseLines(text);
});
export function parseLines(text: string): wire.Record[] {
const out: wire.Record[] = [];
for (const line of text.split("\n")) {
if (!line.trim()) continue;
let value: unknown;
try {
value = JSON.parse(line);
} catch {
continue; // A partially written record waits for a later read.
}
const read = wire.readRecord(value);
if (read) out.push(read.record);
}
return out;
}
export function join(...parts: (string | null | undefined)[]) {
return parts
.filter((part) => part !== "" && part !== null && part !== undefined)
.map((part, at) => (at === 0 ? String(part).replace(/\/+$/, "") : String(part).replace(/^\/+|\/+$/g, "")))
.join("/");
}
export const mapLimit = Effect.fn("Claude.mapLimit")(function* <A, B, E, R>(
items: A[],
limit: number,
work: (item: A, at: number) => Effect.Effect<B, E, R>,
) {
return yield* Effect.forEach(items, work, { concurrency: limit });
});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.