feat: add scoped history and artifacts
This commit is contained in:
@@ -11,7 +11,7 @@ const update = z.object({ delivery: z.enum(["steer", "queue"]) }).strict();
|
||||
export function registerResponseInputRoutes(router: Router, options: {
|
||||
runtime: OpencodeRuntimeAdapter; sessionMetadataStore: SessionMetadataStore; runState: ChatRunState;
|
||||
}) {
|
||||
for (const method of ["get", "patch"] as const) {
|
||||
for (const method of ["get", "patch", "delete"] as const) {
|
||||
router[method](method === "get" ? "/session/:session_id/inputs" : "/session/:session_id/inputs/:input_id", async (req, res) => {
|
||||
const sessionId = String(req.params.session_id);
|
||||
try {
|
||||
@@ -22,6 +22,12 @@ export function registerResponseInputRoutes(router: Router, options: {
|
||||
return;
|
||||
}
|
||||
const inputId = id.parse((req.params as Record<string, string>).input_id);
|
||||
if (method === "delete") {
|
||||
const input = await options.runtime.cancelPendingUserInput(sessionId, inputId);
|
||||
options.runState.activeRuns.get(sessionId)?.inputs?.observe("session.inbox.cancelled", { inboxID: inputId });
|
||||
res.json(input);
|
||||
return;
|
||||
}
|
||||
const { delivery } = update.parse(req.body);
|
||||
const input = await options.runtime.updatePendingUserInput(sessionId, inputId, delivery);
|
||||
options.runState.activeRuns.get(sessionId)?.inputs?.observe("session.inbox.delivery.changed", { inboxID: inputId, delivery });
|
||||
|
||||
Reference in New Issue
Block a user