Skip to content

Commit

Permalink
Instacart updates (#554)
Browse files Browse the repository at this point in the history
- use builder pattern to express plans
- update page component schemas
- add friendly message with confirmation of items added to cart and
items not available
- fix scenario bugs around recipes
  • Loading branch information
hillary-mutisya authored Jan 14, 2025
1 parent 8772da4 commit f80790d
Show file tree
Hide file tree
Showing 4 changed files with 376 additions and 271 deletions.
22 changes: 13 additions & 9 deletions ts/packages/agents/browser/src/agent/actionHandler.mts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ import {
CommandHandlerTable,
getCommandInterface,
} from "@typeagent/agent-sdk/helpers/command";

// import { handleInstacartAction } from "./instacart/actionHandler.mjs";
import { handleInstacartUserAction } from "./instacart/planHandler.mjs";
import { handleInstacartAction } from "./instacart/planHandler.mjs";

import { processWebAgentMessage, WebAgentChannels } from "./webTypeAgent.mjs";
import { isWebAgentMessage } from "../common/webAgentMessageTypes.mjs";
Expand Down Expand Up @@ -187,18 +188,17 @@ async function executeBrowserAction(
const commerceResult = await handleCommerceAction(action, context);
return createActionResult(commerceResult);
} else if (action.translatorName === "browser.instacart") {
// const instacartResult = await handleInstacartAction(action, context);
const instacartResult = await handleInstacartUserAction(
action,
context,
);

const instacartResult = await handleInstacartAction(action, context);
return createActionResult(instacartResult);
}

await connector?.sendActionToBrowser(action, messageType);
} catch (ex: any) {
console.log(JSON.stringify(ex));
if (ex instanceof Error) {
console.error(ex);
} else {
console.error(JSON.stringify(ex));
}

throw new Error("Unable to contact browser backend.");
}
Expand Down Expand Up @@ -289,7 +289,11 @@ async function handleTabIndexActions(
}),
);
} catch (ex: any) {
console.log(JSON.stringify(ex));
if (ex instanceof Error) {
console.error(ex);
} else {
console.error(JSON.stringify(ex));
}

throw new Error("Unable to contact browser backend.");
}
Expand Down
Loading

0 comments on commit f80790d

Please sign in to comment.