Skip to content
← Public packages

@cameronpak/box

Full Box Public API v1 client: lifecycle, prompts, files, commands, snapshots, environments, webhooks, desktop, hosting, and account.

src/interrupt-box.ts

16 lines · 558 B · TypeScript
import { assertBoxId, boxRequest, failure, type Result } from './client.ts'
import type { BoxActionOutput } from './stop-box.ts'

export type InterruptBoxInput = { boxId: string }

/** Interrupt the currently running agent work in a box. */
export default async function interruptBox(
	input: InterruptBoxInput,
): Promise<Result<BoxActionOutput>> {
	const invalid = assertBoxId(input?.boxId)
	if (invalid) return failure<BoxActionOutput>(invalid)
	return boxRequest<BoxActionOutput>({
		path: '/boxes/' + input.boxId + '/interrupt',
		method: 'POST',
	})
}