Skip to content

Commit

Permalink
Show emoji in agent status table (microsoft#444)
Browse files Browse the repository at this point in the history
Also use fully qualified version of the greeting emoji to get the
full-width in console.
  • Loading branch information
curtisman authored Dec 2, 2024
1 parent 6f49f48 commit 5d832ba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ts/packages/agents/greeting/src/greetingManifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"emojiChar": "🖐",
"emojiChar": "🖐",
"description": "Agent to generate greating messages",
"schema": {
"description": "Greeting agent that created personalized welcome messages.",
Expand Down
12 changes: 8 additions & 4 deletions ts/packages/dispatcher/src/handlers/configCommandHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,13 @@ function showAgentStatus(
}

const getRow = (
emoji: string,
displayName: string,
schemas?: string,
actions?: string,
commands?: string,
) => {
const displayEntry = [displayName];
const displayEntry = [emoji, displayName];
if (showSchema) {
displayEntry.push(schemas ?? "");
}
Expand All @@ -263,16 +264,19 @@ function showAgentStatus(
};

const table: string[][] = [
getRow("Agent", "Schemas", "Actions", "Commands"),
getRow("", "Agent", "Schemas", "Actions", "Commands"),
];

for (const [name, { schemas, actions, commands }] of entries) {
const displayName = getAppAgentName(name) !== name ? ` ${name}` : name;
table.push(getRow(displayName, schemas, actions, commands));
const isAppAgentName = getAppAgentName(name) === name;
const displayName = isAppAgentName ? name : ` ${name}`;
const emoji = isAppAgentName ? agents.getEmojis()[name] : "";
table.push(getRow(emoji, displayName, schemas, actions, commands));
}

displayResult(table, context);
}

class AgentToggleCommandHandler implements CommandHandler {
public readonly description = `Toggle ${AgentToggleDescription[this.toggle]}`;
public readonly parameters = {
Expand Down
12 changes: 1 addition & 11 deletions ts/packages/dispatcher/src/utils/exceptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,7 @@ function throwEnsureError(e: any): never {
throw new Error(e);
}
if (typeof e === "object") {
if (e instanceof Error) {
throw e;
}
const mayBeErrorLike = e as any;
if (
typeof mayBeErrorLike.name === "string" &&
typeof mayBeErrorLike.message === "string" &&
typeof mayBeErrorLike.stack === "string"
) {
throw e;
}
throw e;
}
throw new Error(`Unknown error: ${JSON.stringify(e)}`);
}
Expand Down

0 comments on commit 5d832ba

Please sign in to comment.