Merge remote-tracking branch 'origin/v2' into search-integration

# Conflicts:
#	packages/client/test/promise.test.ts
#	packages/core/schema.json
#	packages/core/src/database/migration.gen.ts
#	packages/core/src/tool/websearch.ts
#	packages/sdk-next/src/index.ts
#	packages/sdk/js/src/v2/gen/types.gen.ts
This commit is contained in:
Shoubhit Dash 2026-07-07 17:38:46 +05:30
commit 7b8d8b8861
666 changed files with 46671 additions and 20220 deletions

View file

@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/sdk",
"version": "1.17.13",
"version": "1.17.14",
"type": "module",
"license": "MIT",
"scripts": {

View file

@ -30,6 +30,8 @@ type OpenApiDocument = {
const document = (await Bun.file("./openapi.json").json()) as OpenApiDocument
const v2Document = (await Bun.file("./openapi-v2.json").json()) as OpenApiDocument
normalizeComponentNames(v2Document)
deduplicateEquivalentComponent(v2Document, "Shell", "Shell1")
renameCollidingComponents(document, v2Document)
document.paths = { ...document.paths, ...v2Document.paths }
document.components = {
@ -60,7 +62,7 @@ if (schemas) {
visit({ ...document, components: { ...document.components, schemas: undefined } })
for (const name of Object.keys(schemas)) {
if (
/^(SessionAgentSelected|SessionModelSelected|SessionMoved|SessionRenamed|SessionForked|SessionPromptPromoted|SessionPromptAdmitted|SessionExecutionSettled|SessionContextUpdated|SessionSynthetic|SessionSkillActivated|SessionShellStarted|SessionShellEnded|SessionStepStarted|SessionStepEnded|SessionStepFailed|SessionTextStarted|SessionTextDelta|SessionTextEnded|SessionReasoningStarted|SessionReasoningDelta|SessionReasoningEnded|SessionToolInputStarted|SessionToolInputDelta|SessionToolInputEnded|SessionToolCalled|SessionToolProgress|SessionToolSuccess|SessionToolFailed|SessionRetried|SessionCompactionStarted|SessionCompactionDelta|SessionCompactionEnded|SessionRevertStaged|SessionRevertCleared|SessionRevertCommitted)1$/.test(
/^(SessionAgentSelected|SessionModelSelected|SessionMoved|SessionRenamed|SessionForked|SessionPromptPromoted|SessionPromptAdmitted|SessionExecutionStarted|SessionExecutionSucceeded|SessionExecutionFailed|SessionExecutionInterrupted|SessionInstructionsUpdated|SessionSynthetic|SessionSkillActivated|SessionShellStarted|SessionShellEnded|SessionStepStarted|SessionStepEnded|SessionStepFailed|SessionTextStarted|SessionTextDelta|SessionTextEnded|SessionToolInputStarted|SessionToolInputDelta|SessionToolInputEnded|SessionToolCalled|SessionToolProgress|SessionToolSuccess|SessionToolFailed|SessionRetryScheduled|SessionCompactionStarted|SessionCompactionDelta|SessionCompactionEnded|SessionRevertStaged|SessionRevertCleared|SessionRevertCommitted)\d+$/.test(
name,
) &&
!reachable.has(name)
@ -100,17 +102,28 @@ await createClient({
const generatedTypesPath = "./src/v2/gen/types.gen.ts"
const generatedTypes = await Bun.file(generatedTypesPath).text()
if (
/export type (SessionAgentSelected|SessionModelSelected|SessionMoved|SessionRenamed|SessionForked|SessionPromptPromoted|SessionPromptAdmitted|SessionExecutionSettled|SessionContextUpdated|SessionSynthetic|SessionSkillActivated|SessionShellStarted|SessionShellEnded|SessionStepStarted|SessionStepEnded|SessionStepFailed|SessionTextStarted|SessionTextDelta|SessionTextEnded|SessionReasoningStarted|SessionReasoningDelta|SessionReasoningEnded|SessionToolInputStarted|SessionToolInputDelta|SessionToolInputEnded|SessionToolCalled|SessionToolProgress|SessionToolSuccess|SessionToolFailed|SessionRetried|SessionCompactionStarted|SessionCompactionDelta|SessionCompactionEnded|SessionRevertStaged|SessionRevertCleared|SessionRevertCommitted)1 =/.test(
/export type (SessionAgentSelected|SessionModelSelected|SessionMoved|SessionRenamed|SessionForked|SessionPromptPromoted|SessionPromptAdmitted|SessionExecutionStarted|SessionExecutionSucceeded|SessionExecutionFailed|SessionExecutionInterrupted|SessionInstructionsUpdated|SessionSynthetic|SessionSkillActivated|SessionShellStarted|SessionShellEnded|SessionStepStarted|SessionStepEnded|SessionStepFailed|SessionTextStarted|SessionTextDelta|SessionTextEnded|SessionToolInputStarted|SessionToolInputDelta|SessionToolInputEnded|SessionToolCalled|SessionToolProgress|SessionToolSuccess|SessionToolFailed|SessionRetryScheduled|SessionCompactionStarted|SessionCompactionDelta|SessionCompactionEnded|SessionRevertStaged|SessionRevertCleared|SessionRevertCommitted)\d+ =/.test(
generatedTypes,
)
) {
throw new Error("Session history generated duplicate Session event variants")
}
const logTypesPatched = generatedTypes.replace(
const sessionErrorTypesPatched = deduplicateEquivalentGeneratedTypes(
generatedTypes,
"SessionStructuredError",
/^SessionStructuredError\d+$/,
)
const obsoleteSessionNext = [...sessionErrorTypesPatched.matchAll(/export type (SessionNext\w*) =/g)].map(
(match) => match[1],
)
if (obsoleteSessionNext.length > 0) {
throw new Error(`Obsolete SessionNext generated type noise reintroduced: ${obsoleteSessionNext.join(", ")}`)
}
const logTypesPatched = sessionErrorTypesPatched.replace(
/(export type V2SessionLogData = \{[\s\S]*?query\?: \{\s*after\?: )string/,
"$1number",
)
if (logTypesPatched === generatedTypes) {
if (logTypesPatched === sessionErrorTypesPatched) {
throw new Error("Session log numeric query patch did not apply")
}
const sessionListTypesPatched = logTypesPatched.replace(
@ -128,12 +141,21 @@ if (sessionMessagesTypesPatched === sessionListTypesPatched) {
throw new Error("Session messages numeric query patch did not apply")
}
const eventSubscribeTypesPatched = sessionMessagesTypesPatched.replace(
/(export type V2EventSubscribeResponses = \{\s*\/\*\*[\s\S]*?\*\/\s*200: )\{\s*id: string \| null;?\s*event: string;?\s*data: V2EventStreamV2;?\s*\};?/,
/(export type V2EventSubscribeResponses = \{\s*\/\*\*[\s\S]*?\*\/\s*200: )\{\s*id: string \| null;?\s*event: string;?\s*data: V2EventStream(?:V2)?;?\s*\};?/,
"$1V2Event",
)
if (eventSubscribeTypesPatched === sessionMessagesTypesPatched) {
throw new Error("Event subscribe response patch did not apply")
}
if (/SessionStructuredError\d/.test(eventSubscribeTypesPatched)) {
throw new Error("Session structured error generated a name-mangled duplicate")
}
if (/\bSessionNext\w*\b/.test(eventSubscribeTypesPatched)) {
throw new Error("Obsolete SessionNext generated type noise reintroduced")
}
if (/export type Shell\d+V2 =/.test(eventSubscribeTypesPatched)) {
throw new Error("Shell generated a name-mangled duplicate")
}
await Bun.write(generatedTypesPath, eventSubscribeTypesPatched)
const querySerializerPath = "./src/v2/gen/client/utils.gen.ts"
@ -206,6 +228,10 @@ function renameCollidingComponents(target: OpenApiDocument, source: OpenApiDocum
const renames = new Map<string, string>()
for (const name of Object.keys(sourceSchemas)) {
if (!Object.hasOwn(targetSchemas, name)) continue
if (JSON.stringify(normalizeSchema(sourceSchemas[name])) === JSON.stringify(normalizeSchema(targetSchemas[name]))) {
delete sourceSchemas[name]
continue
}
let renamed = `${name}V2`
let index = 2
while (Object.hasOwn(targetSchemas, renamed) || Object.hasOwn(sourceSchemas, renamed)) {
@ -225,6 +251,136 @@ function renameCollidingComponents(target: OpenApiDocument, source: OpenApiDocum
source.paths = rewriteRefs(source.paths, renames) as Record<string, unknown> | undefined
}
function normalizeComponentNames(document: OpenApiDocument) {
const schemas = document.components?.schemas
if (!schemas) return
const canonical = new Map(Object.entries(schemas))
const renames = new Map<string, string>()
for (const name of Object.keys(schemas)) {
const next = componentTypeName(name)
if (next === name) continue
const existing = canonical.get(next)
if (existing !== undefined) {
if (JSON.stringify(normalizeSchema(schemas[name])) !== JSON.stringify(normalizeSchema(existing))) continue
renames.set(name, next)
continue
}
renames.set(name, next)
canonical.set(next, schemas[name])
}
if (renames.size === 0) return
const renamed = new Set<string>()
document.components = {
...document.components,
schemas: Object.fromEntries(
[
...Object.entries(schemas).filter(([name]) => !renames.has(name)),
...Object.entries(schemas).flatMap(([name, schema]) => {
const next = renames.get(name)
if (!next || Object.hasOwn(schemas, next) || renamed.has(next)) return []
renamed.add(next)
return [[next, schema] as const]
}),
].map(([name, schema]) => [name, rewriteRefs(schema, renames)]),
),
}
document.paths = rewriteRefs(document.paths, renames) as Record<string, unknown> | undefined
}
function componentTypeName(name: string) {
if (!name.includes(".")) return name
return name
.split(".")
.filter((part) => !/^\d+$/.test(part))
.map((part) => part.slice(0, 1).toUpperCase() + part.slice(1))
.join("")
}
function deduplicateEquivalentComponent(document: OpenApiDocument, canonical: string, duplicate: string) {
const schemas = document.components?.schemas
if (!schemas?.[canonical] || !schemas[duplicate]) return
if (JSON.stringify(normalizeSchema(schemas[canonical])) !== JSON.stringify(normalizeSchema(schemas[duplicate]))) {
throw new Error(`${duplicate} no longer has the same wire shape as ${canonical}`)
}
const renames = new Map([[duplicate, canonical]])
const rewritten = rewriteRefs(schemas, renames) as Record<string, unknown>
delete rewritten[duplicate]
document.components = { ...document.components, schemas: rewritten }
document.paths = rewriteRefs(document.paths, renames) as Record<string, unknown> | undefined
}
function deduplicateEquivalentGeneratedTypes(source: string, canonical: string, duplicates: RegExp) {
const canonicalType = generatedType(source, canonical)
if (!canonicalType) throw new Error(`Generated canonical type missing: ${canonical}`)
const names = [...source.matchAll(/export type (\w+) =/g)]
.map((match) => match[1])
.filter((name): name is string => name !== undefined && duplicates.test(name))
return names.reduce((patched, name) => {
const duplicate = generatedType(patched, name)
const currentCanonical = generatedType(patched, canonical)
if (!duplicate || !currentCanonical) throw new Error(`Generated type declaration missing while comparing ${name}`)
if (normalizeGeneratedType(currentCanonical.shape) !== normalizeGeneratedType(duplicate.shape)) {
throw new Error(`${name} no longer has the same generated type shape as ${canonical}`)
}
return (patched.slice(0, duplicate.start) + patched.slice(duplicate.end)).replaceAll(name, canonical)
}, source)
}
function generatedType(source: string, name: string) {
const start = source.indexOf(`export type ${name} =`)
if (start === -1) return undefined
const next = source.indexOf("\n\nexport type ", start + 1)
const shapeEnd = next === -1 ? source.length : next
return {
start,
end: next === -1 ? source.length : next + 2,
shape: source.slice(source.indexOf("=", start) + 1, shapeEnd),
}
}
function normalizeGeneratedType(shape: string) {
return shape.replaceAll(/\s/g, "")
}
function normalizeSchema(value: unknown, key?: string): unknown {
if (Array.isArray(value)) {
const flattened =
key === "anyOf"
? value.flatMap((item) =>
typeof item === "object" && item !== null && Object.keys(item).length === 1 && "anyOf" in item
? Array.isArray(item.anyOf)
? item.anyOf
: [item]
: [item],
)
: value
const expanded =
key === "anyOf"
? flattened.flatMap((item) => {
if (typeof item !== "object" || item === null || !("type" in item) || !("enum" in item)) return [item]
if (Object.keys(item).some((property) => property !== "type" && property !== "enum")) return [item]
if (!Array.isArray(item.enum)) return [item]
return item.enum.map((member) => ({ type: item.type, enum: [member] }))
})
: flattened
const normalized = expanded.map((item) => normalizeSchema(item))
if (key !== "anyOf" && key !== "required" && key !== "enum") return normalized
return [...new Map(normalized.map((item) => [JSON.stringify(item), item])).values()].sort((a, b) =>
JSON.stringify(a).localeCompare(JSON.stringify(b)),
)
}
if (typeof value !== "object" || value === null) return value
return Object.fromEntries(
Object.entries(value)
.sort(([left], [right]) => left.localeCompare(right))
.map(([property, child]) => [property, normalizeSchema(child, property)]),
)
}
function rewriteRefs(value: unknown, renames: Map<string, string>): unknown {
if (Array.isArray(value)) return value.map((item) => rewriteRefs(item, renames))
if (typeof value !== "object" || value === null) return value

View file

@ -76,8 +76,8 @@ import type {
FindTextResponses,
FormatterStatusErrors,
FormatterStatusResponses,
FormCreatePayload2,
FormReply2,
FormCreatePayloadV2,
FormReply,
GlobalConfigGetErrors,
GlobalConfigGetResponses,
GlobalConfigUpdateErrors,
@ -92,7 +92,8 @@ import type {
GlobalUpgradeResponses,
InstanceDisposeErrors,
InstanceDisposeResponses,
LocationRef2,
InstructionEntryKeyV2,
LocationRefV2,
LspStatusErrors,
LspStatusResponses,
McpAddErrors,
@ -113,7 +114,7 @@ import type {
McpRemoteConfig,
McpStatusErrors,
McpStatusResponses,
ModelRef2,
ModelRef,
MoveSessionDestination,
OutputFormat,
Part as Part2,
@ -130,8 +131,8 @@ import type {
PermissionRespondErrors,
PermissionRespondResponses,
PermissionRuleset,
PermissionV2Reply2,
PermissionV2Source2,
PermissionV2Reply,
PermissionV2SourceV2,
ProjectCommands,
ProjectCurrentErrors,
ProjectCurrentResponses,
@ -144,9 +145,9 @@ import type {
ProjectListResponses,
ProjectUpdateErrors,
ProjectUpdateResponses,
PromptAgentAttachment2,
PromptInputFileAttachment2,
PromptInputV2,
PromptAgentAttachment,
PromptInput,
PromptInputFileAttachment,
ProviderAuthErrors,
ProviderAuthResponses,
ProviderListErrors,
@ -178,14 +179,13 @@ import type {
QuestionRejectResponses,
QuestionReplyErrors,
QuestionReplyResponses,
QuestionV2Reply2,
QuestionV2Reply,
SessionAbortErrors,
SessionAbortResponses,
SessionChildrenErrors,
SessionChildrenResponses,
SessionCommandErrors,
SessionCommandResponses,
SessionContextEntryKey2,
SessionCreateErrors,
SessionCreateResponses,
SessionDeleteErrors,
@ -278,8 +278,6 @@ import type {
V2CredentialUpdateResponses,
V2DebugLocationErrors,
V2DebugLocationResponses,
V2EventChangesErrors,
V2EventChangesResponses,
V2EventSubscribeErrors,
V2EventSubscribeResponses,
V2FormRequestListErrors,
@ -370,12 +368,6 @@ import type {
V2SessionCommandResponses,
V2SessionCompactErrors,
V2SessionCompactResponses,
V2SessionContextEntryListErrors,
V2SessionContextEntryListResponses,
V2SessionContextEntryPutErrors,
V2SessionContextEntryPutResponses,
V2SessionContextEntryRemoveErrors,
V2SessionContextEntryRemoveResponses,
V2SessionContextErrors,
V2SessionContextResponses,
V2SessionCreateErrors,
@ -396,6 +388,12 @@ import type {
V2SessionFormStateResponses,
V2SessionGetErrors,
V2SessionGetResponses,
V2SessionInstructionsEntryListErrors,
V2SessionInstructionsEntryListResponses,
V2SessionInstructionsEntryPutErrors,
V2SessionInstructionsEntryPutResponses,
V2SessionInstructionsEntryRemoveErrors,
V2SessionInstructionsEntryRemoveResponses,
V2SessionInterruptErrors,
V2SessionInterruptResponses,
V2SessionListErrors,
@ -422,6 +420,8 @@ import type {
V2SessionQuestionRejectResponses,
V2SessionQuestionReplyErrors,
V2SessionQuestionReplyResponses,
V2SessionRemoveErrors,
V2SessionRemoveResponses,
V2SessionRenameErrors,
V2SessionRenameResponses,
V2SessionRevertClearErrors,
@ -452,6 +452,8 @@ import type {
V2ShellOutputResponses,
V2ShellRemoveErrors,
V2ShellRemoveResponses,
V2ShellTimeoutErrors,
V2ShellTimeoutResponses,
V2SkillListErrors,
V2SkillListResponses,
V2VcsDiffErrors,
@ -466,7 +468,7 @@ import type {
VcsDiffResponses,
VcsGetErrors,
VcsGetResponses,
VcsMode2,
VcsMode,
VcsStatusErrors,
VcsStatusResponses,
WorktreeCreateErrors,
@ -5268,9 +5270,9 @@ export class Revert extends HeyApiClient {
export class Entry extends HeyApiClient {
/**
* List context entries
* List instruction entries
*
* List API-managed context entries attached to the session's system context.
* List API-managed instruction entries attached to the session.
*/
public list<ThrowOnError extends boolean = false>(
parameters: {
@ -5280,25 +5282,25 @@ export class Entry extends HeyApiClient {
) {
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }])
return (options?.client ?? this.client).get<
V2SessionContextEntryListResponses,
V2SessionContextEntryListErrors,
V2SessionInstructionsEntryListResponses,
V2SessionInstructionsEntryListErrors,
ThrowOnError
>({
url: "/api/session/{sessionID}/context-entry",
url: "/api/session/{sessionID}/instructions/entries",
...options,
...params,
})
}
/**
* Remove context entry
* Remove instruction entry
*
* Remove one context entry; the removal is announced to the model at the next turn boundary.
* Remove one instruction entry; the removal is announced to the model at the next step boundary.
*/
public remove<ThrowOnError extends boolean = false>(
parameters: {
sessionID: string
key: SessionContextEntryKey2
key: InstructionEntryKeyV2
},
options?: Options<never, ThrowOnError>,
) {
@ -5314,25 +5316,25 @@ export class Entry extends HeyApiClient {
],
)
return (options?.client ?? this.client).delete<
V2SessionContextEntryRemoveResponses,
V2SessionContextEntryRemoveErrors,
V2SessionInstructionsEntryRemoveResponses,
V2SessionInstructionsEntryRemoveErrors,
ThrowOnError
>({
url: "/api/session/{sessionID}/context-entry/{key}",
url: "/api/session/{sessionID}/instructions/entries/{key}",
...options,
...params,
})
}
/**
* Put context entry
* Put instruction entry
*
* Attach or replace one durable context entry. The value is rendered into the session's system context; changes announce as updates at the next turn boundary.
* Attach or replace one durable instruction entry. Changes announce as updates at the next step boundary.
*/
public put<ThrowOnError extends boolean = false>(
parameters: {
sessionID: string
key: SessionContextEntryKey2
key: InstructionEntryKeyV2
value?: unknown
},
options?: Options<never, ThrowOnError>,
@ -5350,11 +5352,11 @@ export class Entry extends HeyApiClient {
],
)
return (options?.client ?? this.client).put<
V2SessionContextEntryPutResponses,
V2SessionContextEntryPutErrors,
V2SessionInstructionsEntryPutResponses,
V2SessionInstructionsEntryPutErrors,
ThrowOnError
>({
url: "/api/session/{sessionID}/context-entry/{key}",
url: "/api/session/{sessionID}/instructions/entries/{key}",
...options,
...params,
headers: {
@ -5366,7 +5368,7 @@ export class Entry extends HeyApiClient {
}
}
export class Context extends HeyApiClient {
export class Instructions extends HeyApiClient {
private _entry?: Entry
get entry(): Entry {
return (this._entry ??= new Entry({ client: this.client }))
@ -5401,7 +5403,7 @@ export class Form extends HeyApiClient {
public create<ThrowOnError extends boolean = false>(
parameters: {
sessionID: string
formCreatePayload: FormCreatePayload2
formCreatePayloadV2: FormCreatePayloadV2
},
options?: Options<never, ThrowOnError>,
) {
@ -5411,7 +5413,7 @@ export class Form extends HeyApiClient {
{
args: [
{ in: "path", key: "sessionID" },
{ key: "formCreatePayload", map: "body" },
{ key: "formCreatePayloadV2", map: "body" },
],
},
],
@ -5499,7 +5501,7 @@ export class Form extends HeyApiClient {
parameters: {
sessionID: string
formID: string
formReply: FormReply2
formReply: FormReply
},
options?: Options<never, ThrowOnError>,
) {
@ -5599,7 +5601,7 @@ export class Permission2 extends HeyApiClient {
metadata?: {
[key: string]: unknown
}
source?: PermissionV2Source2
source?: PermissionV2SourceV2
agent?: string | null
},
options?: Options<never, ThrowOnError>,
@ -5680,7 +5682,7 @@ export class Permission2 extends HeyApiClient {
parameters: {
sessionID: string
requestID: string
reply?: PermissionV2Reply2
reply?: PermissionV2Reply
message?: string | null
},
options?: Options<never, ThrowOnError>,
@ -5748,7 +5750,7 @@ export class Question2 extends HeyApiClient {
parameters: {
sessionID: string
requestID: string
questionV2Reply: QuestionV2Reply2
questionV2Reply: QuestionV2Reply
},
options?: Options<never, ThrowOnError>,
) {
@ -5869,8 +5871,8 @@ export class Session3 extends HeyApiClient {
parameters?: {
id?: string | null
agent?: string | null
model?: ModelRef2 | null
location?: LocationRef2 | null
model?: ModelRef | null
location?: LocationRefV2 | null
},
options?: Options<never, ThrowOnError>,
) {
@ -5902,7 +5904,7 @@ export class Session3 extends HeyApiClient {
/**
* List active sessions
*
* Retrieve foreground Session drains currently owned by this OpenCode process. Sessions absent from the result are inactive. Watermarks are the durable log positions read alongside the activity snapshot; activity itself is process state, so the pairing is advisory rather than transactional.
* Retrieve foreground Session drains currently owned by this OpenCode process. Sessions absent from the result are inactive.
*/
public active<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) {
return (options?.client ?? this.client).get<V2SessionActiveResponses, V2SessionActiveErrors, ThrowOnError>({
@ -5911,6 +5913,25 @@ export class Session3 extends HeyApiClient {
})
}
/**
* Delete session
*
* Delete a session and its child sessions.
*/
public remove<ThrowOnError extends boolean = false>(
parameters: {
sessionID: string
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }])
return (options?.client ?? this.client).delete<V2SessionRemoveResponses, V2SessionRemoveErrors, ThrowOnError>({
url: "/api/session/{sessionID}",
...options,
...params,
})
}
/**
* Get session
*
@ -6012,7 +6033,7 @@ export class Session3 extends HeyApiClient {
public switchModel<ThrowOnError extends boolean = false>(
parameters: {
sessionID: string
model?: ModelRef2
model?: ModelRef
},
options?: Options<never, ThrowOnError>,
) {
@ -6087,7 +6108,7 @@ export class Session3 extends HeyApiClient {
parameters: {
sessionID: string
id?: string | null
prompt?: PromptInputV2
prompt?: PromptInput
delivery?: "steer" | "queue" | null
resume?: boolean | null
},
@ -6131,9 +6152,9 @@ export class Session3 extends HeyApiClient {
command?: string
arguments?: string | null
agent?: string | null
model?: ModelRef2 | null
files?: Array<PromptInputFileAttachment2>
agents?: Array<PromptAgentAttachment2>
model?: ModelRef | null
files?: Array<PromptInputFileAttachment>
agents?: Array<PromptAgentAttachment>
delivery?: "steer" | "queue" | null
resume?: boolean | null
},
@ -6290,19 +6311,35 @@ export class Session3 extends HeyApiClient {
/**
* Compact session
*
* Compact a session conversation.
* Queue a durable session compaction request.
*/
public compact<ThrowOnError extends boolean = false>(
parameters: {
sessionID: string
id?: string | null
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "sessionID" }] }])
const params = buildClientParams(
[parameters],
[
{
args: [
{ in: "path", key: "sessionID" },
{ in: "body", key: "id" },
],
},
],
)
return (options?.client ?? this.client).post<V2SessionCompactResponses, V2SessionCompactErrors, ThrowOnError>({
url: "/api/session/{sessionID}/compact",
...options,
...params,
headers: {
"Content-Type": "application/json",
...options?.headers,
...params.headers,
},
})
}
@ -6347,7 +6384,7 @@ export class Session3 extends HeyApiClient {
/**
* Read the session log
*
* Durable, ordered, gap-free read of public session events after an exclusive aggregate sequence. Emits a synced marker once replay reaches the captured watermark, then completes; with follow=true it continues with live events instead. The only event API that promises reliability: attach after a snapshot watermark to compose fetch and stream without a race window.
* Experimental durable session event log. Reads events after an exclusive aggregate sequence and continues with live events when follow=true.
*/
public log<ThrowOnError extends boolean = false>(
parameters: {
@ -6370,7 +6407,7 @@ export class Session3 extends HeyApiClient {
],
)
return (options?.client ?? this.client).sse.get<V2SessionLogResponses, V2SessionLogErrors, ThrowOnError>({
url: "/api/session/{sessionID}/log",
url: "/api/experimental/session/{sessionID}/log",
...options,
...params,
})
@ -6485,9 +6522,9 @@ export class Session3 extends HeyApiClient {
return (this._revert ??= new Revert({ client: this.client }))
}
private _context?: Context
get context2(): Context {
return (this._context ??= new Context({ client: this.client }))
private _instructions?: Instructions
get instructions(): Instructions {
return (this._instructions ??= new Instructions({ client: this.client }))
}
private _form?: Form
@ -6565,7 +6602,7 @@ export class Generate extends HeyApiClient {
workspace?: string | null
} | null
prompt?: string
model?: ModelRef2 | null
model?: ModelRef | null
},
options?: Options<never, ThrowOnError>,
) {
@ -7426,7 +7463,7 @@ export class Event2 extends HeyApiClient {
/**
* Subscribe to events
*
* Subscribe to native event payloads for the server. Volatile by contract: a slow consumer overflows and fails the stream, and events during disconnection are missed. Consumers that need reliability should combine the changes feed with durable session log reads.
* Subscribe to native event payloads for the server. Volatile by contract: a slow consumer overflows and fails the stream, and events during disconnection are missed.
*/
public subscribe<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) {
return (options?.client ?? this.client).sse.get<V2EventSubscribeResponses, V2EventSubscribeErrors, ThrowOnError>({
@ -7434,18 +7471,6 @@ export class Event2 extends HeyApiClient {
...options,
})
}
/**
* Subscribe to change hints
*
* Payload-free hint channel: after an event commits, a subscriber eventually receives a hint for that aggregate with seq at or beyond the event, or a sweep-required marker. Hints coalesce to the latest seq per aggregate under backpressure and the stream never fails from overflow. No consumer may derive correctness from receiving a hint; correctness always comes from durable log reads plus the consumer's own checkpoint. A sweep-required marker is emitted first on every (re)subscribe and whenever hint retention is exceeded: treat every aggregate as potentially dirty and recover via bounded sweep plus log reads.
*/
public changes<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) {
return (options?.client ?? this.client).sse.get<V2EventChangesResponses, V2EventChangesErrors, ThrowOnError>({
url: "/api/event/changes",
...options,
})
}
}
export class Pty2 extends HeyApiClient {
@ -7835,6 +7860,46 @@ export class Shell extends HeyApiClient {
})
}
/**
* Update shell timeout
*
* Replace a running shell command's timeout from now, or clear it with zero.
*/
public timeout<ThrowOnError extends boolean = false>(
parameters: {
id: string
location?: {
directory?: string | null
workspace?: string | null
} | null
timeout?: number
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams(
[parameters],
[
{
args: [
{ in: "path", key: "id" },
{ in: "query", key: "location" },
{ in: "body", key: "timeout" },
],
},
],
)
return (options?.client ?? this.client).patch<V2ShellTimeoutResponses, V2ShellTimeoutErrors, ThrowOnError>({
url: "/api/shell/{id}/timeout",
...options,
...params,
headers: {
"Content-Type": "application/json",
...options?.headers,
...params.headers,
},
})
}
/**
* Read shell output
*
@ -8082,7 +8147,7 @@ export class Vcs2 extends HeyApiClient {
directory?: string | null
workspace?: string | null
} | null
mode: VcsMode2
mode: VcsMode
context?: string | null
},
options?: Options<never, ThrowOnError>,

File diff suppressed because it is too large Load diff

View file

@ -14507,6 +14507,7 @@
},
"description": "Establish a WebSocket connection streaming PTY output and accepting terminal input.",
"summary": "Connect to PTY session",
"x-websocket": true,
"x-codeSamples": [
{
"lang": "js",