runs: reconcile uncertain browser launches with a persistent intent key
This commit is contained in:
@@ -185,12 +185,12 @@ export class PipelinesRepository {
|
||||
* Starts a fresh run of one pipeline version. `notifyMode` is auto, on or off;
|
||||
* auto omits the field so the pipeline definition applies.
|
||||
*/
|
||||
async runPipeline({ pipelineId, version, prompt, workspace, notifyMode = "auto", title = "" } = {}) {
|
||||
async runPipeline({ pipelineId, version, prompt, workspace, notifyMode = "auto", title = "", requestKey = newChatOperationId() } = {}) {
|
||||
const request = {
|
||||
type: Protocol.RUN_PIPELINE,
|
||||
pipeline_id: Number(pipelineId),
|
||||
version: Number(version),
|
||||
request_key: newChatOperationId(),
|
||||
request_key: requestKey,
|
||||
workspace: String(workspace ?? "").trim(),
|
||||
input: { prompt: String(prompt ?? "") },
|
||||
};
|
||||
@@ -204,6 +204,13 @@ export class PipelinesRepository {
|
||||
return response.run_detail;
|
||||
}
|
||||
|
||||
/** Read-only admission reconciliation after a lost launch response. */
|
||||
async runByRequestKey(requestKey) {
|
||||
if (!String(requestKey ?? "").trim()) throw new ProtocolError("A launch request key is required.");
|
||||
const response = await this.#client.call({ type: Protocol.GET_RUN, request_key: requestKey });
|
||||
return response.run_detail ?? null;
|
||||
}
|
||||
|
||||
async cancelRun(id) {
|
||||
const response = await this.#client.call({ type: Protocol.CANCEL_RUN, run_id: id });
|
||||
if (!response.run_detail) {
|
||||
|
||||
Reference in New Issue
Block a user