Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ts/packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"@typeagent/agent-sdk": "workspace:*",
"@typeagent/agent-server-client": "workspace:*",
"@typeagent/common-utils": "workspace:*",
"@typeagent/dispatcher-types": "workspace:*",
"action-grammar": "workspace:*",
"agent-cache": "workspace:*",
"agent-dispatcher": "workspace:*",
Expand Down
9 changes: 2 additions & 7 deletions ts/packages/cli/src/commands/connect.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

// TODO: The CLI still depends on agent-dispatcher for types (Dispatcher, ClientIO,
// RequestId, etc.) and helpers (withConsoleClientIO, getStatusSummary). These types
// should eventually be moved to @typeagent/dispatcher-types to avoid the heavyweight
// dependency. See cli-agent-server-deprecation.md Phase 5.

import { Args, Command, Flags } from "@oclif/core";
import { Dispatcher } from "agent-dispatcher";
import type { Dispatcher } from "@typeagent/dispatcher-types";
import {
getEnhancedConsolePrompt,
processCommandsEnhanced,
Expand All @@ -21,7 +16,7 @@ import {
ensureAndConnectSession,
AgentServerConnection,
} from "@typeagent/agent-server-client";
import { getStatusSummary } from "agent-dispatcher/helpers/status";
import { getStatusSummary } from "@typeagent/dispatcher-types/helpers/status";
import * as crypto from "crypto";
import * as fs from "fs";
import * as os from "os";
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/cli/src/enhancedConsole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import type {
PendingInteractionRequest,
PendingInteractionResponse,
PendingInteractionEntry,
} from "agent-dispatcher";
} from "@typeagent/dispatcher-types";
import chalk from "chalk";
import fs from "fs";
import path from "path";
Expand Down
5 changes: 4 additions & 1 deletion ts/packages/cli/test/multiClientInteraction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
import { describe, it, expect, beforeEach, afterEach } from "@jest/globals";
import { EventEmitter } from "node:events";
import { createEnhancedClientIO } from "../src/enhancedConsole.js";
import type { PendingInteractionRequest, Dispatcher } from "agent-dispatcher";
import type {
PendingInteractionRequest,
Dispatcher,
} from "@typeagent/dispatcher-types";

// ── Stdin/stdout stubs ───────────────────────────────────────────────────────

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

import { AppAction } from "@typeagent/agent-sdk";
import { UnknownAction } from "./schema/dispatcherActionSchema.js";
import { DispatcherName, DispatcherEmoji } from "@typeagent/dispatcher-types";

export const DispatcherName = "dispatcher";
export { DispatcherName, DispatcherEmoji };
export const DispatcherClarifyName = "dispatcher.clarify";
export const DispatcherActivityName = "dispatcher.activity";
export const DispatcherEmoji = "🤖";

export function isUnknownAction(action: AppAction): action is UnknownAction {
return action.actionName === "unknown";
Expand Down
36 changes: 1 addition & 35 deletions ts/packages/dispatcher/dispatcher/src/helpers/status.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import {
DispatcherEmoji,
DispatcherName,
} from "../context/dispatcher/dispatcherUtils.js";
import type { DispatcherStatus } from "@typeagent/dispatcher-types";

export function getStatusSummary(
state: DispatcherStatus,
options?: {
showPrimaryName?: boolean; // default true
},
): string {
const active: string[] = [];
const showPrimaryName = options?.showPrimaryName ?? true;
let primary: string = showPrimaryName
? `${DispatcherEmoji} ${DispatcherName} - `
: `${DispatcherEmoji}:`;
for (const agent of state.agents) {
if (agent.request && agent.name !== DispatcherName) {
return `{{${agent.emoji} ${agent.name.toUpperCase()}}}`;
}
if (agent.lastUsed) {
active.unshift(agent.emoji);
}
if (agent.active) {
active.push(agent.emoji);
}
if (agent.priority) {
primary = showPrimaryName
? `${agent.emoji} ${agent.name} - `
: `${agent.emoji}:`;
}
}
return `${primary}[${Array.from(new Set(active)).join("")} ]${state.details}`;
}
export { getStatusSummary } from "@typeagent/dispatcher-types/helpers/status";
1 change: 1 addition & 0 deletions ts/packages/dispatcher/nodeProviders/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"debug": "^4.4.0"
},
"devDependencies": {
"@typeagent/dispatcher-types": "workspace:*",
"@types/debug": "^4.1.12",
"@types/jest": "^29.5.7",
"jest": "^29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/dispatcher/nodeProviders/test/provider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
ClientIO,
IAgentMessage,
RequestId,
} from "agent-dispatcher";
} from "@typeagent/dispatcher-types";
import { fileURLToPath } from "node:url";

const testAppAgentProvider = createNpmAppAgentProvider(
Expand Down
2 changes: 1 addition & 1 deletion ts/packages/dispatcher/nodeProviders/test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"ts-node": {
"esm": true
},
"references": [{ "path": "../src" }]
"references": [{ "path": "../src" }, { "path": "../../types/src" }]
}
3 changes: 2 additions & 1 deletion ts/packages/dispatcher/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"author": "Microsoft",
"type": "module",
"exports": {
".": "./dist/index.js"
".": "./dist/index.js",
"./helpers/status": "./dist/helpers/status.js"
},
"files": [
"dist",
Expand Down
3 changes: 3 additions & 0 deletions ts/packages/dispatcher/types/src/dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import {
import type { DisplayLogEntry } from "./displayLogEntry.js";
import type { PendingInteractionResponse } from "./pendingInteraction.js";

export const DispatcherName = "dispatcher";
export const DispatcherEmoji = "🤖";

/**
* Identifies a command request across the dispatcher and all connected clients.
*
Expand Down
38 changes: 38 additions & 0 deletions ts/packages/dispatcher/types/src/helpers/status.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import {
DispatcherEmoji,
DispatcherName,
type DispatcherStatus,
} from "../dispatcher.js";

export function getStatusSummary(
state: DispatcherStatus,
options?: {
showPrimaryName?: boolean; // default true
},
): string {
const active: string[] = [];
const showPrimaryName = options?.showPrimaryName ?? true;
let primary: string = showPrimaryName
? `${DispatcherEmoji} ${DispatcherName} - `
: `${DispatcherEmoji}:`;
for (const agent of state.agents) {
if (agent.request && agent.name !== DispatcherName) {
return `{{${agent.emoji} ${agent.name.toUpperCase()}}}`;
}
if (agent.lastUsed) {
active.unshift(agent.emoji);
}
if (agent.active) {
active.push(agent.emoji);
}
if (agent.priority) {
primary = showPrimaryName
? `${agent.emoji} ${agent.name} - `
: `${agent.emoji}:`;
}
}
return `${primary}[${Array.from(new Set(active)).join("")} ]${state.details}`;
}
Comment thread
GeorgeNgMsft marked this conversation as resolved.
6 changes: 6 additions & 0 deletions ts/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading