Constrain ACP runtime event source types

- derive ACP adapter raw sources from shared runtime event sources
- keep canonical request mapping typed consistently
This commit is contained in:
Julius Marminge committed 2026-04-17 16:44:48 -07:00
1 parent af0323abac
commit 442ea99691
1 file changed
+7 -5
@@ -1,4 +1,5 @@
import {
type RuntimeEventRawSource,
RuntimeItemId,
type CanonicalRequestType,
type EventId,
@@ -13,9 +14,12 @@ import {
import type { AcpPermissionRequest, AcpPlanUpdate, AcpToolCallState } from "./AcpRuntimeModel.ts";
export type AcpAdapterRawSource = "acp.jsonrpc" | `acp.${string}.extension`;
type AcpAdapterRawSource = Extract<
RuntimeEventRawSource,
"acp.jsonrpc" | `acp.${string}.extension`
>;
export interface AcpEventStamp {
interface AcpEventStamp {
readonly eventId: EventId;
readonly createdAt: string;
}
@@ -25,9 +29,7 @@ type AcpCanonicalRequestType = Extract<
"exec_command_approval" | "file_read_approval" | "file_change_approval" | "unknown"
>;
function canonicalRequestTypeFromAcpKind(
kind: string | "unknown",
): AcpCanonicalRequestType {
function canonicalRequestTypeFromAcpKind(kind: string | "unknown"): AcpCanonicalRequestType {
switch (kind) {
case "execute":
return "exec_command_approval";