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.9
Permissions in 0.2.9
Files
context-service.ts3 KB
import * as Effect from "effect/Effect";
import type { Api, ArchiveRecord, ContextArtifact } from "divergence";
import type { Params } from "divergence/services";
import { ChatContext } from "./context-contract.ts";
import { contextFormat, detailedTranscript, transcriptContext } from "./context.ts";
const failed = (error: unknown) => ({
_tag: "ContextPreparationFailed" as const,
message: error instanceof Error ? error.message : String(error),
});
export function transcriptPolicy(api: Api) {
return {
render: (params: Params<ChatContext, "render">) =>
Effect.try({
try: () => {
if (params.configuration.format !== contextFormat)
throw new Error("The pinned transcript format/configuration is unavailable.");
return detailedTranscript(params.records as ArchiveRecord[]);
},
catch: failed,
}),
prepare: (params: Params<ChatContext, "prepare">) =>
Effect.tryPromise({
try: async () => {
if (api.settings.get("handoffEnabled") === false)
throw new Error(
"Built-in handoff is disabled. Select a replacement context policy to continue with another agent or recover a lost session.",
);
let detailedRecords = params.records as readonly ArchiveRecord[];
// Returning sessions receive only missing revisions inline, but their
// detailed file and section references still cover the complete chat.
if (params.records.length !== params.snapshot.records) {
const all: ArchiveRecord[] = [];
for (let offset = 0; offset < params.snapshot.records; offset += 256) {
const page = await api.host.archive.records({
chatId: params.snapshot.chatId,
snapshotId: params.snapshot.id,
offset,
limit: 256,
});
all.push(...page.records);
}
detailedRecords = all;
}
const artifacts: ContextArtifact[] = [];
if (detailedRecords.length) {
if (!params.destination.capabilities.ordinaryFiles)
throw new Error(
"Detailed transcript requires ordinary workspace file access; no sandbox permission was broadened.",
);
artifacts.push(
await api.host.artifacts.create({
chatId: params.snapshot.chatId,
snapshotId: params.snapshot.id,
configuration: { format: contextFormat },
stubAfterSeconds: 86_400,
deleteAfterSeconds: 2_592_000,
}),
);
}
const context = transcriptContext(params.records as ArchiveRecord[], {
detailedRecords,
artifact: artifacts[0],
});
return {
instructions: context.instructions,
text: context.text,
artifacts,
covers: [...context.exportedRecords],
};
},
catch: failed,
}),
};
}Versions
| Version | Published | Plugin API | Size | Permissions | Status |
|---|---|---|---|---|---|
| 0.2.9latest | Nov 21, 2026 | >=5 <6 | 349 KB | 5 permissions | Listed |
| 0.2.8 | Nov 16, 2026 | >=5 <6 | 348.6 KB | 5 permissions | Listed |
| 0.2.7 | Nov 11, 2026 | >=5 <6 | 314.3 KB | 5 permissions | Listed |
| 0.2.6 | Nov 9, 2026 | >=5 <6 | 306.2 KB | 5 permissions | Listed |
| 0.2.5 | Oct 27, 2026 | >=2 <4 | 178.6 KB | 5 permissions | Listed |
No comments yet.