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 cli/azd/cmd/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ func registerCommonDependencies(container *ioc.NestedContainer) {
container.MustRegisterSingleton(grpcserver.NewServiceTargetService)
container.MustRegisterSingleton(grpcserver.NewFrameworkService)
container.MustRegisterSingleton(grpcserver.NewAiModelService)
container.MustRegisterScoped(grpcserver.NewCopilotService)

// Required for nested actions called from composite actions like 'up'
registerAction[*cmd.ProvisionAction](container, "azd-provision-action")
Expand Down
12 changes: 6 additions & 6 deletions cli/azd/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ type initAction struct {
featuresManager *alpha.FeatureManager
extensionsManager *extensions.Manager
azd workflow.AzdCommandRunner
agentFactory *agent.CopilotAgentFactory
agentFactory agent.AgentFactory
consentManager consent.ConsentManager
configManager config.UserConfigManager
}
Expand All @@ -156,7 +156,7 @@ func newInitAction(
featuresManager *alpha.FeatureManager,
extensionsManager *extensions.Manager,
azd workflow.AzdCommandRunner,
agentFactory *agent.CopilotAgentFactory,
agentFactory agent.AgentFactory,
consentManager consent.ConsentManager,
configManager config.UserConfigManager,
) actions.Action {
Expand Down Expand Up @@ -522,7 +522,7 @@ When complete, provide a brief summary of what was accomplished.`

i.console.Message(ctx, color.MagentaString("Preparing application for Azure deployment..."))

result, err := copilotAgent.SendMessageWithRetry(ctx, prompt, opts...)
_, err = copilotAgent.SendMessageWithRetry(ctx, prompt, opts...)
if err != nil {
return err
}
Expand All @@ -532,10 +532,10 @@ When complete, provide a brief summary of what was accomplished.`
_ = azdCtx.ClearCopilotSession()
}

// Show usage
if usage := result.Usage.Format(); usage != "" {
// Show session metrics (usage + file changes)
if metrics := copilotAgent.GetMetrics().String(); metrics != "" {
i.console.Message(ctx, "")
i.console.Message(ctx, usage)
i.console.Message(ctx, metrics)
}

i.console.Message(ctx, "")
Expand Down
6 changes: 3 additions & 3 deletions cli/azd/cmd/middleware/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var (
type ErrorMiddleware struct {
options *Options
console input.Console
agentFactory *agent.CopilotAgentFactory
agentFactory agent.AgentFactory
global *internal.GlobalCommandOptions
featuresManager *alpha.FeatureManager
userConfigManager config.UserConfigManager
Expand Down Expand Up @@ -147,7 +147,7 @@ func shouldSkipErrorAnalysis(err error) bool {

func NewErrorMiddleware(
options *Options, console input.Console,
agentFactory *agent.CopilotAgentFactory,
agentFactory agent.AgentFactory,
global *internal.GlobalCommandOptions,
featuresManager *alpha.FeatureManager,
userConfigManager config.UserConfigManager,
Expand Down Expand Up @@ -275,7 +275,7 @@ func (e *ErrorMiddleware) Run(ctx context.Context, next NextFn) (*actions.Action
// Display usage metrics if available
if agentResult != nil && agentResult.Usage.TotalTokens() > 0 {
e.console.Message(ctx, "")
e.console.Message(ctx, agentResult.Usage.Format())
e.console.Message(ctx, agentResult.Usage.String())
}

// Ask user if the agent applied a fix and they want to retry the command
Expand Down
3 changes: 3 additions & 0 deletions cli/azd/extensions/microsoft.azd.demo/extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ examples:
- name: mcp
description: Start MCP server with demo tools.
usage: azd demo mcp start
- name: copilot
description: Interactive Copilot chat loop demonstrating CopilotService gRPC API.
usage: azd demo copilot [--model <model>] [--resume]
Loading
Loading