fix(question): restore flat reply sdk shape (#22487)
This commit is contained in:
@@ -9,6 +9,11 @@ import { HttpApi, HttpApiBuilder, HttpApiEndpoint, HttpApiGroup, OpenApi } from
|
|||||||
import type { Handler } from "hono"
|
import type { Handler } from "hono"
|
||||||
|
|
||||||
const root = "/experimental/httpapi/question"
|
const root = "/experimental/httpapi/question"
|
||||||
|
const Reply = Schema.Struct({
|
||||||
|
answers: Schema.Array(Question.Answer).annotate({
|
||||||
|
description: "User answers in order of questions (each answer is an array of selected labels)",
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
const Api = HttpApi.make("question")
|
const Api = HttpApi.make("question")
|
||||||
.add(
|
.add(
|
||||||
@@ -25,7 +30,7 @@ const Api = HttpApi.make("question")
|
|||||||
),
|
),
|
||||||
HttpApiEndpoint.post("reply", `${root}/:requestID/reply`, {
|
HttpApiEndpoint.post("reply", `${root}/:requestID/reply`, {
|
||||||
params: { requestID: QuestionID },
|
params: { requestID: QuestionID },
|
||||||
payload: Question.Reply,
|
payload: Reply,
|
||||||
success: Schema.Boolean,
|
success: Schema.Boolean,
|
||||||
}).annotateMerge(
|
}).annotateMerge(
|
||||||
OpenApi.annotations({
|
OpenApi.annotations({
|
||||||
@@ -62,7 +67,7 @@ const QuestionLive = HttpApiBuilder.group(
|
|||||||
|
|
||||||
const reply = Effect.fn("QuestionHttpApi.reply")(function* (ctx: {
|
const reply = Effect.fn("QuestionHttpApi.reply")(function* (ctx: {
|
||||||
params: { requestID: QuestionID }
|
params: { requestID: QuestionID }
|
||||||
payload: Question.Reply
|
payload: Schema.Schema.Type<typeof Reply>
|
||||||
}) {
|
}) {
|
||||||
yield* svc.reply({
|
yield* svc.reply({
|
||||||
requestID: ctx.params.requestID,
|
requestID: ctx.params.requestID,
|
||||||
|
|||||||
@@ -8,6 +8,12 @@ import z from "zod"
|
|||||||
import { errors } from "../error"
|
import { errors } from "../error"
|
||||||
import { lazy } from "../../util/lazy"
|
import { lazy } from "../../util/lazy"
|
||||||
|
|
||||||
|
const Reply = z.object({
|
||||||
|
answers: Question.Answer.zod
|
||||||
|
.array()
|
||||||
|
.describe("User answers in order of questions (each answer is an array of selected labels)"),
|
||||||
|
})
|
||||||
|
|
||||||
export const QuestionRoutes = lazy(() =>
|
export const QuestionRoutes = lazy(() =>
|
||||||
new Hono()
|
new Hono()
|
||||||
.get(
|
.get(
|
||||||
@@ -56,7 +62,7 @@ export const QuestionRoutes = lazy(() =>
|
|||||||
requestID: QuestionID.zod,
|
requestID: QuestionID.zod,
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
validator("json", Question.Reply.zod),
|
validator("json", Reply),
|
||||||
async (c) => {
|
async (c) => {
|
||||||
const params = c.req.valid("param")
|
const params = c.req.valid("param")
|
||||||
const json = c.req.valid("json")
|
const json = c.req.valid("json")
|
||||||
|
|||||||
@@ -105,10 +105,10 @@ import type {
|
|||||||
PtyRemoveResponses,
|
PtyRemoveResponses,
|
||||||
PtyUpdateErrors,
|
PtyUpdateErrors,
|
||||||
PtyUpdateResponses,
|
PtyUpdateResponses,
|
||||||
|
QuestionAnswer,
|
||||||
QuestionListResponses,
|
QuestionListResponses,
|
||||||
QuestionRejectErrors,
|
QuestionRejectErrors,
|
||||||
QuestionRejectResponses,
|
QuestionRejectResponses,
|
||||||
QuestionReply,
|
|
||||||
QuestionReplyErrors,
|
QuestionReplyErrors,
|
||||||
QuestionReplyResponses,
|
QuestionReplyResponses,
|
||||||
SessionAbortErrors,
|
SessionAbortErrors,
|
||||||
@@ -2738,7 +2738,7 @@ export class Question extends HeyApiClient {
|
|||||||
requestID: string
|
requestID: string
|
||||||
directory?: string
|
directory?: string
|
||||||
workspace?: string
|
workspace?: string
|
||||||
questionReply?: QuestionReply
|
answers?: Array<QuestionAnswer>
|
||||||
},
|
},
|
||||||
options?: Options<never, ThrowOnError>,
|
options?: Options<never, ThrowOnError>,
|
||||||
) {
|
) {
|
||||||
@@ -2750,7 +2750,7 @@ export class Question extends HeyApiClient {
|
|||||||
{ in: "path", key: "requestID" },
|
{ in: "path", key: "requestID" },
|
||||||
{ in: "query", key: "directory" },
|
{ in: "query", key: "directory" },
|
||||||
{ in: "query", key: "workspace" },
|
{ in: "query", key: "workspace" },
|
||||||
{ key: "questionReply", map: "body" },
|
{ in: "body", key: "answers" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1925,13 +1925,6 @@ export type SubtaskPartInput = {
|
|||||||
command?: string
|
command?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type QuestionReply = {
|
|
||||||
/**
|
|
||||||
* User answers in order of questions (each answer is an array of selected labels)
|
|
||||||
*/
|
|
||||||
answers: Array<QuestionAnswer>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ProviderAuthMethod = {
|
export type ProviderAuthMethod = {
|
||||||
type: "oauth" | "api"
|
type: "oauth" | "api"
|
||||||
label: string
|
label: string
|
||||||
@@ -4259,7 +4252,12 @@ export type QuestionListResponses = {
|
|||||||
export type QuestionListResponse = QuestionListResponses[keyof QuestionListResponses]
|
export type QuestionListResponse = QuestionListResponses[keyof QuestionListResponses]
|
||||||
|
|
||||||
export type QuestionReplyData = {
|
export type QuestionReplyData = {
|
||||||
body?: QuestionReply
|
body?: {
|
||||||
|
/**
|
||||||
|
* User answers in order of questions (each answer is an array of selected labels)
|
||||||
|
*/
|
||||||
|
answers: Array<QuestionAnswer>
|
||||||
|
}
|
||||||
path: {
|
path: {
|
||||||
requestID: string
|
requestID: string
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user