8000 update deps to kyles branch and make helper for getting agent informa… · coder/vscode-coder@bfa33eb · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit bfa33eb

Browse files
committed
update deps to kyles branch and make helper for getting agent information
1 parent fbf9a07 commit bfa33eb

File tree

3 files changed

+46
-4
lines changed

3 files changed

+46
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@
287287
"@vscode/test-electron": "^2.4.1",
288288
"@vscode/vsce": "^2.21.1",
289289
"bufferutil": "^4.0.8",
290-
"coder": "https://github.com/coder/coder#main",
290+
"coder": "https://github.com/coder/coder#kyle/tasks",
291291
8000 "dayjs": "^1.11.13",
292292
"eslint": "^8.57.1",
293293
"eslint-config-prettier": "^9.1.0",

src/api.ts

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { AxiosInstance } from "axios"
22
import { spawn } from "child_process"
33
import { Api } from "coder/site/src/api/api"
4-
import { ProvisionerJobLog, Workspace } from "coder/site/src/api/typesGenerated"
4+
import { ProvisionerJobLog, Workspace, WorkspaceAgent } from "coder/site/src/api/typesGenerated"
55
import { FetchLikeInit } from "eventsource"
66
import fs from "fs/promises"
77
import { ProxyAgent } from "proxy-agent"
@@ -276,3 +276,45 @@ export async function waitForBuild(
276276
writeEmitter.fire(`Workspace is now ${updatedWorkspace.latest_build.status}\r\n`)
277277
return updatedWorkspace
278278
}
279+
280 8000 +
// 1. First, get a workspace by owner and name
281+
export async function getAITasksForWorkspace(
282+
restClient: Api,
283+
writeEmitter: vscode.EventEmitter<string>,
284+
workspace: Workspace,
285+
) {
286+
287+
// The workspace will include agents, and within each agent you can find tasks
288+
// You can access the agents from the workspace resource
289+
const resources = workspace.latest_build.resources;
290+
291+
// Go through each resource
292+
for (const resource of resources) {
293+
// Each resource can have multiple agents
294+
if (!resource.agents) {
295+
continue
296+
}
297+
298+
for (const agent of resource.agents) {
299+
// Check if this agent has any AI tasks
300+
if (agent.tasks && agent.tasks.length > 0) {
301+
// This agent has AI tasks!
302+
console.log(`Agent ${agent.name} (${agent.id}) has ${agent.tasks.length} tasks`);
303+
304+
// Examine task details
305+
for (const task of agent.tasks) {
306+
console.log(`Task: ${task.summary}`);
307+
console.log(`Reporter: ${task.reporter}`);
308+
console.log(`Status: ${task.completion ? 'Completed' : 'In Progress'}`);
309+
console.log(`URL: ${task.url}`);
310+
console.log(`Icon: ${task.icon}`);
311+
}
312+
313+
// Check if the agent is waiting for user input
314+
if (agent.task_waiting_for_user_input) {
315+
console.log("This agent is waiting for user input!");
316+
}
317+
}
318+
}
319+
}
320+
}

yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,9 +1592,9 @@ co@3.1.0:
15921592
resolved "https://registry.yarnpkg.com/co/-/co-3.1.0.tgz#4ea54ea5a08938153185e15210c68d9092bc1b78"
15931593
integrity sha512-CQsjCRiNObI8AtTsNIBDRMQ4oMR83CzEswHYahClvul7gKk+lDQiOKv+5qh7LQWf5sh6jkZNispz/QlsZxyNgA==
15941594

1595-
"coder@https://github.com/coder/coder#main":
1595+
"coder@https://github.com/coder/coder#kyle/tasks":
15961596
version "0.0.0"
1597-
resolved "https://github.com/coder/coder#975ea23d6f49a4043131f79036d1bf5166eb9140"
1597+
resolved "https://github.com/coder/coder#87e086298f19fec18b2ba18bf4ff39081d670570"
15981598

15991599
collapse-white-space@^1.0.2:
16001600
version "1.0.6"

0 commit comments

Comments
 (0)
0