MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / createSandboxUsageEvent

Function createSandboxUsageEvent

services/cloud-agent-next/src/workspace.ts:678–692  ·  view source on GitHub ↗
(
  executor: CommandExecutor,
  sessionId?: string
)

Source from the content-addressed store, hash-verified

676/**
677 * Check available disk space and total disk space for the container.
678 * Uses `df` command on the root filesystem which is available in the sandbox environment.
679 * Always checks `/` since all paths in the container share the same filesystem.
680 *
681 * @param session - Execution session to run the check
682 * @returns Structured disk space result
683 * @throws Error if disk check fails (command error, parse error, or exception)
684 */
685export async function checkDiskSpace(executor: CommandExecutor): Promise<DiskSpaceResult> {
686 // df -B1 gives output in bytes for clean numeric parsing (no M/G/K suffixes)
687 // --output=avail,size gives available and total space
688 // Always use "/" since all container paths share the same root filesystem
689 let result: ExecResult;
690 try {
691 result = await timedExec(
692 executor,
693 'df -B1 --output=avail,size / | tail -1',
694 'workspace.checkDiskSpace',
695 { timeoutMs: DISK_CHECK_TIMEOUT_MS }

Callers 1

workspace.test.tsFile · 0.90

Calls 1

checkDiskSpaceFunction · 0.85

Tested by

no test coverage detected