feat(app): open Extensions config and skills in a side tab (#58023)

This commit is contained in:
Kit Langton
2026-10-21 23:56:32 -07:00
committed by GitHub
Unverified
parent 28c2a86f8f
commit aea627a48d
12 changed files with 343 additions and 107 deletions
@@ -74,6 +74,7 @@ const layout: Layout = {
scroll: { get: () => undefined, set() {} },
settings() {},
project() {},
draft() {},
command() {},
}
@@ -349,6 +350,7 @@ function standIn(overrides: Partial<Interface>): Interface {
},
settings() {},
project() {},
draft() {},
command() {},
font: () => "fixture mono",
routing: () => false,
@@ -670,6 +670,57 @@ test("Extensions lists open on hover, hold course into the open list, and follow
await expect(summary).toBeHidden()
})
test("Extensions lists open config files and skills in a side tab and start setup sessions", async ({ page }) => {
const global = "C:/Users/kit/.config/opencode/opencode.jsonc"
const skill = `${fixture.directory}/.opencode/skills/release-notes/SKILL.md`
await mockStressTimeline(page, {
mcp: [{ name: "atlas-search", status: { status: "connected" } }],
plugins: [],
skills: [{ id: "release-notes", name: "release-notes", path: skill, content: "Release notes" }],
configEntries: [
{
type: "document",
path: global,
info: { mcp: { servers: { "atlas-search": { type: "remote", url: "https://atlas.example" } } } },
},
// An empty project override used to win, so the servers' own file never opened.
{ type: "document", path: `${fixture.directory}/.opencode/opencode.jsonc`, info: { mcp: {} } },
],
fileContent: (path) => ({ type: "text", content: `contents:${path}` }),
})
await page.goto(sessionHref(fixture.targetID))
const trigger = page.getByRole("button", { name: "Session details", exact: true })
const summary = page.getByRole("dialog", { name: "Session details", exact: true })
const row = (name: string) => summary.getByRole("button", { name, exact: true })
const list = (name: string) => page.getByRole("group", { name, exact: true })
await trigger.click()
await row("MCP").hover()
// A file outside the workspace is read by name from its own directory.
const read = page.waitForRequest((request) => new URL(request.url()).pathname.endsWith("/api/fs/read/opencode.jsonc"))
await list("MCP").getByRole("button", { name: "Configuration file", exact: true }).click()
expect(new URL((await read).url()).searchParams.get("location[directory]")).toBe("C:/Users/kit/.config/opencode/")
await expect(summary).toBeHidden()
await expect(page.getByRole("tab", { name: "opencode.jsonc", exact: true })).toHaveAttribute("aria-selected", "true")
await expect(page.getByText("contents:opencode.jsonc", { exact: true })).toBeVisible()
await trigger.click()
await row("Skills").hover()
await list("Skills").getByRole("button", { name: "release-notes", exact: true }).click()
await expect(summary).toBeHidden()
await expect(page.getByRole("tab", { name: "SKILL.md", exact: true })).toHaveAttribute("aria-selected", "true")
// An empty list offers a draft session in the global configuration's directory, its prompt filled in.
await trigger.click()
await row("Plugins").hover()
await list("Plugins").getByRole("button", { name: "Add a plugin with OpenCode", exact: true }).click()
await expect(page).toHaveURL(/\/new-session\?/)
await expect(page.locator('[data-component="composer-editor"]')).toContainText(
"Help me add a plugin to my global OpenCode config.",
)
})
test("multiple desktop connections show the session's server name", async ({ page }) => {
await mockStressTimeline(page)
await page.route("http://secondary.test/**", (route) =>
@@ -62,11 +62,12 @@ type Attached = {
scope: (server: string) => ServerScope
/** Records a session-scoped store so layout pruning drops it with the session. */
scoped: (name: string) => void
layout: Omit<Layout, "narrow" | "settings" | "project" | "command" | "stored"> & {
layout: Omit<Layout, "narrow" | "settings" | "project" | "draft" | "command" | "stored"> & {
stored(extension: string, session: SessionRef): readonly string[]
}
settings: (page?: string) => void
project: (server: string, title: string) => void
draft: Layout["draft"]
command: (id: string) => void
font: Accessor<string>
routing: Accessor<boolean>
@@ -322,6 +323,7 @@ export function createHostApis() {
},
settings: (page) => write((value) => value.settings(page)),
project: (server, title) => write((value) => value.project(server, title)),
draft: (input) => write((value) => value.draft(input)),
command: (id) => write((value) => value.command(id)),
}),
embeds: () => embeds,
@@ -651,6 +653,7 @@ export function createExtensionAttachment(apis: HostApis) {
// Writes made before a session's location is known wait for it rather than being dropped.
const located = createLocatedWrites()
// Kept per session beside its strip, so the new tab view still lists them after a reload.
const closed = createClosedTabs({
list(session) {
@@ -711,10 +714,12 @@ export function createExtensionAttachment(apis: HostApis) {
const value = stateKey(session)
if (!value) return located.hold(session, () => close(key, session))
const tab = listed(session, value).find((entry) => entry.key === key)?.tab
const all = layout.panel.state(value).all
const view = mountedSession(session)
const currentScreen = screen()
const entry =
view &&
tab &&
@@ -840,6 +845,11 @@ export function createExtensionAttachment(apis: HostApis) {
scope,
scoped: layout.sessionState.track,
project: (server, title) => setProjects((pending) => [...pending, { server, title }]),
draft: (input) => {
const server = servers.list.find((conn) => ServerConnection.key(conn) === input.server)
if (server) void tabs.newDraft({ server: ServerConnection.key(server), directory: input.directory }, input.prompt)
},
command: (id) => command.trigger(id),
font: () => terminalFontFamily(settings.appearance.terminalFont()),
routing: useIsRouting(),
@@ -824,6 +824,7 @@ export function mountBrowserRegion(input: RegionHost) {
scroll: { get: () => undefined, set() {} },
settings() {},
project() {},
draft() {},
command() {},
})
@@ -0,0 +1,64 @@
import { expect, test } from "bun:test"
import { globalConfigDirectory, serviceConfigFile } from "./config-file"
const global = "/home/kit/.config/opencode/opencode.jsonc"
const project = "/work/acme/.opencode/opencode.jsonc"
test("a project file that sets a service without entries does not hide the global file's entries", () => {
const entries = [
{
type: "document" as const,
path: global,
info: {
mcp: { servers: { atlas: { type: "remote" as const, url: "https://atlas.example" } } },
plugins: ["opencode-tidewater"],
},
},
{
type: "document" as const,
path: project,
info: { mcp: {}, plugins: [], lsp: { zephyr: { command: ["zephyr"] } } },
},
{ type: "document" as const, path: "/work/acme/.opencode/agents/review.md", info: {} },
]
expect(serviceConfigFile(entries, "mcp")).toBe(global)
expect(serviceConfigFile(entries, "plugins")).toBe(global)
expect(serviceConfigFile(entries, "lsp")).toBe(project)
// Nothing lists skills, so the first file, the global one, is where they would go.
expect(serviceConfigFile(entries, "skills")).toBe(global)
})
test("a file that only sets a service still wins over one that never mentions it", () => {
const entries = [
{ type: "document" as const, path: global, info: {} },
{ type: "document" as const, path: project, info: { lsp: false } },
]
expect(serviceConfigFile(entries, "lsp")).toBe(project)
expect(serviceConfigFile([], "lsp")).toBeUndefined()
})
test("setup sessions run in the global configuration's directory, never an ancestor project's", () => {
// In the server's order: global files and root, an ancestor's config outside the worktree, then the project's.
const ancestor = "/work/opencode.json"
const projectRoot = { type: "directory" as const, path: "/work/acme/.opencode" }
const entries = [
{ type: "document" as const, path: global, info: {} },
{ type: "directory" as const, path: "/home/kit/.config/opencode" },
{ type: "document" as const, path: ancestor, info: {} },
{ type: "document" as const, path: project, info: {} },
projectRoot,
]
expect(globalConfigDirectory(entries, "/work/acme")).toBe("/home/kit/.config/opencode")
// With global configuration off, the ancestor's directory is still not taken for the global one.
expect(
globalConfigDirectory(
[{ type: "document", path: ancestor, info: {} }, { type: "document", path: project, info: {} }, projectRoot],
"/work/acme",
),
).toBe("/work/acme")
})
@@ -0,0 +1,47 @@
import type { ConfigEntry } from "@opencode/client"
import { Predicate } from "effect"
type ConfigInfo = Extract<ConfigEntry, { type: "document" }>["info"]
/**
* The configuration file that holds a service's entries: the last one that lists any, else the last one that sets the
* service, else the first. An empty `"mcp": {}` in a project file does not hide the servers the global file lists.
*/
export function serviceConfigFile(entries: readonly ConfigEntry[], service: "mcp" | "plugins" | "skills" | "lsp") {
const documents = configDocuments(entries)
return (
documents.findLast((document) => lists(document.info, service)) ??
documents.findLast((document) => document.info[service] !== undefined) ??
documents.at(0)
)?.path
}
/**
* The global configuration directory, else the location itself. The server lists a `directory` entry for each config
* root, the global one before any project's, and a project root is always a `.opencode` folder. So the first root is
* the global one unless it is a project's, which means global configuration is off. A project config in an ancestor of
* the worktree is not mistaken for it.
*/
export function globalConfigDirectory(entries: readonly ConfigEntry[], directory: string) {
const root = entries.find((entry) => entry.type === "directory")
return root && !/[\\/]\.opencode[\\/]?$/.test(root.path) ? root.path.replace(/[\\/]+$/, "") : directory
}
function configDocuments(entries: readonly ConfigEntry[]) {
return entries.flatMap((entry) =>
entry.type === "document" && entry.path !== undefined && /\.jsonc?$/.test(entry.path)
? [{ path: entry.path, info: entry.info }]
: [],
)
}
function lists(info: ConfigInfo, service: "mcp" | "plugins" | "skills" | "lsp") {
if (service === "mcp") return Object.keys(info.mcp?.servers ?? {}).length > 0
if (service === "lsp")
return info.lsp !== undefined && !Predicate.isBoolean(info.lsp) && Object.keys(info.lsp).length > 0
return (info[service]?.length ?? 0) > 0
}
@@ -70,6 +70,7 @@
.session-summary-row:focus-visible,
.session-service-config:focus-visible,
button.session-service-row:focus-visible,
.session-mcp-row:focus-within {
outline: none;
background: var(--v2-overlay-simple-overlay-hover);
@@ -78,6 +79,7 @@
@media (hover: hover) {
button.session-summary-row:hover,
.session-service-config:not(:disabled):hover,
button.session-service-row:hover,
.session-summary-move:has(> .session-summary-dismiss:hover) > .session-summary-row,
.session-mcp-row:not([data-disabled]):hover {
background: var(--v2-overlay-simple-overlay-hover);
@@ -315,15 +317,6 @@
text-decoration: none;
cursor: pointer;
.session-service-config-arrow {
opacity: 0;
transition: opacity 150ms ease-out;
}
&:is(:hover, :focus-visible) .session-service-config-arrow {
opacity: 1;
}
&:focus-visible {
outline: 2px solid var(--v2-border-border-focus);
outline-offset: 2px;
@@ -500,8 +493,4 @@ div.session-mcp-row {
translate: none;
transition: opacity 0.15s ease-out;
}
.session-service-config .session-service-config-arrow {
transition: none;
}
}
@@ -23,6 +23,18 @@ export default {
configure: "Configuration file",
copyConfigPath: "Copy configuration file path",
configFileMissing: "No configuration file found",
"setup.mcp": "Add a server with OpenCode",
"setup.mcp.prompt":
"Help me add an MCP server to my global OpenCode config. Ask me which service I want to connect, then set it up and check that it connects.",
"setup.plugins": "Add a plugin with OpenCode",
"setup.plugins.prompt":
"Help me add a plugin to my global OpenCode config. Ask me what I want it to do, suggest a plugin, then add it.",
"setup.skills": "New skill with OpenCode",
"setup.skills.prompt":
"Help me write a new OpenCode skill in my global config. Ask me what it should teach you, then write its SKILL.md.",
"setup.lsp": "Set up with OpenCode",
"setup.lsp.prompt":
"Help me configure a language server in my global OpenCode config. Ask me which language I work in, then set it up.",
loadingChanges: "Loading changes…",
noChanges: "No changes",
basedOn: "Based on {{branch}}",
@@ -5,6 +5,8 @@ export type DetailsPanelProps = {
session: MountedSession
shown?: boolean
mobile?: boolean
/** Closes the popover that shows the panel, once an action opened something beside it. */
onClose?: () => void
}
export default function SessionDetailsPanel(props: DetailsPanelProps) {
@@ -15,6 +17,7 @@ export default function SessionDetailsPanel(props: DetailsPanelProps) {
directory={props.session.directory}
shown={props.shown !== false}
mobile={props.mobile}
onClose={props.onClose}
/>
</div>
)
@@ -25,7 +25,7 @@ export function DetailsHeader(props: {
<Show when={props.session.project}>
<DetailsPopover menus={props.menus} active={props.active} open={open()} onOpenChange={setOpen}>
<Suspense>
<Panel session={props.session} shown={open()} />
<Panel session={props.session} shown={open()} onClose={() => setOpen(false)} />
</Suspense>
</DetailsPopover>
</Show>
@@ -7,7 +7,6 @@ import { Switch } from "@opencode/ui/switch"
import { showToast } from "@opencode/ui/toast"
import { Tooltip } from "@opencode/ui/tooltip"
import { TruncatedText } from "@opencode/ui/truncated-text"
import { getDirectory } from "@opencode/util/path"
import { useMutation } from "@tanstack/solid-query"
import {
children,
@@ -25,6 +24,7 @@ import {
} from "solid-js"
import { createStore } from "solid-js/store"
import { createKeyed, useDrawer, useExtension, type MountedSession } from "../sdk"
import { globalConfigDirectory, serviceConfigFile } from "./config-file"
import { configuredLsps } from "./configured-lsp"
const services = [
@@ -40,6 +40,8 @@ type ServiceProps = {
session: MountedSession
directory: string
shown: boolean
/** Closes the details popover, once an action opened something beside it. */
onClose?: () => void
}
/** One service's list: its load state, what its row summarises, and the list itself. */
@@ -77,6 +79,7 @@ export function SessionServerPanel(props: ServiceProps & { mobile?: boolean }) {
shown={props.shown}
mobile={props.mobile}
name={name()}
onClose={props.onClose}
/>
)}
</Show>
@@ -517,12 +520,7 @@ function useLsp(props: ServiceProps): ServiceSource {
failed: false,
retry: () => void refetch(),
Body: () => (
<Show
when={names().length}
fallback={
<ServiceEmpty session={props.session} title={ctx.t("lsp.empty")} directory={props.directory} service="lsp" />
}
>
<Show when={names().length} fallback={<ServiceEmpty owner={props} title={ctx.t("lsp.empty")} service="lsp" />}>
<For each={names()}>
{(name) => (
<div class="session-service-row">
@@ -531,7 +529,8 @@ function useLsp(props: ServiceProps): ServiceSource {
)}
</For>
<div class="session-service-footer">
<ServiceConfigLink session={props.session} directory={props.directory} service="lsp" />
<span class="session-service-config-separator" role="separator" />
<ServiceConfigLink owner={props} service="lsp" />
</div>
</Show>
),
@@ -583,12 +582,7 @@ function useMcp(props: ServiceProps, close: () => void): ServiceSource {
},
retry: () => void refetch(),
Body: () => (
<Show
when={servers().length}
fallback={
<ServiceEmpty session={props.session} title={ctx.t("mcp.empty")} directory={props.directory} service="mcp" />
}
>
<Show when={servers().length} fallback={<ServiceEmpty owner={props} title={ctx.t("mcp.empty")} service="mcp" />}>
<Index each={servers()}>
{(server) => {
const enabled = () => server().status.status !== "disabled"
@@ -676,7 +670,8 @@ function useMcp(props: ServiceProps, close: () => void): ServiceSource {
}}
</Index>
<div class="session-service-footer">
<ServiceConfigLink session={props.session} directory={props.directory} service="mcp" />
<span class="session-service-config-separator" role="separator" />
<ServiceConfigLink owner={props} service="mcp" />
<button
type="button"
class="session-service-config"
@@ -712,6 +707,7 @@ function useCatalog(props: ServiceProps, service: "plugins" | "skills"): Service
name: pluginLabel(plugin),
status: plugin.state.status,
error: plugin.state.status === "failed" ? plugin.state.error : undefined,
path: undefined,
}))
}
@@ -734,6 +730,7 @@ function useCatalog(props: ServiceProps, service: "plugins" | "skills"): Service
name: skill.name,
status: undefined,
error: undefined,
path: skill.path,
}))
return entries.toSorted((a, b) => a.name.localeCompare(b.name))
@@ -770,32 +767,54 @@ function useCatalog(props: ServiceProps, service: "plugins" | "skills"): Service
when={list().length}
fallback={
<ServiceEmpty
session={props.session}
owner={props}
title={ctx.t(service === "plugins" ? "plugins.empty" : "skills.empty")}
directory={props.directory}
service={service}
/>
}
>
<For each={list()}>
{(item) => (
<div class="session-service-row" data-status={item.status}>
<Show when={item.status}>
{(status) => (
<>
<StatusDot status={status()} error={item.error} />
<Show when={status() === "failed"}>
<span class="sr-only">{ctx.t("failed")}</span>
</Show>
</>
)}
</Show>
<TruncatedText text={item.name} class="session-summary-label" />
</div>
<Show
when={item.path}
fallback={
<div class="session-service-row" data-status={item.status}>
<Show when={item.status}>
{(status) => (
<>
<StatusDot status={status()} error={item.error} />
<Show when={status() === "failed"}>
<span class="sr-only">{ctx.t("failed")}</span>
</Show>
</>
)}
</Show>
<TruncatedText text={item.name} class="session-summary-label" />
</div>
}
>
{(path) => (
// A skill opens its SKILL.md in a side tab.
<button
type="button"
class="session-service-row session-service-file"
onClick={() => {
if (ctx.links.open({ href: path(), session: props.session })) props.onClose?.()
}}
>
<Icon name="file-document" class="shrink-0 text-v2-icon-icon-muted" />
<TruncatedText text={item.name} class="session-summary-label" />
</button>
)}
</Show>
)}
</For>
<div class="session-service-footer">
<ServiceConfigLink session={props.session} directory={props.directory} service={service} />
<span class="session-service-config-separator" role="separator" />
<Show when={service === "skills"}>
<ServiceSetup owner={props} service={service} />
</Show>
<ServiceConfigLink owner={props} service={service} />
</div>
</Show>
),
@@ -866,11 +885,10 @@ function ServiceBody(props: { source: ServiceSource; children: JSX.Element }) {
)
}
function ServiceConfigLink(props: { session: MountedSession; directory: string; service: Service }) {
function ServiceConfigLink(props: { owner: ServiceProps; service: Service }) {
const ctx = useExtension()
const desktop = ctx.desktop
const system = ctx.system
const local = () => props.session.server.local
const local = () => props.owner.session.server.local
const [store, setStore] = createStore({ opening: false, copied: false })
const label = () => ctx.t(local() ? "configure" : "copyConfigPath")
// Clears the copied mark two seconds after the latest copy.
@@ -879,31 +897,28 @@ function ServiceConfigLink(props: { session: MountedSession; directory: string;
onCleanup(() => clearTimeout(reset))
const activate = async () => {
if (store.opening || (local() && !desktop)) return
if (store.opening) return
setStore({ opening: true, copied: false })
const directory = props.directory
await props.session.server.client.config
.get({ location: { directory } })
const session = props.owner.session
await session.server.client.config
.get({ location: { directory: props.owner.directory } })
.then(async (entries) => {
const documents = entries
.filter((entry) => entry.type === "document")
.filter((entry) => entry.path !== undefined && /\.jsonc?$/.test(entry.path))
const path = serviceConfigFile(entries, props.service)
const path =
documents.findLast((entry) => entry.info[props.service] !== undefined)?.path ?? documents.at(-1)?.path
if (!path) throw new Error(ctx.t("configFileMissing"))
if (!local()) {
if (!path) throw new Error(ctx.t("configFileMissing"))
await system.copy(path)
setStore("copied", true)
clearTimeout(reset)
reset = setTimeout(() => setStore("copied", false), 2000)
// A local file opens in a side tab beside the session, inside the workspace or not.
if (local()) {
if (ctx.links.open({ href: path, session })) return props.owner.onClose?.()
await ctx.desktop?.reveal(path)
return
}
if (path && (await desktop?.reveal(path))) return
await desktop?.launch(path ? getDirectory(path) : directory)
await system.copy(path)
setStore("copied", true)
clearTimeout(reset)
reset = setTimeout(() => setStore("copied", false), 2000)
})
.catch((error) =>
showToast({
@@ -916,55 +931,78 @@ function ServiceConfigLink(props: { session: MountedSession; directory: string;
}
return (
<>
<span class="session-service-config-separator" role="separator" />
<Show
when={!local() || desktop}
fallback={
<span class="session-service-row">
<Icon name="settings-gear" class="shrink-0 text-v2-icon-icon-muted" />
{label()}
</span>
}
<Tooltip
inactive={local()}
value={ctx.t(store.copied ? "ui.message.copied" : "ui.message.copy")}
placement="top"
getAnchorRect={(anchor) => anchor?.querySelector("svg")?.getBoundingClientRect()}
forceOpen={store.copied ? true : undefined}
class="w-full"
>
<button
type="button"
class="session-service-config"
disabled={store.opening}
onMouseDown={(event) => {
if (!local()) event.preventDefault()
}}
onClick={() => void activate()}
>
<Tooltip
inactive={local()}
value={ctx.t(store.copied ? "ui.message.copied" : "ui.message.copy")}
placement="top"
getAnchorRect={(anchor) => anchor?.querySelector("svg")?.getBoundingClientRect()}
forceOpen={store.copied ? true : undefined}
class="w-full"
>
<button
type="button"
class="session-service-config"
disabled={store.opening}
onMouseDown={(event) => {
if (!local()) event.preventDefault()
}}
onClick={() => void activate()}
>
<Icon
name={local() ? "settings-gear" : store.copied ? "check" : "outline-copy"}
class="shrink-0 text-v2-icon-icon-muted"
/>
<span class="session-summary-label">{label()}</span>
<Show when={local()}>
<Icon name="arrow-up-right" class="session-service-config-arrow shrink-0" />
</Show>
</button>
</Tooltip>
</Show>
</>
<Icon
name={local() ? "settings-gear" : store.copied ? "check" : "outline-copy"}
class="shrink-0 text-v2-icon-icon-muted"
/>
<span class="session-summary-label">{label()}</span>
</button>
</Tooltip>
)
}
function ServiceEmpty(props: { session: MountedSession; title: string; directory: string; service: Service }) {
// Starts a draft session in the global configuration's directory that asks OpenCode to set the service up.
function ServiceSetup(props: { owner: ServiceProps; service: Service }) {
const ctx = useExtension()
const [store, setStore] = createStore({ opening: false })
const start = async () => {
if (store.opening) return
setStore("opening", true)
const session = props.owner.session
await session.server.client.config
.get({ location: { directory: props.owner.directory } })
.then((entries) => {
ctx.layout.draft({
server: session.server.id,
directory: globalConfigDirectory(entries, props.owner.directory),
prompt: ctx.t(`setup.${props.service}.prompt`),
})
props.owner.onClose?.()
})
.catch((error) =>
showToast({
variant: "error",
title: ctx.t("common.requestFailed"),
description: error instanceof Error ? error.message : String(error),
}),
)
.finally(() => setStore("opening", false))
}
return (
<button type="button" class="session-service-config" disabled={store.opening} onClick={() => void start()}>
<Icon name="plus" class="shrink-0 text-v2-icon-icon-muted" />
<span class="session-summary-label">{ctx.t(`setup.${props.service}`)}</span>
</button>
)
}
function ServiceEmpty(props: { owner: ServiceProps; title: string; service: Service }) {
return (
<div class="session-service-empty">
<strong>{props.title}</strong>
<div class="session-service-footer">
<ServiceConfigLink session={props.session} directory={props.directory} service={props.service} />
<ServiceSetup owner={props.owner} service={props.service} />
<span class="session-service-config-separator" role="separator" />
<ServiceConfigLink owner={props.owner} service={props.service} />
</div>
</div>
)
@@ -792,6 +792,25 @@ export interface Layout {
* @param title - The picker's title.
*/
project(server: string, title: string): void
/**
* Opens a new draft session in a directory on a server with its prompt filled in, for the user to review and send.
* The draft opens in its own tab, as a new session from Home does.
*
* @param input - Where the draft runs and what it asks.
*
* @example
* ```ts
* ctx.layout.draft({ server: session.server.id, directory, prompt: ctx.t("setup.prompt") })
* ```
*/
draft(input: {
/** The server's `ServerRef.id`. */
readonly server: string
/** The directory the new session runs in. */
readonly directory: string
/** The prompt the draft starts with. */
readonly prompt: string
}): void
/**
* Runs an app command as the command palette does, e.g. `mcp.toggle` (the `/mcp` dialog) or `session.export`.
* Does nothing when the command is unavailable or disabled.