Skip to content

Conversation

@evanyan13
Copy link
Contributor

@evanyan13 evanyan13 commented Jul 15, 2025

PR Type

What kind of change does this PR introduce?

  • Refactoring (no functional changes, no API changes)

✅ Definition of done:

  • agent import works identically to current assistant
  • assistant remains as a deprecated alias.

Tasks

  • Move existing functions to agent module

    • Rename all assistant functions to agent
  • Import agent functions from assistant module

    • Export with backwards compatible names
    • Add JSDoc deprecation notice to all functions
  • Rename all assistant functions to agent in tracker module

    • Export with backwards compatible names
    • Add JSDoc deprecation notice to all functions
  • Add tests for agent module in /spec

    • Retain tests for assistant module to support backwards compatibility
  • Update README, docs, and TypeScript defs to reference agent

Note:

  • Can only pass domain=assistant as a query param to the endpoint: https://agent.cnstrc.com/v1/intent/ now.
    • No need to change domain=assistant – this is customer/integration-specific and may be any arbitrary value to distinguish multiple setups for the same ac_key.

@evanyan13 evanyan13 requested review from esezen and jjl014 July 15, 2025 23:19
@evanyan13 evanyan13 self-assigned this Jul 15, 2025
@evanyan13 evanyan13 requested a review from a team July 16, 2025 00:22
@esezen esezen requested a review from Copilot July 19, 2025 16:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the Assistant module to Agent, providing a modern interface while maintaining backwards compatibility. The primary purpose is to rename the "Assistant" functionality to "Agent" while ensuring existing integrations continue to work seamlessly.

Key Changes

  • Introduction of a new Agent module with updated function names (e.g., trackAgentSubmit)
  • Assistant module converted to a wrapper that extends Agent and provides deprecated aliases
  • All tracker methods renamed from trackAssistant* to trackAgent* with backwards-compatible wrappers
  • Updated service URLs to use agentServiceUrl with assistantServiceUrl fallback

Reviewed Changes

Copilot reviewed 6 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/modules/tracker.js Renamed tracking methods from assistant to agent and added deprecated backward-compatible wrappers
src/modules/assistant.js Refactored to extend Agent class while maintaining deprecated interface
src/modules/agent.js New module containing core agent functionality previously in assistant.js
src/constructorio.js Added agent service URL configuration and instantiated new Agent module
spec/src/modules/tracker.js Added comprehensive test coverage for new agent tracking methods
spec/src/modules/agent.js Added test suite for the new Agent module functionality

Copy link
Contributor

@esezen esezen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! Just left 2 very simple comments. Let's also get another review from someone from the team

@evanyan13 evanyan13 requested a review from a team July 22, 2025 19:36
Copy link
Contributor

@mocca102 mocca102 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some totally optional comments. Thank you for working on this. It is looking great!

Copy link
Contributor

@esezen esezen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evanyan13 the changes look good but some tests are failing both in CI and locally. Do you mind taking a look why?

@evanyan13
Copy link
Contributor Author

@evanyan13 the changes look good but some tests are failing both in CI and locally. Do you mind taking a look why?

Hi @esezen Thank you for raising the issues!
I have identified the mistake that is causing the failure:

  • The behavioral_action endpoints have not been updated to receive agent so I have reverted to use assistant for now. (eg. assistant_submit)
  • Do we know if the team has plan to update these endpoints to use agent?

Also, I'm facing a problem on the test buildsI. Here are my observations:

  • All of the tests pass on my local, but some of them seems to fail in the github workflow
  • Different number of test cases fail each time (~1-3)?
  • I found that trackAssistantSubmit and trackAgentSubmit are using the same method, but trackAgentSubmit fails while trackAssistantSubmit passes
    So I think this is likely due to a Timeout error rather than an implementation error.
    Do you think this is something we should follow up/dig deeper about?

@esezen
Copy link
Contributor

esezen commented Jul 24, 2025

@evanyan13

Do we know if the team has plan to update these endpoints to use agent?

Can you please check with ASA team? It's not a blocker for this PR and I will merge this PR today but let's figure out the next steps there.

Different number of test cases fail each time (~1-3)?

We have some flaky tests we need to address but not related to your PR, all good!

Copy link
Contributor

@esezen esezen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@esezen esezen merged commit cc67cc5 into master Jul 24, 2025
7 of 15 checks passed
@esezen esezen deleted the ci-4659-client-js-rename-assistant-module branch July 24, 2025 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants