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

Commitbe1e137

Browse files
committed
coder ssh strategy finally working
1 parent063b27e commitbe1e137

File tree

3 files changed

+49
-23
lines changed

3 files changed

+49
-23
lines changed

‎package.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@
211211
"when":"coder.authenticated"
212212
},
213213
{
214-
"command":"coder.openAITask",
215-
"title":"Coder: OpenAI Task",
214+
"command":"coder.openAppStatus",
215+
"title":"Coder: OpenApp Status",
216216
"icon":"$(robot)",
217217
"when":"coder.authenticated"
218218
}
@@ -244,7 +244,7 @@
244244
"group":"navigation"
245245
},
246246
{
247-
"command":"coder.openAITask",
247+
"command":"coder.openAppStatus",
248248
"when":"coder.authenticated && view == myWorkspaces",
249249
"group":"navigation"
250250
}
@@ -280,11 +280,6 @@
280280
"command":"coder.createWorkspace",
281281
"group":"remote_11_ssh_coder@2",
282282
"when":"coder.authenticated"
283-
},
284-
{
285-
"command":"coder.openAITask",
286-
"group":"remote_11_ssh_coder@3",
287-
"when":"coder.authenticated"
288283
}
289284
]
290285
}

‎src/commands.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,14 +412,32 @@ export class Commands {
412412
status?:string
413413
url?:string
414414
agent_name?:string
415+
command?:string
416+
workspace_name?:string
415417
}):Promise<void>{
418+
// Launch and run command in terminal if command is provided
419+
if(app.command){
420+
constterminal=vscode.window.createTerminal(`${app.name||"Application"} Status`)
421+
terminal.show(false)
422+
vscode.commands.executeCommand("workbench.action.toggleMaximizedPanel")
423+
// If workspace_name is provided, run coder ssh before the command
424+
if(app.workspace_name){
425+
terminal.sendText(`coder ssh${app.workspace_name}`)
426+
// Sleep for 5 seconds
427+
awaitnewPromise((resolve)=>setTimeout(resolve,5000))
428+
terminal.sendText(app.command)
429+
}else{
430+
terminal.sendText("need workspace name")
431+
}
432+
return
433+
}
416434
// Check if app has a URL to open
417435
if(app.url){
418436
awaitvscode.env.openExternal(vscode.Uri.parse(app.url))
419437
return
420438
}
421439

422-
// If no URL, show information about the app status
440+
// If no URL or command, show information about the app status
423441
vscode.window.showInformationMessage(`${app.name||"Application"}:${app.status||"Running"}`,{
424442
detail:`Agent:${app.agent_name||"Unknown"}`,
425443
})

‎src/workspacesProvider.ts

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ export class WorkspaceProvider implements vscode.TreeDataProvider<vscode.TreeIte
168168
url:app.url,
169169
agent_id:agent.id,
170170
agent_name:agent.name,
171+
command:app.command,
172+
workspace_name:workspace.name,
171173
}))
172174
}
173175
})
@@ -253,21 +255,25 @@ export class WorkspaceProvider implements vscode.TreeDataProvider<vscode.TreeIte
253255

254256
// Add app status section with collapsible header
255257
if(element.agent.apps&&element.agent.apps.length>0){
256-
letneedsAttention=[]
258+
constneedsAttention=[]
257259
for(constappofelement.agent.apps){
258260
if(app.statuses&&app.statuses.length>0){
259261
for(conststatusofapp.statuses){
260262
if(status.needs_user_attention){
261-
needsAttention.push(newAppStatusTreeItem(status))
263+
needsAttention.push(
264+
newAppStatusTreeItem({
265+
name:status.message,
266+
command:app.command,
267+
status:status.state,
268+
workspace_name:element.workspaceName,
269+
}),
270+
)
262271
}
263272
}
264273
}
265274
}
266275

267-
constappStatusSection=newSectionTreeItem(
268-
"Applications in need of attention",
269-
needsAttention,
270-
)
276+
constappStatusSection=newSectionTreeItem("Applications in need of attention",needsAttention)
271277
items.push(appStatusSection)
272278
}
273279

@@ -372,17 +378,15 @@ class AgentMetadataTreeItem extends vscode.TreeItem {
372378
classAppStatusTreeItemextendsvscode.TreeItem{
373379
constructor(
374380
publicreadonlyapp:{
375-
name?:string
376-
display_name?:string
381+
name:string
377382
status?:string
378-
icon?:string
379383
url?:string
380-
agent_id?:string
381-
agent_name?:string
384+
command?:string
385+
workspace_name?:string
382386
},
383387
){
384-
super(app.icon||"$(pulse)",vscode.TreeItemCollapsibleState.None)
385-
this.description=app.status||"Running"
388+
super(app.name,vscode.TreeItemCollapsibleState.None)
389+
this.description=app.status
386390
this.contextValue="coderAppStatus"
387391

388392
// Add command to handle clicking on the app
@@ -449,7 +453,16 @@ class AgentTreeItem extends OpenableTreeItem {
449453
}
450454

451455
exportclassWorkspaceTreeItemextendsOpenableTreeItem{
452-
publicappStatus:{name:string;status:string;icon?:string}[]=[]
456+
publicappStatus:{
457+
name:string
458+
status:string
459+
icon?:string
460+
url?:string
461+
agent_id?:string
462+
agent_name?:string
463+
command?:string
464+
workspace_name?:string
465+
}[]=[]
453466

454467
constructor(
455468
publicreadonlyworkspace:Workspace,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp