feat: add scoped history and artifacts
This commit is contained in:
@@ -397,6 +397,25 @@ export class OpencodeRuntimeAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
async cancelPendingUserInput(sessionId: string, id: string): Promise<ResponseInput> {
|
||||
const item = (await this.listPendingUserInputs(sessionId)).find((input) => input.id === id);
|
||||
if (!item) throw Object.assign(new Error("Message has already been consumed or is unavailable"), { status: 409 });
|
||||
const client = await this.ensureClient();
|
||||
try { await client.session.inbox.cancel({ sessionID: sessionId, inboxID: id }); }
|
||||
catch (error) {
|
||||
if (!(await this.listPendingUserInputs(sessionId)).some((input) => input.id === id)) {
|
||||
throw Object.assign(new Error("Message has already been consumed or is unavailable"), { status: 409 });
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
// Native cancel also succeeds for an already consumed ID. Check the native
|
||||
// message record so a delivery racing cancellation never restores a sent draft.
|
||||
if (await this.agentMessageState(sessionId, id) !== "missing") {
|
||||
throw Object.assign(new Error("Message has already been consumed or is unavailable"), { status: 409 });
|
||||
}
|
||||
return { ...item, status: "cancelled" };
|
||||
}
|
||||
|
||||
async prompt(sessionId: string, text: string, model?: RuntimeModelOverride) {
|
||||
const client = await this.ensureClient();
|
||||
const startedAt = Date.now();
|
||||
|
||||
Reference in New Issue
Block a user