core: add interactive question tool for gathering user preferences and clarifying instructions (#7268)

This commit is contained in:
Dax
2026-01-07 22:29:42 -05:00
committed by GitHub
parent 2e4fe973c9
commit e37fd9c105
19 changed files with 3876 additions and 2605 deletions

View File

@@ -84,6 +84,11 @@ import type {
PtyRemoveResponses,
PtyUpdateErrors,
PtyUpdateResponses,
QuestionListResponses,
QuestionRejectErrors,
QuestionRejectResponses,
QuestionReplyErrors,
QuestionReplyResponses,
SessionAbortErrors,
SessionAbortResponses,
SessionChildrenErrors,
@@ -1781,6 +1786,94 @@ export class Permission extends HeyApiClient {
}
}
export class Question extends HeyApiClient {
/**
* List pending questions
*
* Get all pending question requests across all sessions.
*/
public list<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }])
return (options?.client ?? this.client).get<QuestionListResponses, unknown, ThrowOnError>({
url: "/question",
...options,
...params,
})
}
/**
* Reply to question request
*
* Provide answers to a question request from the AI assistant.
*/
public reply<ThrowOnError extends boolean = false>(
parameters: {
requestID: string
directory?: string
answers?: Array<string>
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams(
[parameters],
[
{
args: [
{ in: "path", key: "requestID" },
{ in: "query", key: "directory" },
{ in: "body", key: "answers" },
],
},
],
)
return (options?.client ?? this.client).post<QuestionReplyResponses, QuestionReplyErrors, ThrowOnError>({
url: "/question/{requestID}/reply",
...options,
...params,
headers: {
"Content-Type": "application/json",
...options?.headers,
...params.headers,
},
})
}
/**
* Reject question request
*
* Reject a question request from the AI assistant.
*/
public reject<ThrowOnError extends boolean = false>(
parameters: {
requestID: string
directory?: string
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams(
[parameters],
[
{
args: [
{ in: "path", key: "requestID" },
{ in: "query", key: "directory" },
],
},
],
)
return (options?.client ?? this.client).post<QuestionRejectResponses, QuestionRejectErrors, ThrowOnError>({
url: "/question/{requestID}/reject",
...options,
...params,
})
}
}
export class Command extends HeyApiClient {
/**
* List commands
@@ -2912,6 +3005,8 @@ export class OpencodeClient extends HeyApiClient {
permission = new Permission({ client: this.client })
question = new Question({ client: this.client })
command = new Command({ client: this.client })
provider = new Provider({ client: this.client })