Skip to content

The open-source app everyone uses to manage agents at work

Merge pull request #386 from domocarroll/fix/heartbeat-budget-enforcement

Dotta57113b1075c2
diff --cc server/src/services/heartbeat.ts
index 3ced47fc2b,81d02137e5..c3f562e96c
--- a/server/src/services/heartbeat.ts
+++ b/server/src/services/heartbeat.ts
@@@ -9,9 -9,7 +9,8 @@@ import
agentWakeupRequests,
heartbeatRunEvents,
heartbeatRuns,
- costEvents,
issues,
+ projects,
projectWorkspaces,
} from "@paperclipai/db";
import { conflict, notFound } from "../errors.js";
@@@ -22,23 -20,9 +21,24 @@@ import { getServerAdapter, runningProce
import type { AdapterExecutionResult, AdapterInvocationMeta, AdapterSessionCodec } from "../adapters/index.js";
import { createLocalAgentJwt } from "../agent-auth-jwt.js";
import { parseObject, asBoolean, asNumber, appendWithCap, MAX_EXCERPT_BYTES } from "../adapters/utils.js";
+ import { costService } from "./costs.js";
import { secretService } from "./secrets.js";
import { resolveDefaultAgentWorkspaceDir } from "../home-paths.js";
+import { summarizeHeartbeatRunResultJson } from "./heartbeat-run-summary.js";
+import {
+ buildWorkspaceReadyComment,
+ ensureRuntimeServicesForRun,
+ persistAdapterManagedRuntimeServices,
+ realizeExecutionWorkspace,
+ releaseRuntimeServicesForRun,
+} from "./workspace-runtime.js";
+import { issueService } from "./issues.js";
+import {
+ buildExecutionWorkspaceAdapterConfig,
+ parseIssueExecutionWorkspaceSettings,
+ parseProjectExecutionWorkspacePolicy,
+ resolveExecutionWorkspaceMode,
+} from "./execution-workspace-policy.js";
const MAX_LIVE_LOG_CHUNK_BYTES = 8 * 1024;
const HEARTBEAT_MAX_CONCURRENT_RUNS_DEFAULT = 1;