fix: rename prompt_async to promptAsync for SDK compatibility
This commit is contained in:
parent
4fa234e5e1
commit
eb6067b6a6
@ -61,7 +61,7 @@ export async function runAggressiveTruncationStrategy(params: {
|
||||
clearSessionState(params.autoCompactState, params.sessionID)
|
||||
setTimeout(async () => {
|
||||
try {
|
||||
await params.client.session.prompt_async({
|
||||
await params.client.session.promptAsync({
|
||||
path: { id: params.sessionID },
|
||||
body: { auto: true } as never,
|
||||
query: { directory: params.directory },
|
||||
|
||||
@ -2,7 +2,7 @@ import type { PluginInput } from "@opencode-ai/plugin"
|
||||
|
||||
export type Client = PluginInput["client"] & {
|
||||
session: {
|
||||
prompt_async: (opts: {
|
||||
promptAsync: (opts: {
|
||||
path: { id: string }
|
||||
body: { parts: Array<{ type: string; text: string }> }
|
||||
query: { directory: string }
|
||||
|
||||
@ -99,7 +99,7 @@ describe("executeCompact lock management", () => {
|
||||
messages: mock(() => Promise.resolve({ data: [] })),
|
||||
summarize: mock(() => Promise.resolve()),
|
||||
revert: mock(() => Promise.resolve()),
|
||||
prompt_async: mock(() => Promise.resolve()),
|
||||
promptAsync: mock(() => Promise.resolve()),
|
||||
},
|
||||
tui: {
|
||||
showToast: mock(() => Promise.resolve()),
|
||||
@ -283,9 +283,9 @@ describe("executeCompact lock management", () => {
|
||||
expect(autoCompactState.compactionInProgress.has(sessionID)).toBe(false)
|
||||
})
|
||||
|
||||
test("clears lock when prompt_async in continuation throws", async () => {
|
||||
// given: prompt_async will fail during continuation
|
||||
mockClient.session.prompt_async = mock(() =>
|
||||
test("clears lock when promptAsync in continuation throws", async () => {
|
||||
// given: promptAsync will fail during continuation
|
||||
mockClient.session.promptAsync = mock(() =>
|
||||
Promise.reject(new Error("Prompt failed")),
|
||||
)
|
||||
autoCompactState.errorDataBySession.set(sessionID, {
|
||||
@ -378,8 +378,8 @@ describe("executeCompact lock management", () => {
|
||||
// then: Summarize should NOT be called (early return from sufficient truncation)
|
||||
expect(mockClient.session.summarize).not.toHaveBeenCalled()
|
||||
|
||||
// then: prompt_async should be called (Continue after successful truncation)
|
||||
expect(mockClient.session.prompt_async).toHaveBeenCalled()
|
||||
// then: promptAsync should be called (Continue after successful truncation)
|
||||
expect(mockClient.session.promptAsync).toHaveBeenCalled()
|
||||
|
||||
// then: Lock should be cleared
|
||||
expect(autoCompactState.compactionInProgress.has(sessionID)).toBe(false)
|
||||
|
||||
@ -53,7 +53,7 @@ describe("createAnthropicContextWindowLimitRecoveryHook", () => {
|
||||
messages: mock(() => Promise.resolve({ data: [] })),
|
||||
summarize: mock(() => summarizePromise),
|
||||
revert: mock(() => Promise.resolve()),
|
||||
prompt_async: mock(() => Promise.resolve()),
|
||||
promptAsync: mock(() => Promise.resolve()),
|
||||
},
|
||||
tui: {
|
||||
showToast: mock(() => Promise.resolve()),
|
||||
@ -97,7 +97,7 @@ describe("createAnthropicContextWindowLimitRecoveryHook", () => {
|
||||
messages: mock(() => Promise.resolve({ data: [] })),
|
||||
summarize: mock(() => Promise.resolve()),
|
||||
revert: mock(() => Promise.resolve()),
|
||||
prompt_async: mock(() => Promise.resolve()),
|
||||
promptAsync: mock(() => Promise.resolve()),
|
||||
},
|
||||
tui: {
|
||||
showToast: mock(() => Promise.resolve()),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user