mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-20 07:04:38 +00:00
Add foundry terminal and process pane
This commit is contained in:
parent
0471214d65
commit
28c4ac22ff
16 changed files with 2412 additions and 36 deletions
|
|
@ -9,7 +9,15 @@ import type {
|
|||
SandboxAgentClientLike,
|
||||
TmuxDriver,
|
||||
} from "../../src/driver.js";
|
||||
import type { ListEventsRequest, ListPage, ListPageRequest, SessionEvent, SessionRecord } from "sandbox-agent";
|
||||
import type {
|
||||
ListEventsRequest,
|
||||
ListPage,
|
||||
ListPageRequest,
|
||||
ProcessInfo,
|
||||
ProcessLogsResponse,
|
||||
SessionEvent,
|
||||
SessionRecord,
|
||||
} from "sandbox-agent";
|
||||
|
||||
export function createTestDriver(overrides?: Partial<BackendDriver>): BackendDriver {
|
||||
return {
|
||||
|
|
@ -74,6 +82,25 @@ export function createTestSandboxAgentDriver(
|
|||
export function createTestSandboxAgentClient(
|
||||
overrides?: Partial<SandboxAgentClientLike>
|
||||
): SandboxAgentClientLike {
|
||||
const defaultProcess: ProcessInfo = {
|
||||
id: "process-1",
|
||||
command: "bash",
|
||||
args: ["-lc", "echo test"],
|
||||
createdAtMs: Date.now(),
|
||||
cwd: "/workspace",
|
||||
exitCode: null,
|
||||
exitedAtMs: null,
|
||||
interactive: true,
|
||||
pid: 123,
|
||||
status: "running",
|
||||
tty: true,
|
||||
};
|
||||
const defaultLogs: ProcessLogsResponse = {
|
||||
processId: defaultProcess.id,
|
||||
stream: "combined",
|
||||
entries: [],
|
||||
};
|
||||
|
||||
return {
|
||||
createSession: async (_prompt) => ({ id: "test-session-1", status: "running" }),
|
||||
sessionStatus: async (sessionId) => ({ id: sessionId, status: "running" }),
|
||||
|
|
@ -85,6 +112,12 @@ export function createTestSandboxAgentClient(
|
|||
items: [],
|
||||
nextCursor: undefined,
|
||||
}),
|
||||
createProcess: async () => defaultProcess,
|
||||
listProcesses: async () => ({ processes: [defaultProcess] }),
|
||||
getProcessLogs: async () => defaultLogs,
|
||||
stopProcess: async () => ({ ...defaultProcess, status: "exited", exitCode: 0, exitedAtMs: Date.now() }),
|
||||
killProcess: async () => ({ ...defaultProcess, status: "exited", exitCode: 137, exitedAtMs: Date.now() }),
|
||||
deleteProcess: async () => {},
|
||||
sendPrompt: async (_request) => {},
|
||||
cancelSession: async (_sessionId) => {},
|
||||
destroySession: async (_sessionId) => {},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue