mirror of
https://github.com/jarmuine/claude-code.git
synced 2026-04-26 06:41:17 +03:00
Squash the current repository state back into one baseline commit while preserving the README reframing and repository contents. Constraint: User explicitly requested a single squashed commit with subject "asdf" Confidence: high Scope-risk: broad Reversibility: clean Directive: This commit intentionally rewrites published history; coordinate before future force-pushes Tested: git status clean; local history rewritten to one commit; force-pushed main to origin and instructkr Not-tested: Fresh clone verification after push
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
import type { PermissionUpdate } from '../utils/permissions/PermissionUpdateSchema.js'
|
|
|
|
type BridgePermissionResponse = {
|
|
behavior: 'allow' | 'deny'
|
|
updatedInput?: Record<string, unknown>
|
|
updatedPermissions?: PermissionUpdate[]
|
|
message?: string
|
|
}
|
|
|
|
type BridgePermissionCallbacks = {
|
|
sendRequest(
|
|
requestId: string,
|
|
toolName: string,
|
|
input: Record<string, unknown>,
|
|
toolUseId: string,
|
|
description: string,
|
|
permissionSuggestions?: PermissionUpdate[],
|
|
blockedPath?: string,
|
|
): void
|
|
sendResponse(requestId: string, response: BridgePermissionResponse): void
|
|
/** Cancel a pending control_request so the web app can dismiss its prompt. */
|
|
cancelRequest(requestId: string): void
|
|
onResponse(
|
|
requestId: string,
|
|
handler: (response: BridgePermissionResponse) => void,
|
|
): () => void // returns unsubscribe
|
|
}
|
|
|
|
/** Type predicate for validating a parsed control_response payload
|
|
* as a BridgePermissionResponse. Checks the required `behavior`
|
|
* discriminant rather than using an unsafe `as` cast. */
|
|
function isBridgePermissionResponse(
|
|
value: unknown,
|
|
): value is BridgePermissionResponse {
|
|
if (!value || typeof value !== 'object') return false
|
|
return (
|
|
'behavior' in value &&
|
|
(value.behavior === 'allow' || value.behavior === 'deny')
|
|
)
|
|
}
|
|
|
|
export { isBridgePermissionResponse }
|
|
export type { BridgePermissionCallbacks, BridgePermissionResponse }
|