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
elicitation.ts4.9 KB
// MCP form schemas use the question fields the host can render today.
import type { QuestionField } from "divergence/protocol";
import type { QuestionRequest } from "./types.ts";
import type { Answer } from "./session.ts";
import * as wire from "./wire.ts";
function choices(schema: Record<string, unknown>) {
if (Array.isArray(schema.enum))
return schema.enum.map((value, index) => ({
value: String(value),
label: String(Array.isArray(schema.enumNames) ? (schema.enumNames[index] ?? value) : value),
}));
const variants = schema.oneOf ?? schema.anyOf;
if (!Array.isArray(variants)) return [];
return variants.map((variant) => {
const entry = wire.objectOf(variant);
return { value: String(entry.const), label: typeof entry.title === "string" ? entry.title : String(entry.const) };
});
}
export function elicitationQuestion(id: string, request: wire.ControlRequest): QuestionRequest {
const message = `${request.mcp_server_name}: ${String(request.message)}`;
if (request.mode === "url") return { id, message, url: request.url ?? undefined, responseMode: "tool", fields: [] };
const schema = request.requested_schema ?? {};
const properties = wire.objectOf(schema.properties);
const order = request.property_order ?? Object.keys(properties);
const fields: QuestionField[] = order.map((key) => {
const property = wire.objectOf(properties[key]);
const options = choices(property.type === "array" ? wire.objectOf(property.items) : property);
let kind: QuestionField["kind"];
switch (property.type) {
case "boolean":
kind = "boolean";
break;
case "number":
case "integer":
kind = "text";
break;
case "string":
kind = options.length ? "select" : "text";
break;
case "array":
if (!options.length) throw new Error(`Claude requested an unsupported form field: ${key}.`);
kind = "multi_select";
break;
default:
throw new Error(`Claude requested an unsupported form field: ${key}.`);
}
return {
id: key,
label: typeof property.title === "string" ? property.title : key,
...(typeof property.description === "string" ? { description: property.description } : {}),
kind,
...(options.length ? { options } : {}),
allowOther: false,
required: Array.isArray(schema.required) && schema.required.includes(key),
};
});
return { id, message, responseMode: "tool", fields };
}
export function elicitationResult(request: wire.ControlRequest, answer: Answer) {
if (answer.cancelled) return { action: "cancel" };
if (request.mode === "url") return { action: "accept" };
const properties = wire.objectOf(request.requested_schema?.properties);
const content: Record<string, unknown> = {};
for (const field of elicitationQuestion("", request).fields) {
let value = answer.values?.[field.id];
if (value === undefined) {
if (field.required) throw new Error(`An answer is required for ${field.label}.`);
continue;
}
const property = wire.objectOf(properties[field.id]);
if (property.type === "number" || property.type === "integer") {
value = typeof value === "string" && value.trim() ? Number(value) : value;
if (
typeof value !== "number" ||
!Number.isFinite(value) ||
(property.type === "integer" && !Number.isInteger(value))
)
throw new Error(`${field.label} requires a ${property.type}.`);
if (
(typeof property.minimum === "number" && value < property.minimum) ||
(typeof property.maximum === "number" && value > property.maximum)
)
throw new Error(`${field.label} is outside the allowed range.`);
} else if (field.kind === "boolean") {
if (typeof value !== "boolean") throw new Error(`${field.label} requires a boolean.`);
} else if (field.kind === "multi_select") {
if (!Array.isArray(value) || value.some((entry) => !field.options?.some((option) => option.value === entry)))
throw new Error(`${field.label} requires the listed choices.`);
if (
(typeof property.minItems === "number" && value.length < property.minItems) ||
(typeof property.maxItems === "number" && value.length > property.maxItems)
)
throw new Error(`${field.label} has an invalid number of choices.`);
} else {
if (typeof value !== "string" || (field.options && !field.options.some((option) => option.value === value)))
throw new Error(`${field.label} requires a valid answer.`);
if (
(typeof property.minLength === "number" && value.length < property.minLength) ||
(typeof property.maxLength === "number" && value.length > property.maxLength) ||
(typeof property.pattern === "string" && !new RegExp(property.pattern).test(value))
)
throw new Error(`${field.label} does not match the requested format.`);
}
content[field.id] = value;
}
return { action: "accept", content };
}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.