feat(core): add embedded v2 session runtime and tool foundation (#30632)

This commit is contained in:
Kit Langton
2026-06-03 23:02:17 -04:00
committed by GitHub
parent c35267776a
commit 76ee87ead8
215 changed files with 31344 additions and 3278 deletions
+9 -2
View File
@@ -1,4 +1,9 @@
export * from "./gen/types.gen.js"
export type {
FileSystemBinaryContent as LocationFileSystemBinaryContent,
FileSystemEntry as LocationFileSystemEntry,
FileSystemTextContent as LocationFileSystemTextContent,
} from "./gen/types.gen.js"
import { createClient } from "./gen/client/client.gen.js"
import { type Config } from "./gen/client/types.gen.js"
@@ -30,8 +35,10 @@ function rewrite(request: Request, values: { directory?: string; workspace?: str
key === "directory" ? encodeURIComponent : undefined,
)
if (!value) continue
if (!url.searchParams.has(key)) {
url.searchParams.set(key, value)
for (const query of url.pathname.startsWith("/api/") ? [key, `location[${key}]`] : [key]) {
if (!url.searchParams.has(query)) {
url.searchParams.set(query, value)
}
}
changed = true
}
+135 -3
View File
@@ -166,6 +166,7 @@ import type {
QuestionRejectResponses,
QuestionReplyErrors,
QuestionReplyResponses,
QuestionV2Reply,
SessionAbortErrors,
SessionAbortResponses,
SessionChildrenErrors,
@@ -178,7 +179,6 @@ import type {
SessionDeleteMessageErrors,
SessionDeleteMessageResponses,
SessionDeleteResponses,
SessionDelivery,
SessionDiffErrors,
SessionDiffResponses,
SessionForkErrors,
@@ -271,6 +271,8 @@ import type {
V2ProviderGetResponses,
V2ProviderListErrors,
V2ProviderListResponses,
V2QuestionRequestListErrors,
V2QuestionRequestListResponses,
V2SessionCompactErrors,
V2SessionCompactResponses,
V2SessionContextErrors,
@@ -285,6 +287,10 @@ import type {
V2SessionPermissionReplyResponses,
V2SessionPromptErrors,
V2SessionPromptResponses,
V2SessionQuestionRejectErrors,
V2SessionQuestionRejectResponses,
V2SessionQuestionReplyErrors,
V2SessionQuestionReplyResponses,
V2SessionWaitErrors,
V2SessionWaitResponses,
VcsApplyErrors,
@@ -4525,6 +4531,83 @@ export class Permission2 extends HeyApiClient {
}
}
export class Question2 extends HeyApiClient {
/**
* Reply to pending question request
*
* Answer a pending question request owned by a session.
*/
public reply<ThrowOnError extends boolean = false>(
parameters: {
sessionID: string
requestID: string
questionV2Reply: QuestionV2Reply
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams(
[parameters],
[
{
args: [
{ in: "path", key: "sessionID" },
{ in: "path", key: "requestID" },
{ key: "questionV2Reply", map: "body" },
],
},
],
)
return (options?.client ?? this.client).post<
V2SessionQuestionReplyResponses,
V2SessionQuestionReplyErrors,
ThrowOnError
>({
url: "/api/session/{sessionID}/question/request/{requestID}/reply",
...options,
...params,
headers: {
"Content-Type": "application/json",
...options?.headers,
...params.headers,
},
})
}
/**
* Reject pending question request
*
* Reject a pending question request owned by a session.
*/
public reject<ThrowOnError extends boolean = false>(
parameters: {
sessionID: string
requestID: string
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams(
[parameters],
[
{
args: [
{ in: "path", key: "sessionID" },
{ in: "path", key: "requestID" },
],
},
],
)
return (options?.client ?? this.client).post<
V2SessionQuestionRejectResponses,
V2SessionQuestionRejectErrors,
ThrowOnError
>({
url: "/api/session/{sessionID}/question/request/{requestID}/reject",
...options,
...params,
})
}
}
export class Session3 extends HeyApiClient {
/**
* List v2 sessions
@@ -4571,15 +4654,17 @@ export class Session3 extends HeyApiClient {
/**
* Send v2 message
*
* Create a v2 session message and queue it for the agent loop.
* Durably admit one v2 session input and schedule agent-loop execution unless resume is false.
*/
public prompt<ThrowOnError extends boolean = false>(
parameters: {
sessionID: string
directory?: string
workspace?: string
id?: string
prompt?: Prompt
delivery?: SessionDelivery
delivery?: "steer" | "queue"
resume?: boolean
},
options?: Options<never, ThrowOnError>,
) {
@@ -4591,8 +4676,10 @@ export class Session3 extends HeyApiClient {
{ in: "path", key: "sessionID" },
{ in: "query", key: "directory" },
{ in: "query", key: "workspace" },
{ in: "body", key: "id" },
{ in: "body", key: "prompt" },
{ in: "body", key: "delivery" },
{ in: "body", key: "resume" },
],
},
],
@@ -4747,6 +4834,11 @@ export class Session3 extends HeyApiClient {
get permission(): Permission2 {
return (this._permission ??= new Permission2({ client: this.client }))
}
private _question?: Question2
get question(): Question2 {
return (this._question ??= new Question2({ client: this.client }))
}
}
export class Model extends HeyApiClient {
@@ -4990,6 +5082,41 @@ export class Fs extends HeyApiClient {
}
}
export class Request2 extends HeyApiClient {
/**
* List pending question requests
*
* Retrieve pending question requests for a location.
*/
public list<ThrowOnError extends boolean = false>(
parameters?: {
location?: {
directory?: string
workspace?: string
}
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }])
return (options?.client ?? this.client).get<
V2QuestionRequestListResponses,
V2QuestionRequestListErrors,
ThrowOnError
>({
url: "/api/question/request",
...options,
...params,
})
}
}
export class Question3 extends HeyApiClient {
private _request?: Request2
get request(): Request2 {
return (this._request ??= new Request2({ client: this.client }))
}
}
export class V2 extends HeyApiClient {
private _session?: Session3
get session(): Session3 {
@@ -5015,6 +5142,11 @@ export class V2 extends HeyApiClient {
get fs(): Fs {
return (this._fs ??= new Fs({ client: this.client }))
}
private _question?: Question3
get question(): Question3 {
return (this._question ??= new Question3({ client: this.client }))
}
}
export class Control extends HeyApiClient {
File diff suppressed because it is too large Load Diff
+1252 -379
View File
File diff suppressed because it is too large Load Diff