UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

56 lines • 3.39 kB
import type { PermissionPresetName } from "./extensions/builtin/permission-system/types.ts"; import type { SessionManager } from "./session-manager.ts"; import type { SettingsManager } from "./settings-manager.ts"; /** `client`: a client named a valid preset for this session. `host_default`: the host's own default applies. */ export type PermissionPresetSource = "client" | "host_default"; /** `invalid`: the named preset (or the host's settings) cannot be parsed; every gated tool call is refused. */ export type PermissionPresetStatus = "applied" | "invalid"; /** The approval mode a session enforces, as `get_state`, the open reply and `set_permission_preset` report it. */ export interface PermissionMode { readonly permissionPreset: string; readonly permissionPresetSource: PermissionPresetSource; readonly permissionPresetStatus: PermissionPresetStatus; /** What the next gated decision uses; `null` while the setup is invalid (every gated call is refused). */ readonly effectivePermissionPreset: PermissionPresetName | null; } /** The mode fields `set_permission_preset` and the open reply confirm a requested preset by. */ export type PermissionModeReply = Pick<PermissionMode, "permissionPreset" | "permissionPresetSource" | "permissionPresetStatus">; type ModeSession = Parameters<typeof permissionModeOf>[0] & { readonly sessionManager: Pick<SessionManager, "getEntries" | "appendCustomEntry" | "getHeader" | "getSessionId">; readonly extensionRunner: { emitBusEvent(channel: string, data: unknown): void; }; }; export declare function markHostDefaultPresetFlag(session: object, profile: { readonly permissionPresetSource?: "host_default"; } | undefined): void; export declare function permissionModeOf(session: { readonly sessionManager: object; readonly settingsManager: SettingsManager; readonly extensionRunner: { getFlagValues(): ReadonlyMap<string, boolean | string>; }; }): PermissionMode; /** The preset a launch profile names as a client's choice; an embedder's host default is not one. */ export declare function clientNamedPreset(profile: { readonly permissionPreset?: string; readonly permissionPresetSource?: "host_default"; } | undefined): string | undefined; /** A profile whose preset a client just named: the host-default marker no longer applies. */ export declare function withClientPreset<P extends { readonly permissionPreset?: string; readonly permissionPresetSource?: "host_default"; }>(profile: P, preset: string): Readonly<P>; export declare function permissionModeReply(mode: PermissionMode): PermissionModeReply; export declare function openReplyPermissionMode(state: Partial<PermissionMode>): Partial<PermissionModeReply>; /** * Binds the preset a client named to the live session: reported as `client`, persisted to its file, and, for a change * to a running session (`announce`), published on the session's `permission_preset_changed` bus channel. */ /** Binds the per-decision approval-mode rule to a session, wherever it was created (runtime, SDK, in-process child). */ export declare function bindPermissionDecision(session: ModeSession): void; export declare function applyClientPermissionMode(session: ModeSession, preset: string | undefined, options: { readonly announce: boolean; }): void; export {}; //# sourceMappingURL=permission-mode.d.ts.map