Skip to content

Commit

Permalink
Add "Onboarding" to team list.
Browse files Browse the repository at this point in the history
  • Loading branch information
dglazkov committed Apr 19, 2024
1 parent 591f123 commit 44ec4d8
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
5 changes: 4 additions & 1 deletion seeds/team-experiments/src/breadboard/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>
) {
super(InputEvent.eventName, { ...opts });
}
}
Expand Down
8 changes: 6 additions & 2 deletions seeds/team-experiments/src/breadboard/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,19 @@ 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;
}
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": {
Expand Down
1 change: 1 addition & 0 deletions seeds/team-experiments/src/breadboard/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type RunPendingEvent = Event & {

export type RunInputEvent = Event & {
data: InputResponse;
reply: (data: InputResolveRequest) => Promise<void>;
};

export type RunOutputEvent = Event & {
Expand Down
13 changes: 13 additions & 0 deletions seeds/team-experiments/src/mock/team-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ import { ItemStatus, Participant, TeamListItem } from "../types/types.js";
export const teamListItems: Map<string, TeamListItem> = 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",
Expand Down
8 changes: 8 additions & 0 deletions seeds/team-experiments/src/ui/elements/team-job/team-job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 44ec4d8

Please sign in to comment.