Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita79ee72

Browse files
committed
Rename LLM to AI
Also, any references to the API are renamed as "AgentAPI" rather thanjust "agent".
1 parent866b721 commita79ee72

File tree

2 files changed

+58
-57
lines changed

2 files changed

+58
-57
lines changed

‎cli/exp_mcp.go‎

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828

2929
const (
3030
envAppStatusSlug="CODER_MCP_APP_STATUS_SLUG"
31-
envLLMAgentURL="CODER_MCP_LLM_AGENT_URL"
31+
envAIAgentAPIURL="CODER_MCP_AI_AGENTAPI_URL"
3232
)
3333

3434
func (r*RootCmd)mcpCommand()*serpent.Command {
@@ -126,7 +126,7 @@ func (r *RootCmd) mcpConfigureClaudeCode() *serpent.Command {
126126
coderPromptstring
127127
appStatusSlugstring
128128
testBinaryNamestring
129-
llmAgentURL url.URL
129+
aiAgentAPIURL url.URL
130130

131131
deprecatedCoderMCPClaudeAPIKeystring
132132
)
@@ -165,8 +165,8 @@ func (r *RootCmd) mcpConfigureClaudeCode() *serpent.Command {
165165
ifappStatusSlug!="" {
166166
configureClaudeEnv[envAppStatusSlug]=appStatusSlug
167167
}
168-
ifllmAgentURL.String()!="" {
169-
configureClaudeEnv[envLLMAgentURL]=llmAgentURL.String()
168+
ifaiAgentAPIURL.String()!="" {
169+
configureClaudeEnv[envAIAgentAPIURL]=aiAgentAPIURL.String()
170170
}
171171
ifdeprecatedSystemPromptEnv,ok:=os.LookupEnv("SYSTEM_PROMPT");ok {
172172
cliui.Warnf(inv.Stderr,"SYSTEM_PROMPT is deprecated, use CODER_MCP_CLAUDE_SYSTEM_PROMPT instead")
@@ -267,10 +267,10 @@ func (r *RootCmd) mcpConfigureClaudeCode() *serpent.Command {
267267
Value:serpent.StringOf(&appStatusSlug),
268268
},
269269
{
270-
Flag:"llm-agent-url",
271-
Description:"The URL of theLLM agent API, used to listen for status updates.",
272-
Env:envLLMAgentURL,
273-
Value:serpent.URLOf(&llmAgentURL),
270+
Flag:"ai-agentapi-url",
271+
Description:"The URL of theAI AgentAPI, used to listen for status updates.",
272+
Env:envAIAgentAPIURL,
273+
Value:serpent.URLOf(&aiAgentAPIURL),
274274
},
275275
{
276276
Name:"test-binary-name",
@@ -370,11 +370,11 @@ type taskReport struct {
370370
}
371371

372372
typemcpServerstruct {
373-
agentClient*agentsdk.Client
374-
appStatusSlugstring
375-
client*codersdk.Client
376-
llmClient*agentapi.Client
377-
queue*cliutil.Queue[taskReport]
373+
agentClient*agentsdk.Client
374+
appStatusSlugstring
375+
client*codersdk.Client
376+
aiAgentAPIClient*agentapi.Client
377+
queue*cliutil.Queue[taskReport]
378378
}
379379

380380
func (r*RootCmd)mcpServer()*serpent.Command {
@@ -383,13 +383,13 @@ func (r *RootCmd) mcpServer() *serpent.Command {
383383
instructionsstring
384384
allowedTools []string
385385
appStatusSlugstring
386-
llmAgentURL url.URL
386+
aiAgentAPIURL url.URL
387387
)
388388
return&serpent.Command{
389389
Use:"server",
390390
Handler:func(inv*serpent.Invocation)error {
391391
// lastUserMessageID is the ID of the last *user* message that we saw. A
392-
// user message only happens when interacting via theLLM agent API (as
392+
// user message only happens when interacting via theAI AgentAPI (as
393393
// opposed to interacting with the terminal directly).
394394
varlastUserMessageIDint64
395395
varlastReporttaskReport
@@ -399,14 +399,15 @@ func (r *RootCmd) mcpServer() *serpent.Command {
399399
// new user message, and the status is "working" and not self-reported
400400
// (meaning it came from the screen watcher), then it means one of two
401401
// things:
402-
// 1. The LLM is still working, so there is nothing to update.
403-
// 2. The LLM stopped working, then the user has interacted with the
404-
// terminal directly. For now, we are ignoring these updates. This
405-
// risks missing cases where the user manually submits a new prompt
406-
// and the LLM becomes active and does not update itself, but it
407-
// avoids spamming useless status updates as the user is typing, so
408-
// the tradeoff is worth it. In the future, if we can reliably
409-
// distinguish between user and LLM activity, we can change this.
402+
// 1. The AI agent is still working, so there is nothing to update.
403+
// 2. The AI agent stopped working, then the user has interacted with
404+
// the terminal directly. For now, we are ignoring these updates.
405+
// This risks missing cases where the user manually submits a new
406+
// prompt and the AI agent becomes active and does not update itself,
407+
// but it avoids spamming useless status updates as the user is
408+
// typing, so the tradeoff is worth it. In the future, if we can
409+
// reliably distinguish between user and AI agent activity, we can
410+
// change this.
410411
ifreport.messageID>lastUserMessageID {
411412
report.state=codersdk.WorkspaceAppStatusStateWorking
412413
}elseifreport.state==codersdk.WorkspaceAppStatusStateWorking&&!report.selfReported {
@@ -475,20 +476,20 @@ func (r *RootCmd) mcpServer() *serpent.Command {
475476
cliui.Infof(inv.Stderr,"Task reporter : Enabled")
476477
}
477478

478-
// Try to create a client for theLLM agent API, which is used to get the
479+
// Try to create a client for theAI AgentAPI, which is used to get the
479480
// screen status to make the status reporting more robust. No auth
480481
// needed, so no validation.
481-
ifllmAgentURL.String()=="" {
482-
cliui.Infof(inv.Stderr,"LLM agent URL : Not configured")
482+
ifaiAgentAPIURL.String()=="" {
483+
cliui.Infof(inv.Stderr,"AI AgentAPI URL : Not configured")
483484
}else {
484-
cliui.Infof(inv.Stderr,"LLM agent URL : %s",llmAgentURL.String())
485-
llmClient,err:=agentapi.NewClient(llmAgentURL.String())
485+
cliui.Infof(inv.Stderr,"AI AgentAPI URL : %s",aiAgentAPIURL.String())
486+
aiAgentAPIClient,err:=agentapi.NewClient(aiAgentAPIURL.String())
486487
iferr!=nil {
487488
cliui.Infof(inv.Stderr,"Screen events : Disabled")
488-
cliui.Warnf(inv.Stderr,"%s must be set",envLLMAgentURL)
489+
cliui.Warnf(inv.Stderr,"%s must be set",envAIAgentAPIURL)
489490
}else {
490491
cliui.Infof(inv.Stderr,"Screen events : Enabled")
491-
srv.llmClient=llmClient
492+
srv.aiAgentAPIClient=aiAgentAPIClient
492493
}
493494
}
494495

@@ -499,10 +500,10 @@ func (r *RootCmd) mcpServer() *serpent.Command {
499500
cliui.Infof(inv.Stderr,"Failed to watch screen events")
500501
// Start the reporter, watcher, and server. These are all tied to the
501502
// lifetime of the MCP server, which is itself tied to the lifetime of the
502-
//LLM agent.
503+
//AI agent.
503504
ifsrv.agentClient!=nil&&appStatusSlug!="" {
504505
srv.startReporter(ctx,inv)
505-
ifsrv.llmClient!=nil {
506+
ifsrv.aiAgentAPIClient!=nil {
506507
srv.startWatcher(ctx,inv)
507508
}
508509
}
@@ -536,10 +537,10 @@ func (r *RootCmd) mcpServer() *serpent.Command {
536537
Default:"",
537538
},
538539
{
539-
Flag:"llm-agent-url",
540-
Description:"The URL of theLLM agent API, used to listen for status updates.",
541-
Env:envLLMAgentURL,
542-
Value:serpent.URLOf(&llmAgentURL),
540+
Flag:"ai-agentapi-url",
541+
Description:"The URL of theAI AgentAPI, used to listen for status updates.",
542+
Env:envAIAgentAPIURL,
543+
Value:serpent.URLOf(&aiAgentAPIURL),
543544
},
544545
},
545546
}
@@ -549,9 +550,9 @@ func (s *mcpServer) startReporter(ctx context.Context, inv *serpent.Invocation)
549550
gofunc() {
550551
for {
551552
// TODO: Even with the queue, there is still the potential that a message
552-
// from the screen watcher and a message from theLLMcould arrive out of
553-
// order if the timing is just right. We might want to wait a bit, then
554-
// check if the status has changed before committing.
553+
// from the screen watcher and a message from theAI agentcould arrive
554+
//out oforder if the timing is just right. We might want to wait a bit,
555+
//thencheck if the status has changed before committing.
555556
item,ok:=s.queue.Pop()
556557
if!ok {
557558
return
@@ -571,7 +572,7 @@ func (s *mcpServer) startReporter(ctx context.Context, inv *serpent.Invocation)
571572
}
572573

573574
func (s*mcpServer)startWatcher(ctx context.Context,inv*serpent.Invocation) {
574-
eventsCh,errCh,err:=s.llmClient.SubscribeEvents(ctx)
575+
eventsCh,errCh,err:=s.aiAgentAPIClient.SubscribeEvents(ctx)
575576
iferr!=nil {
576577
cliui.Warnf(inv.Stderr,"Failed to watch screen events: %s",err)
577578
return

‎cli/exp_mcp_test.go‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ test-system-prompt
366366
"CODER_AGENT_URL": "%s",
367367
"CODER_AGENT_TOKEN": "test-agent-token",
368368
"CODER_MCP_APP_STATUS_SLUG": "some-app-name",
369-
"CODER_MCP_LLM_AGENT_URL": "http://localhost:3284"
369+
"CODER_MCP_AI_AGENTAPI_URL": "http://localhost:3284"
370370
}
371371
}
372372
}
@@ -391,7 +391,7 @@ test-system-prompt
391391
"--claude-test-binary-name=pathtothecoderbinary",
392392
"--agent-url",client.URL.String(),
393393
"--agent-token","test-agent-token",
394-
"--llm-agent-url","http://localhost:3284",
394+
"--ai-agentapi-url","http://localhost:3284",
395395
)
396396
clitest.SetupConfig(t,client,root)
397397

@@ -741,7 +741,7 @@ func TestExpMcpReporter(t *testing.T) {
741741
"--agent-url",client.URL.String(),
742742
"--agent-token","fake-agent-token",
743743
"--app-status-slug","vscode",
744-
"--llm-agent-url","not a valid url",
744+
"--ai-agentapi-url","not a valid url",
745745
)
746746
inv=inv.WithContext(ctx)
747747

@@ -804,7 +804,7 @@ func TestExpMcpReporter(t *testing.T) {
804804

805805
ctx,cancel:=context.WithCancel(testutil.Context(t,testutil.WaitShort))
806806

807-
// Mock theLLM agent API server.
807+
// Mock theAI AgentAPI server.
808808
listening:=make(chanfunc(sse codersdk.ServerSentEvent)error)
809809
srv:=httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter,r*http.Request) {
810810
send,closed,err:=httpapi.ServerSentEventSender(w,r)
@@ -821,7 +821,7 @@ func TestExpMcpReporter(t *testing.T) {
821821
<-closed
822822
}))
823823
t.Cleanup(srv.Close)
824-
llmAgentURL:=srv.URL
824+
aiAgentAPIURL:=srv.URL
825825

826826
// Watch the workspace for changes.
827827
watcher,err:=client.WatchWorkspace(ctx,r.Workspace.ID)
@@ -844,11 +844,11 @@ func TestExpMcpReporter(t *testing.T) {
844844

845845
inv,_:=clitest.New(t,
846846
"exp","mcp","server",
847-
// We need the agent credentials,LLM API url, and a slug for reporting.
847+
// We need the agent credentials,AI AgentAPI url, and a slug for reporting.
848848
"--agent-url",client.URL.String(),
849849
"--agent-token",r.AgentToken,
850850
"--app-status-slug","vscode",
851-
"--llm-agent-url",llmAgentURL,
851+
"--ai-agentapi-url",aiAgentAPIURL,
852852
"--allowed-tools=coder_report_task",
853853
)
854854
inv=inv.WithContext(ctx)
@@ -878,13 +878,13 @@ func TestExpMcpReporter(t *testing.T) {
878878
tests:= []struct {
879879
// event simulates an event from the screen watcher.
880880
event*codersdk.ServerSentEvent
881-
// state, summary, and uri simulate a tool call from theLLM.
881+
// state, summary, and uri simulate a tool call from theAI agent.
882882
state codersdk.WorkspaceAppStatusState
883883
summarystring
884884
uristring
885885
expected*codersdk.WorkspaceAppStatus
886886
}{
887-
// First theLLM updates with a state change.
887+
// First theAI agent updates with a state change.
888888
{
889889
state:codersdk.WorkspaceAppStatusStateWorking,
890890
summary:"doing work",
@@ -895,8 +895,8 @@ func TestExpMcpReporter(t *testing.T) {
895895
URI:"https://dev.coder.com",
896896
},
897897
},
898-
// Terminal goes quiet but theLLMforgot the update, and it is caught by
899-
// the screen watcher. Message and URI are preserved.
898+
// Terminal goes quiet but theAI agentforgot the update, and it is
899+
//caught bythe screen watcher. Message and URI are preserved.
900900
{
901901
event:makeStatusEvent(agentapi.StatusStable),
902902
expected:&codersdk.WorkspaceAppStatus{
@@ -910,17 +910,17 @@ func TestExpMcpReporter(t *testing.T) {
910910
event:makeStatusEvent(agentapi.StatusStable),
911911
},
912912
// Terminal becomes active again according to the screen watcher, but no
913-
// new user message. This could be theLLMbeing active again, but it
914-
// could also be the user messing around. We will prefer not updating the
915-
// status so the "working" update here should be skipped.
913+
// new user message. This could be theAI agentbeing active again, but
914+
//itcould also be the user messing around. We will prefer not updating
915+
//thestatus so the "working" update here should be skipped.
916916
{
917917
event:makeStatusEvent(agentapi.StatusRunning),
918918
},
919919
// Agent messages are ignored.
920920
{
921921
event:makeMessageEvent(1,agentapi.RoleAgent),
922922
},
923-
//LLM reports that it failed and URI is blank.
923+
//AI agent reports that it failed and URI is blank.
924924
{
925925
state:codersdk.WorkspaceAppStatusStateFailure,
926926
summary:"oops",
@@ -934,8 +934,8 @@ func TestExpMcpReporter(t *testing.T) {
934934
{
935935
event:makeStatusEvent(agentapi.StatusRunning),
936936
},
937-
// ... but this time we have a new user message so we know there isLLM
938-
// activity. This time the "working" update will not be skipped.
937+
// ... but this time we have a new user message so we know there isAI
938+
//agentactivity. This time the "working" update will not be skipped.
939939
{
940940
event:makeMessageEvent(2,agentapi.RoleUser),
941941
expected:&codersdk.WorkspaceAppStatus{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp