dart_acp_opencode 0.1.0
dart_acp_opencode: ^0.1.0 copied to clipboard
A Dart ACP client for launching and connecting to OpenCode.
import 'dart:io';
import 'package:dart_acp_opencode/dart_acp_opencode.dart';
Future<void> main() async {
final OpenCodeAcpClient client = await OpenCodeAcpClient.start();
try {
final AcpActiveSession session = await client.agent
.newSession(cwd: AcpAbsolutePath(Directory.current.path))
.start();
try {
final AcpCollectedText result = await session
.prompt(
content: <ContentBlock>[
ContentBlockText(
TextContent(text: 'Briefly describe this project.'),
),
],
)
.collectText();
stdout.writeln(result.text);
} finally {
session.dispose();
}
} finally {
await client.close();
}
}