Skip to content

An open-source, faster Devin alternative

TypeScript

managed-agents: live sessions carry status and last activity for the model seam

Igor Zalutski via Computer93cc653e9ecf
diff --git a/services/managed-agents/src/computer/durable-object.ts b/services/managed-agents/src/computer/durable-object.ts
index 7ba91dcc..dbc3223d 100644
--- a/services/managed-agents/src/computer/durable-object.ts
+++ b/services/managed-agents/src/computer/durable-object.ts
@@ -156,6 +156,7 @@ import {
MODEL_VIEW_CODEX,
type MintResult,
type ModelAccess,
+ type ModelSession,
type ModelSubmittedView,
type ProbeOutcome,
type RedeemInput,
@@ -3278,11 +3279,11 @@ export class ComputerDurableObject extends DurableObject<ComputerEdgeEnv> {
}
}
- /** Sessions running now, with their conversations (pushes go to these). */
- private liveSessions(): Array<{ key: string; ownerId: string; channelId: string; threadTs: string }> {
- return [...this.ctx.storage.sql.exec<{ key: string; ownerId: string | null; channelId: string; threadTs: string }>(
- "SELECT runner_key AS key, owner_id AS ownerId, channel_id AS channelId, thread_ts AS threadTs FROM sessions WHERE status IN ('starting', 'idle', 'busy')",
- )].flatMap((row) => (row.ownerId ? [{ key: row.key, ownerId: row.ownerId, channelId: row.channelId, threadTs: row.threadTs }] : []));
+ /** Sessions running now, with their conversations and last activity (pushes go to these). */
+ private liveSessions(): ModelSession[] {
+ return [...this.ctx.storage.sql.exec<{ key: string; ownerId: string | null; channelId: string; threadTs: string; status: string; activeAt: number }>(
+ "SELECT runner_key AS key, owner_id AS ownerId, channel_id AS channelId, thread_ts AS threadTs, status, updated_at AS activeAt FROM sessions WHERE status IN ('starting', 'idle', 'busy')",
+ )].flatMap((row) => (row.ownerId ? [{ key: row.key, ownerId: row.ownerId, channelId: row.channelId, threadTs: row.threadTs, status: row.status, activeAt: row.activeAt }] : []));
}
/** Slack says a person left, was deactivated or became a guest (work 077): their Claude subscription goes. */
diff --git a/services/managed-agents/src/computer/model-access.ts b/services/managed-agents/src/computer/model-access.ts
index 23be92b2..db4f1605 100644
--- a/services/managed-agents/src/computer/model-access.ts
+++ b/services/managed-agents/src/computer/model-access.ts
@@ -153,6 +153,10 @@ export interface ModelSession {
ownerId: string;
channelId: string;
threadTs: string;
+ /** `starting`, `idle` or `busy`; absent from a seam that doesn't say. */
+ status?: string;
+ /** When the thread last had a turn or changed status (ms); absent from a seam that doesn't say. */
+ activeAt?: number;
}
/** A session's route and why. `route.mode === "refuse"` is never delivered, only pushed. */