diff --git a/seeds/team-experiments/src/breadboard/events.ts b/seeds/team-experiments/src/breadboard/events.ts index de48834c..8637451b 100644 --- a/seeds/team-experiments/src/breadboard/events.ts +++ b/seeds/team-experiments/src/breadboard/events.ts @@ -26,7 +26,10 @@ export class PendingEvent extends Event { export class InputEvent extends Event implements RunInputEvent { static readonly eventName = "input"; - constructor(public data: InputResponse) { + constructor( + public data: InputResponse, + public reply: (data: InputResolveRequest) => Promise + ) { super(InputEvent.eventName, { ...opts }); } } diff --git a/seeds/team-experiments/src/breadboard/runner.ts b/seeds/team-experiments/src/breadboard/runner.ts index 7dcbd011..47c6152a 100644 --- a/seeds/team-experiments/src/breadboard/runner.ts +++ b/seeds/team-experiments/src/breadboard/runner.ts @@ -46,6 +46,7 @@ export class Runner extends (EventTarget as RunEventTarget) implements Runner { for (;;) { const result = await this.#run.next(); + console.log("🍊 result", result); if (result.done) { this.#run = null; return false; @@ -53,8 +54,11 @@ export class Runner extends (EventTarget as RunEventTarget) implements Runner { const { type, data, reply } = result.value; switch (type) { case "input": { - this.#pendingInput = reply; - this.dispatchEvent(new InputEvent(data)); + if (!this.dispatchEvent(new InputEvent(data, reply))) { + break; + } else { + this.#pendingInput = reply; + } return true; } case "output": { diff --git a/seeds/team-experiments/src/breadboard/types.ts b/seeds/team-experiments/src/breadboard/types.ts index cedd55e7..d8f824f5 100644 --- a/seeds/team-experiments/src/breadboard/types.ts +++ b/seeds/team-experiments/src/breadboard/types.ts @@ -21,6 +21,7 @@ export type RunPendingEvent = Event & { export type RunInputEvent = Event & { data: InputResponse; + reply: (data: InputResolveRequest) => Promise; }; export type RunOutputEvent = Event & { diff --git a/seeds/team-experiments/src/mock/team-list.ts b/seeds/team-experiments/src/mock/team-list.ts index 1f5535ae..60159f0f 100644 --- a/seeds/team-experiments/src/mock/team-list.ts +++ b/seeds/team-experiments/src/mock/team-list.ts @@ -10,6 +10,19 @@ import { ItemStatus, Participant, TeamListItem } from "../types/types.js"; export const teamListItems: Map = new Map([ [ "team-1", + { + datetime: new Date(Date.now() - 20 * MINUTE), + teamName: "Onboarding to Social Campaign", + description: "Collect information to post to social media", + status: ItemStatus.ACTIVE, + statusDescription: "Not started", + who: Participant.TEAM_MEMBER, + role: "Media Coordinator", + graph: "/bgl/insta/onboard-for-social.json", + }, + ], + [ + "team-4", { datetime: new Date(Date.now() - 20 * MINUTE), teamName: "Social Campaign", diff --git a/seeds/team-experiments/src/ui/elements/team-job/team-job.ts b/seeds/team-experiments/src/ui/elements/team-job/team-job.ts index 6b765b1a..1727c6b5 100644 --- a/seeds/team-experiments/src/ui/elements/team-job/team-job.ts +++ b/seeds/team-experiments/src/ui/elements/team-job/team-job.ts @@ -104,6 +104,14 @@ export class TeamJob extends LitElement { type: ItemType.PENDING, }); }); + this.#run.addEventListener("input", (e) => { + const { data } = e; + const model = data.inputArguments.schema?.properties?.model; + if (model) { + e.reply({ inputs: { model: this.#secrets.get("model") } }); + e.preventDefault(); + } + }); this.#run.addEventListener("output", (e) => { const { outputs, timestamp } = e.data; const role = "Team Lead";