feat(core): port v2 command invocation (#34849)

This commit is contained in:
Aiden Cline 2026-07-02 11:22:04 -05:00 committed by GitHub
commit c176baee82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 1445 additions and 179 deletions

View file

@ -1125,15 +1125,46 @@ export function Prompt(props: PromptProps) {
const restOfInput = firstLineEnd === -1 ? "" : inputText.slice(firstLineEnd + 1)
const args = firstLineArgs.join(" ") + (restOfInput ? "\n" + restOfInput : "")
void sdk.client.session.command({
sessionID,
command: command.slice(1),
arguments: args,
agent: agent.id,
model: `${selectedModel.providerID}/${selectedModel.modelID}`,
variant,
parts: nonTextParts.filter((x) => x.type === "file"),
})
void sdk.api.session
.command({
sessionID,
command: command.slice(1),
arguments: args,
agent: agent.id,
model: { providerID: selectedModel.providerID, id: selectedModel.modelID, variant },
files: nonTextParts.flatMap((part) =>
part.type === "file"
? [
{
uri: part.url,
name: part.filename,
source: part.source
? {
start: part.source.text.start,
end: part.source.text.end,
text: part.source.text.value,
}
: undefined,
},
]
: [],
),
agents: nonTextParts.flatMap((part) =>
part.type === "agent"
? [
{
name: part.name,
source: part.source
? { start: part.source.start, end: part.source.end, text: part.source.value }
: undefined,
},
]
: [],
),
})
.catch((error) => {
toast.show({ title: "Failed to run command", message: errorMessage(error), variant: "error" })
})
} else if (
inputText.startsWith("/") &&
(data.location.skill.list(currentLocation()) ?? []).some(

View file

@ -208,6 +208,9 @@ export const { use: useData, provider: DataProvider } = createSimpleContext({
case "agent.updated":
void result.location.agent.refresh(event.location)
break
case "command.updated":
void result.location.command.refresh(event.location)
break
case "skill.updated":
void result.location.skill.refresh(event.location)
break