refactor(core): consolidate references (#31539)

This commit is contained in:
Dax
2026-06-09 12:08:58 -04:00
committed by GitHub
parent 75d469d17d
commit ec87cf82cb
65 changed files with 687 additions and 2730 deletions
+31 -43
View File
@@ -172,8 +172,6 @@ import type {
QuestionReplyErrors,
QuestionReplyResponses,
QuestionV2Reply,
ReferenceListErrors,
ReferenceListResponses,
SessionAbortErrors,
SessionAbortResponses,
SessionChildrenErrors,
@@ -288,6 +286,8 @@ import type {
V2ProviderListResponses,
V2QuestionRequestListErrors,
V2QuestionRequestListResponses,
V2ReferenceListErrors,
V2ReferenceListResponses,
V2SessionCompactErrors,
V2SessionCompactResponses,
V2SessionContextErrors,
@@ -3335,38 +3335,6 @@ export class Provider extends HeyApiClient {
}
}
export class Reference extends HeyApiClient {
/**
* List configured references
*
* List configured references resolved in the current workspace.
*/
public list<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams(
[parameters],
[
{
args: [
{ in: "query", key: "directory" },
{ in: "query", key: "workspace" },
],
},
],
)
return (options?.client ?? this.client).get<ReferenceListResponses, ReferenceListErrors, ThrowOnError>({
url: "/reference",
...options,
...params,
})
}
}
export class Session2 extends HeyApiClient {
/**
* List sessions
@@ -5580,7 +5548,6 @@ export class Fs extends HeyApiClient {
workspace?: string
}
path: string
reference?: string
},
options?: Options<never, ThrowOnError>,
) {
@@ -5591,7 +5558,6 @@ export class Fs extends HeyApiClient {
args: [
{ in: "query", key: "location" },
{ in: "query", key: "path" },
{ in: "query", key: "reference" },
],
},
],
@@ -5615,7 +5581,6 @@ export class Fs extends HeyApiClient {
workspace?: string
}
path?: string
reference?: string
},
options?: Options<never, ThrowOnError>,
) {
@@ -5626,7 +5591,6 @@ export class Fs extends HeyApiClient {
args: [
{ in: "query", key: "location" },
{ in: "query", key: "path" },
{ in: "query", key: "reference" },
],
},
],
@@ -5746,6 +5710,30 @@ export class Question3 extends HeyApiClient {
}
}
export class Reference extends HeyApiClient {
/**
* List references
*
* List references available in the requested 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<V2ReferenceListResponses, V2ReferenceListErrors, ThrowOnError>({
url: "/api/reference",
...options,
...params,
})
}
}
export class V2 extends HeyApiClient {
private _health?: Health
get health(): Health {
@@ -5801,6 +5789,11 @@ export class V2 extends HeyApiClient {
get question(): Question3 {
return (this._question ??= new Question3({ client: this.client }))
}
private _reference?: Reference
get reference(): Reference {
return (this._reference ??= new Reference({ client: this.client }))
}
}
export class OpencodeClient extends HeyApiClient {
@@ -5921,11 +5914,6 @@ export class OpencodeClient extends HeyApiClient {
return (this._provider ??= new Provider({ client: this.client }))
}
private _reference?: Reference
get reference(): Reference {
return (this._reference ??= new Reference({ client: this.client }))
}
private _session?: Session2
get session(): Session2 {
return (this._session ??= new Session2({ client: this.client }))
+70 -64
View File
@@ -57,6 +57,7 @@ export type Event =
| EventAccountSwitched
| EventPermissionV2Asked
| EventPermissionV2Replied
| EventReferenceUpdated
| EventFileWatcherUpdated
| EventPtyCreated
| EventPtyUpdated
@@ -633,7 +634,6 @@ export type Prompt = {
text: string
files?: Array<PromptFileAttachment>
agents?: Array<PromptAgentAttachment>
references?: Array<PromptReferenceAttachment>
}
export type Pty = {
@@ -1296,6 +1296,13 @@ export type GlobalEvent = {
reply: PermissionV2Reply
}
}
| {
id: string
type: "reference.updated"
properties: {
[key: string]: unknown
}
}
| {
id: string
type: "file.watcher.updated"
@@ -2590,26 +2597,6 @@ export type ProviderAuthError1 = {
}
}
export type ReferenceDescriptor =
| {
name: string
kind: "local"
path: string
}
| {
name: string
kind: "git"
repository: string
path: string
branch?: string
}
| {
name: string
kind: "invalid"
repository?: string
message: string
}
export type NotFoundError = {
name: "NotFoundError"
data: {
@@ -2986,18 +2973,6 @@ export type PromptAgentAttachment = {
source?: PromptSource
}
export type PromptReferenceAttachment = {
name: string
kind: "local" | "git" | "invalid"
uri?: string
repository?: string
branch?: string
target?: string
targetUri?: string
problem?: string
source?: PromptSource
}
export type SessionErrorUnknown = {
type: "unknown"
message: string
@@ -3896,7 +3871,6 @@ export type SessionMessageUser = {
text: string
files?: Array<PromptFileAttachment>
agents?: Array<PromptAgentAttachment>
references?: Array<PromptReferenceAttachment>
type: "user"
}
@@ -4212,6 +4186,23 @@ export type QuestionV2Reply = {
answers: Array<QuestionV2Answer>
}
export type ReferenceLocalSource = {
type: "local"
path: string
}
export type ReferenceGitSource = {
type: "git"
repository: string
branch?: string
}
export type ReferenceInfo = {
name: string
path: string
source: ReferenceLocalSource | ReferenceGitSource
}
export type EventModelsDevRefreshed = {
id: string
type: "models-dev.refreshed"
@@ -4933,6 +4924,14 @@ export type EventPermissionV2Replied = {
}
}
export type EventReferenceUpdated = {
id: string
type: "reference.updated"
properties: {
[key: string]: unknown
}
}
export type EventFileWatcherUpdated = {
id: string
type: "file.watcher.updated"
@@ -7640,34 +7639,6 @@ export type ProviderOauthCallbackResponses = {
export type ProviderOauthCallbackResponse = ProviderOauthCallbackResponses[keyof ProviderOauthCallbackResponses]
export type ReferenceListData = {
body?: never
path?: never
query?: {
directory?: string
workspace?: string
}
url: "/reference"
}
export type ReferenceListErrors = {
/**
* Bad request
*/
400: BadRequestError
}
export type ReferenceListError = ReferenceListErrors[keyof ReferenceListErrors]
export type ReferenceListResponses = {
/**
* Resolved configured references
*/
200: Array<ReferenceDescriptor>
}
export type ReferenceListResponse = ReferenceListResponses[keyof ReferenceListResponses]
export type SessionListData = {
body?: never
path?: never
@@ -10098,7 +10069,6 @@ export type V2FsReadData = {
workspace?: string
}
path: string
reference?: string
}
url: "/api/fs/read"
}
@@ -10137,7 +10107,6 @@ export type V2FsListData = {
workspace?: string
}
path?: string
reference?: string
}
url: "/api/fs/list"
}
@@ -10384,6 +10353,43 @@ export type V2SessionQuestionRejectResponses = {
export type V2SessionQuestionRejectResponse = V2SessionQuestionRejectResponses[keyof V2SessionQuestionRejectResponses]
export type V2ReferenceListData = {
body?: never
path?: never
query?: {
location?: {
directory?: string
workspace?: string
}
}
url: "/api/reference"
}
export type V2ReferenceListErrors = {
/**
* InvalidRequestError
*/
400: InvalidRequestError
/**
* UnauthorizedError
*/
401: UnauthorizedError
}
export type V2ReferenceListError = V2ReferenceListErrors[keyof V2ReferenceListErrors]
export type V2ReferenceListResponses = {
/**
* Success
*/
200: {
location: LocationInfo
data: Array<ReferenceInfo>
}
}
export type V2ReferenceListResponse = V2ReferenceListResponses[keyof V2ReferenceListResponses]
export type PtyConnectData = {
body?: never
path: {