Luigit
repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by admin

extensions/open/src/debug.ts

Raw
import { defineDebug } from "./pi-ext-debug.ts";

type OpenDebugSchema = {
	events: readonly ["session.start", "session.shutdown"];
	spans: readonly ["open.launch"];
	fields: {
		readonly mode: readonly ["tui", "interactive", "print", "json", "rpc"];
		readonly platform: readonly [
			"aix",
			"android",
			"cygwin",
			"darwin",
			"freebsd",
			"haiku",
			"linux",
			"netbsd",
			"openbsd",
			"sunos",
			"win32",
		];
		readonly kind: readonly ["launch"];
		readonly outcome: readonly [
			"unavailable",
			"invalid",
			"no_candidates",
			"cancelled",
			"launched",
			"failed",
		];
	};
};

export const {
	dbg,
	span,
	closeDebug,
}: ReturnType<typeof defineDebug<OpenDebugSchema>> = defineDebug({
	events: ["session.start", "session.shutdown"],
	spans: ["open.launch"],
	fields: {
		mode: ["tui", "interactive", "print", "json", "rpc"],
		platform: [
			"aix",
			"android",
			"cygwin",
			"darwin",
			"freebsd",
			"haiku",
			"linux",
			"netbsd",
			"openbsd",
			"sunos",
			"win32",
		],
		kind: ["launch"],
		outcome: [
			"unavailable",
			"invalid",
			"no_candidates",
			"cancelled",
			"launched",
			"failed",
		],
	},
} as const);