Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: client github loads github info via messages #232

Merged
merged 14 commits into from
Jan 16, 2025

Conversation

snobbee
Copy link
Collaborator

@snobbee snobbee commented Jan 13, 2025

Relates to

#199

Risks

Low

Background

What does this PR do?

  • break down github client into 3 stages: github info discovery loop, repo init loop and OODA loop
  • register/unregister actions based on relevant stage
  • use a single state defined at the github client level
  • update Eliza UI to retrieve all memories to add the action messages to the conversation history

What kind of change is this?

Features

Documentation changes needed?

Testing

Where should a reviewer start?

Detailed testing steps

Screen.Recording.2025-01-14.at.20.11.57.mov

@snobbee snobbee marked this pull request as draft January 13, 2025 07:44
@snobbee snobbee requested a review from monilpat January 14, 2025 19:17
@snobbee snobbee marked this pull request as ready for review January 14, 2025 19:22
.env.example Show resolved Hide resolved
Comment on lines +30 to +31
Here are the recent user messages for context:
{{recentMessages}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should actually just use message and get the latest message so it is easier feel free to add the latest message to the state before composing the context

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@monilpat depends because we can have multiple messages that got posted by the user by the time the action is triggered

Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it lets include both the latest message {{message}} and the {{ recentMessages}} as I have found it improves the output

Comment on lines +34 to +55
export const ConfigGithubInfoSchema = z.object({
owner: z.string().min(1, "GitHub owner is required"),
repo: z.string().min(1, "GitHub repo is required"),
branch: z.string().min(1, "GitHub branch is required"),
});

export interface ConfigGithubInfoContent {
owner: string;
repo: string;
branch: string;
}

export const isConfigGithubInfoContent = (
object: any
): object is ConfigGithubInfoContent => {
if (ConfigGithubInfoSchema.safeParse(object).success) {
return true;
}
elizaLogger.error("Invalid content: ", object);
return false;
};

Copy link
Collaborator

Choose a reason for hiding this comment

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

same for these

} else {
state = await runtime.updateRecentMessageState(state);
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

can add it here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if (!state) {
state = (await runtime.composeState(message)) as State;
} else {
state = await runtime.updateRecentMessageState(state);
}
const updatedState = await incorporateRepositoryState(
Copy link
Collaborator

Choose a reason for hiding this comment

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

^^

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -655,77 +433,16 @@ export async function incorporateRepositoryState(
// TODO:
// We need to actually save goals, knowledge,facts, we only save memories for now
// We need to dynamically update the goals, knoweldge, facts, bio, lore, we should add actions to update these and chain them to the OODA cycle
const owner = runtime.getSetting("GITHUB_OWNER") ?? ("" as string);
Copy link
Collaborator

Choose a reason for hiding this comment

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

why did we remove this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@monilpat to clarify this function is not used anymore as most of its logic got moved away to the github client, actions are using the same github client’s state therefore they don’t need to incorporate repo state anymore

@@ -11,24 +11,48 @@ import {
UUID,
generateObject,
stringToUuid,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you mind explaining the changes thanks

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@monilpat sure thing

  1. we have 3 separate stages now that trigger various loops: github info discovery loop, repo init loop and OODA loop
  2. the github info discovery loop waits for getting the github info available in the context so it can save them to the state
  3. the repo init loop process both init repo and memorize actions along with adding both existing issues and PRs to memory, it waits for getting the list of repo files available in memory
  4. the OODA loop waits for a new action to be available (other action than NOTHING) and if so create a new action memory and process the action and move to the next cycle.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Cool makes sense thanks for clarifying :)

@monilpat monilpat merged commit 3294420 into sif-dev Jan 16, 2025
3 of 5 checks passed
@monilpat monilpat deleted the feat/client-github-load-github-info-via-messages branch January 16, 2025 04:19
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.

2 participants