Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

fix: expose Devin Cloud status and suspension details (#1566)

Matt Van Horn4119290b7fd6
diff --git a/cli/e2e/cloudAgents.e2e.ts b/cli/e2e/cloudAgents.e2e.ts
index e12227d4a..30a105036 100644
--- a/cli/e2e/cloudAgents.e2e.ts
+++ b/cli/e2e/cloudAgents.e2e.ts
@@ -33,8 +33,11 @@ class FakeDevin {
created: Record<string, unknown>[] = []
sent: string[] = []
archived = 0
- private status = 'running'
- private detail = 'working'
+ status = 'running'
+ /** Null when Devin sent no `status_detail`, so a later read can drop one that was there. */
+ detail: string | null = 'working'
+ /** A test's status stands: the scripted question and finish do not replace it. */
+ hold = false
private messages: Array<{ event_id: string; source: string; message: string; created_at: string }> = []
private pulls: Array<{ pr_url: string; pr_state: string }> = []
@@ -52,8 +55,9 @@ class FakeDevin {
if (url.pathname === '/v3/self') return reply({ org_id: 'org-e2e', principal_type: 'service_user' })
if (request.method === 'POST' && url.pathname === '/v3/organizations/org-e2e/sessions') { this.created.push(body); return reply(session()) }
if (request.method === 'GET' && url.pathname === '/v3/organizations/org-e2e/sessions/devin-e2e') {
- // Its first look finds Devin asking.
- if (!this.messages.length) {
+ // Its first look finds Devin asking. `running` so a session that started `new` can still be waiting.
+ if (!this.hold && !this.messages.length) {
+ this.status = 'running'
this.detail = 'waiting_for_user'
this.messages.push({ event_id: 'e1', source: 'devin', message: 'Which branch should I base it on?', created_at: '2026-10-11T10:01:00Z' })
}
@@ -65,9 +69,11 @@ class FakeDevin {
}
if (request.method === 'POST' && url.pathname.endsWith('/messages')) {
this.sent.push(String(body.message))
- this.detail = 'finished'
- this.messages.push({ event_id: `e${this.messages.length + 1}`, source: 'devin', message: 'Opened #42. Tests pass.', created_at: '2026-10-11T10:03:00Z' })
- this.pulls = [{ pr_url: 'https://github.com/acme/api/pull/42', pr_state: 'open' }]
+ if (!this.hold) {
+ this.detail = 'finished'
+ this.messages.push({ event_id: `e${this.messages.length + 1}`, source: 'devin', message: 'Opened #42. Tests pass.', created_at: '2026-10-11T10:03:00Z' })
+ this.pulls = [{ pr_url: 'https://github.com/acme/api/pull/42', pr_state: 'open' }]
+ }
return reply({})
}
if (request.method === 'POST' && url.pathname.endsWith('/archive')) { this.archived += 1; this.status = 'suspended'; this.detail = 'user_request'; return reply(session()) }
@@ -109,6 +115,8 @@ describe('cloud agents on the real daemon', () => {
vault.save('devin', { access_token: 'cog_e2e', token_type: 'Bearer', source: 'custom', label: 'Devin', transport: 'none', api_entry: { origin: devin.base } })
await d.start()
const client = await LocalClient.connect(d)
+ fake.status = 'new'
+ fake.detail = null
await until('the services to connect', () => d.log().includes('[services] search connected') || null, 30_000, 200)
expect(cloudStarts(d), 'an experiment no one asked for').toBe(0)
@@ -121,6 +129,7 @@ describe('cloud agents on the real daemon', () => {
expect(created.error, JSON.stringify(created)).toBeUndefined()
const agent = created.agent!
expect(agent).toMatchObject({ engine: 'devin-cloud', location: 'cloud', tmuxPane: null, terminal: { available: false }, project: { remote: 'https://github.com/acme/api' } })
+ expect(agent.cloud).toMatchObject({ state: 'starting', providerStatus: { status: 'new', detail: null } })
expect(cloudStarts(d)).toBe(1)
expect(devin.created).toEqual([{ prompt: 'fix the flaky login test', repos: ['acme/api'], max_acu_limit: 2, title: 'fix the flaky login test' }])
// The key went to Devin and nowhere else: the daemon's log never has it.
@@ -130,7 +139,7 @@ describe('cloud agents on the real daemon', () => {
const question = await asked
expect(question).toMatchObject({ agentId: agent.id, payload: { questions: [{ q: 'Which branch should I base it on?', canText: true }] } })
const listed = (await client.request<{ agents: Array<Record<string, any>> }>('agents_list', {})).agents.find((row) => row.id === agent.id)
- expect(listed).toMatchObject({ location: 'cloud', cloud: { place: "Devin's cloud", state: 'needs_input' } })
+ expect(listed).toMatchObject({ location: 'cloud', cloud: { place: "Devin's cloud", state: 'needs_input', providerStatus: { status: 'running', detail: 'waiting_for_user' } } })
const finished = client.next((frame: Frame) => frame.type === 'agent_synced' && frame.payload?.agent?.id === agent.id && frame.payload.agent.cloud?.state === 'idle', 60_000, 'the harness to finish')
// Answered as the dial and the windows answer any agent's question: under the question's own id.
@@ -140,12 +149,24 @@ describe('cloud agents on the real daemon', () => {
expect(devin.sent).toEqual(['main'])
const done = (await finished).payload.agent
expect(done.cloud.links).toContainEqual({ label: 'Pull request #42', url: 'https://github.com/acme/api/pull/42' })
+ expect(done.cloud).toMatchObject({ state: 'idle', providerStatus: { status: 'running', detail: 'finished' } })
const transcript = await client.request<{ messages: Array<{ from: string; text: string }> }>('cloud_transcript', { agentId: agent.id })
expect(transcript.messages.map((message) => [message.from, message.text])).toEqual([
['person', 'fix the flaky login test'], ['agent', 'Which branch should I base it on?'], ['person', 'main'], ['agent', 'Opened #42. Tests pass.'],
])
- expect(await client.request('cloud_send', { agentId: agent.id, text: 'thanks' })).toMatchObject({ ok: true })
+ // Asleep, and a stop by request, stay stopped. A message in the transcript does not make either one finished.
+ fake.hold = true
+ fake.status = 'suspended'
+ fake.detail = 'inactivity'
+ fake.messages.push({ event_id: 'e-sleep', source: 'devin', message: 'Still working through the tests.', created_at: '2026-10-11T10:04:00Z' })
+ const slept = client.next((frame: Frame) => frame.type === 'agent_synced' && frame.payload?.agent?.id === agent.id && frame.payload.agent.cloud?.providerStatus?.detail === 'inactivity', 60_000, 'asleep after inactivity')
+ expect(await client.request('cloud_send', { agentId: agent.id, text: 'are you still there?' })).toMatchObject({ ok: true })
+ expect((await slept).payload.agent.cloud).toMatchObject({ state: 'stopped', activity: 'Devin went to sleep after inactivity.', providerStatus: { status: 'suspended', detail: 'inactivity' } })
+ fake.detail = 'user_request'
+ const halted = client.next((frame: Frame) => frame.type === 'agent_synced' && frame.payload?.agent?.id === agent.id && frame.payload.agent.cloud?.providerStatus?.detail === 'user_request', 60_000, 'stopped by request')
+ expect(await client.request('cloud_send', { agentId: agent.id, text: 'stop there' })).toMatchObject({ ok: true })
+ expect((await halted).payload.agent.cloud).toMatchObject({ state: 'stopped', activity: 'The session was stopped by request.', providerStatus: { status: 'suspended', detail: 'user_request' } })
expect(await client.request('agent_delete', { agentId: agent.id })).toMatchObject({ deleted: true })
expect(devin.archived).toBe(1)
@@ -157,6 +178,8 @@ describe('cloud agents on the real daemon', () => {
const back = await until('the harness to be listed again', async () =>
(await again.request<{ agents: Array<Record<string, any>> }>('agents_list', { includeStopped: true }, 30_000)).agents.find((row) => row.id === agent.id) ?? null, 60_000, 500)
expect(back).toMatchObject({ status: 'stopped', location: 'cloud' })
+ // A local stop is not Devin's last report: the saved harness does not keep the status from before it.
+ expect(back.cloud).not.toHaveProperty('providerStatus')
again.close()
}, 240_000)
diff --git a/cli/src/agentClient/commands.spec.ts b/cli/src/agentClient/commands.spec.ts
index a6131b04f..0c5db1120 100644
--- a/cli/src/agentClient/commands.spec.ts
+++ b/cli/src/agentClient/commands.spec.ts
@@ -1764,6 +1764,70 @@ describe('a cloud harness (#1444)', () => {
expect(c.err.join('\n')).toMatch(/stop it in Harness/)
expect(d.requests.some((r) => r.type === 'agent_close' && r.payload.mode !== 'inspect')).toBe(false)
})
+
+ it('shows the maker\'s status in show and ps --all, and leaves Fo, Cursor and a local harness as they were', async () => {
+ const d = new FakeDaemon()
+ d.frames = [
+ cloud('asleep', 'stopped', { status: 'stopped', cloud: { state: 'stopped', activity: 'Devin went to sleep after inactivity.', providerStatus: { status: 'suspended', detail: 'inactivity' }, links: [] } }),
+ cloud('halted', 'stopped', { status: 'stopped', cloud: { state: 'stopped', activity: 'The session was stopped by request.', providerStatus: { status: 'suspended', detail: 'user_request' }, links: [] } }),
+ cloud('done', 'idle', { cloud: { state: 'idle', activity: null, providerStatus: { status: 'exit', detail: null }, links: [] } }),
+ cloud('fo', 'idle', { engine: 'fo', cloud: { state: 'idle', activity: 'Calling Hair Lab', links: [] } }),
+ cloud('cursor', 'working', { engine: 'cursor-cloud', cloud: { state: 'working', links: [] } }),
+ frame('local'),
+ ]
+ const listed = harness(d, { pane: undefined })
+ expect(await psCommand(['--json'], listed.deps)).toBe(EXIT.ok)
+ expect(JSON.parse(listed.out[0]).harnesses.map((r: { name: string }) => r.name)).not.toContain('asleep')
+ const all = harness(d, { pane: undefined })
+ expect(await psCommand(['--all', '--json'], all.deps)).toBe(EXIT.ok)
+ const byName = Object.fromEntries(JSON.parse(all.out[0]).harnesses.map((r: { name: string }) => [r.name, r]))
+ expect(byName.asleep.cloud).toEqual({ state: 'stopped', activity: 'Devin went to sleep after inactivity.', providerStatus: { status: 'suspended', detail: 'inactivity' } })
+ expect(byName.halted.cloud).toEqual({ state: 'stopped', activity: 'The session was stopped by request.', providerStatus: { status: 'suspended', detail: 'user_request' } })
+ expect(byName.done.cloud.providerStatus).toEqual({ status: 'exit', detail: null })
+ expect(byName.fo.cloud).toEqual({ state: 'idle', activity: 'Calling Hair Lab' })
+ expect(byName.cursor.cloud).toEqual({ state: 'working', activity: null })
+ expect(byName.local).not.toHaveProperty('cloud')
+ const shown = harness(d, { pane: undefined })
+ expect(await showCommand(['halted', '--json'], shown.deps)).toBe(EXIT.ok)
+ expect(JSON.parse(shown.out.join('\n')).cloud).toEqual({ state: 'stopped', activity: 'The session was stopped by request.', providerStatus: { status: 'suspended', detail: 'user_request' } })
+ const fo = harness(d, { pane: undefined })
+ expect(await showCommand(['fo', '--json'], fo.deps)).toBe(EXIT.ok)
+ expect(JSON.parse(fo.out.join('\n')).cloud).toEqual({ state: 'idle', activity: 'Calling Hair Lab' })
+ expect(JSON.parse(fo.out.join('\n'))).not.toHaveProperty('cloud.providerStatus')
+ const local = harness(d, { pane: undefined })
+ expect(await showCommand(['local', '--json'], local.deps)).toBe(EXIT.ok)
+ expect(JSON.parse(local.out.join('\n'))).not.toHaveProperty('cloud')
+ })
+
+ it('waits on the frame it ended on, including one that left the live list', async () => {
+ const steps = [
+ cloud('devin', 'starting', { cloud: { state: 'starting', activity: null, providerStatus: { status: 'new', detail: null }, links: [] } }),
+ cloud('devin', 'working', { cloud: { state: 'working', activity: null, providerStatus: { status: 'running', detail: 'working' }, links: [] } }),
+ cloud('devin', 'idle', { cloud: { state: 'idle', activity: null, providerStatus: { status: 'running', detail: 'finished' }, links: [] } }),
+ ]
+ const d = new FakeDaemon()
+ d.extra.agents_list = () => ({ agents: [steps.length > 1 ? steps.shift()! : steps[0]!] })
+ const h = harness(d)
+ expect(await waitCommand(['devin', '--json'], h.deps)).toBe(EXIT.ok)
+ expect(JSON.parse(h.out.join('\n')).harnesses[0]).toMatchObject({ state: 'idle', cloud: { state: 'idle', providerStatus: { status: 'running', detail: 'finished' } } })
+ const asking = new FakeDaemon()
+ asking.frames = [cloud('devin', 'needs_input', { cloud: { state: 'needs_input', activity: null, providerStatus: { status: 'running', detail: 'waiting_for_approval' }, links: [] } })]
+ const w = harness(asking)
+ expect(await waitCommand(['devin', '--json'], w.deps)).toBe(EXIT.needsInput)
+ expect(JSON.parse(w.out.join('\n')).harnesses[0]).toMatchObject({ state: 'needs-input', needsPerson: true, cloud: { providerStatus: { status: 'running', detail: 'waiting_for_approval' } } })
+ const gone = new FakeDaemon()
+ const live = cloud('devin', 'working', { cloud: { state: 'working', activity: null, providerStatus: { status: 'running', detail: 'working' }, links: [] } })
+ const stopped = cloud('devin', 'stopped', { status: 'stopped', cloud: { state: 'stopped', activity: 'The session was stopped by request.', providerStatus: { status: 'suspended', detail: 'user_request' }, links: [] } })
+ let n = 0
+ gone.extra.agents_list = (payload) => {
+ n += 1
+ if (n <= 2) return { agents: [live] }
+ return { agents: payload.includeStopped ? [stopped] : [] }
+ }
+ const s = harness(gone)
+ expect(await waitCommand(['devin', '--json'], s.deps)).toBe(EXIT.stopped)
+ expect(JSON.parse(s.out.join('\n')).harnesses[0].cloud).toEqual({ state: 'stopped', activity: 'The session was stopped by request.', providerStatus: { status: 'suspended', detail: 'user_request' } })
+ })
})
describe('harness tell', () => {
diff --git a/cli/src/agentClient/commands.ts b/cli/src/agentClient/commands.ts
index 0a37ee395..ab730318d 100644
--- a/cli/src/agentClient/commands.ts
+++ b/cli/src/agentClient/commands.ts
@@ -31,7 +31,7 @@ import { Ledger, ledgerPath, type Pending, type Started, type Told } from './led
import { messagesRpc, type Rpc } from '../messages/rpc.js'
import { TELL_OFF_TEXT } from '../messages/tell.js'
import { sendPane } from '../messages/command.js'
-import { asSaid, callerOf, clip, cloudTurn, forAgent, isAgent, lastTurn, matching, outsideCaller, rowsOf, stateOf, STOPPED_WITHIN_MS, type Caller, type Frame, type HistoryEvent, type Row, type State } from './model.js'
+import { asSaid, callerOf, clip, cloudMeta, cloudTurn, forAgent, isAgent, lastTurn, matching, outsideCaller, rowsOf, stateOf, STOPPED_WITHIN_MS, type Caller, type CloudMeta, type Frame, type HistoryEvent, type Row, type State } from './model.js'
export interface ClientDeps {
pane?: string | undefined
@@ -694,11 +694,13 @@ export function showCommand(argv: readonly string[], deps: ClientDeps = {}): Pro
: pendingTell && state !== 'needs-input' ? [{ run: step(s.env, 'wait', at), when: 'until it has taken the work you told it' }]
// `close` and `tell` take no cloud harness.
: showNext(s.env, state, t.yours && t.frame.location !== 'cloud', at, tellsHere(o, s.pane))
+ const cloud = cloudMeta(t.frame)
const result = {
name: t.frame.name, id: t.frame.id, agent: engineName(t.frame.engine ?? ''), machine: t.machine, state, startedBy,
folder: t.frame.project?.cwd ?? null, branch: t.frame.project?.branch ?? null,
ask: turn?.ask ?? null, answer: clip(answer, chars), truncated: answer.length > chars, tools: turn?.tools ?? 0, next,
...(state === 'needs-input' ? { needsPerson: true } : {}),
+ ...(cloud ? { cloud } : {}),
...(t.frame.cloud?.links?.length ? { links: t.frame.cloud.links } : {}),
...(pendingTell ? { told: { at: new Date(pendingTell.at).toISOString(), taken: false } } : {}),
}
@@ -917,8 +919,13 @@ export function waitCommand(argv: readonly string[], deps: ClientDeps = {}): Pro
}
const look = async (t: Target, frames: Frame[]): Promise<Settled | null> => {
const frame = frames.find((f) => f.id === t.frame.id)
- // Not live: stopped, or gone. Asked of the full list only then.
- if (!frame) return ended(t, (await list(t.daemon, true)).some((f) => f.id === t.frame.id) ? 'stopped' : 'gone')
+ // Not live: stopped, or gone. Asked of the full list only then. The stopped frame is the one this wait
+ // ended on: the frame from before the wait still has the maker's earlier status (lampOS, #1449).
+ if (!frame) {
+ const stopped = (await list(t.daemon, true)).find((f) => f.id === t.frame.id)
+ if (stopped) t.frame = stopped
+ return ended(t, stopped ? 'stopped' : 'gone')
+ }
t.frame = frame
if (frame.status === 'stopped') return ended(t, 'stopped')
// A cloud harness says where it is itself, with no screen to read: done once it is no longer starting or working.
@@ -980,8 +987,11 @@ export function waitCommand(argv: readonly string[], deps: ClientDeps = {}): Pro
}
await s.sleep(Math.min(s.intervalMs, Math.max(0, deadline - s.now())))
}
- const results: Array<{ name: string; id: string; state: Settled | 'installing' | 'starting'; detail?: string }> = [
- ...targets.filter((t) => settled.has(t)).map((t) => ({ name: t.frame.name ?? t.frame.id.slice(0, 8), id: t.frame.id, state: settled.get(t)! })),
+ const results: Array<{ name: string; id: string; state: Settled | 'installing' | 'starting'; detail?: string; cloud?: CloudMeta }> = [
+ ...targets.filter((t) => settled.has(t)).map((t) => {
+ const cloud = cloudMeta(t.frame)
+ return { name: t.frame.name ?? t.frame.id.slice(0, 8), id: t.frame.id, state: settled.get(t)!, ...(cloud ? { cloud } : {}) }
+ }),
// Not started yet when the wait ended: said as what it waits for, which is what the agent waits on.
...following.filter((a) => gave.has(a)).map((a) => {
const given = gave.get(a)!
diff --git a/cli/src/agentClient/model.spec.ts b/cli/src/agentClient/model.spec.ts
index 806181a63..0fac7da3e 100644
--- a/cli/src/agentClient/model.spec.ts
+++ b/cli/src/agentClient/model.spec.ts
@@ -101,6 +101,18 @@ describe('a harness as the agent verbs show it', () => {
expect(all.find((r) => r.name === 'kid')).toMatchObject({ startedBy: 'lead', yours: false })
})
+ it('keeps a cloud maker\'s status beside the row, and leaves every other harness as it was', () => {
+ const asleep = frame('asleep', { engine: 'devin-cloud', location: 'cloud', status: 'stopped', activity: { state: 'idle' },
+ cloud: { state: 'stopped', activity: 'Devin went to sleep after inactivity.', providerStatus: { status: 'suspended', detail: 'inactivity' } },
+ updatedAt: new Date(NOW - 1_000).toISOString() })
+ const fo = frame('fo', { engine: 'fo', location: 'cloud', cloud: { state: 'idle', activity: 'Calling Hair Lab' } })
+ const rows = rowsOf([frame('lead'), asleep, fo], { machineId: 'm', machine: 'mac', caller: null, ledger: ledger(), now: NOW, all: true })
+ expect(rows.find((r) => r.name === 'asleep')).toMatchObject({ state: 'stopped', cloud: { state: 'stopped', activity: 'Devin went to sleep after inactivity.', providerStatus: { status: 'suspended', detail: 'inactivity' } } })
+ expect(rows.find((r) => r.name === 'fo')!.cloud).toEqual({ state: 'idle', activity: 'Calling Hair Lab' })
+ expect(rows.find((r) => r.name === 'lead')).not.toHaveProperty('cloud')
+ expect(rowsOf([asleep], { machineId: 'm', machine: 'mac', caller: null, ledger: ledger(), now: NOW, all: false })).toEqual([])
+ })
+
it('names every agent as the app does, never by its id', () => {
// `harness ps` listed a Kilo harness as "kilo": the table here knew six agents and passed the rest through.
const named = (engine: string) => rowsOf([frame('a', { engine })], { machineId: 'm', machine: 'mac', caller: null, ledger: ledger(), now: NOW, all: false })[0]!.agent
diff --git a/cli/src/agentClient/model.ts b/cli/src/agentClient/model.ts
index 2c5955416..6294d99a9 100644
--- a/cli/src/agentClient/model.ts
+++ b/cli/src/agentClient/model.ts
@@ -25,7 +25,13 @@ export interface Frame {
/** `cloud`: a harness in its maker's cloud (lib/cloudAgents.ts), with no pane and no session. Its state and words are
* the cloud service's: `cloud.state` and `cloud_transcript`. */
location?: string
- cloud?: { state?: string; links?: Array<{ label: string; url: string }> } | null
+ cloud?: {
+ state?: string
+ activity?: string | null
+ links?: Array<{ label: string; url: string }>
+ /** The maker's own status. Absent for a harness saved before it was kept, and for Fo and Cursor. */
+ providerStatus?: { status?: string | null; detail?: string | null } | null
+ } | null
}
/** The agent running the verb: a harness in its own pane, or an agent outside Harness. Null for a person at a terminal. */
@@ -60,6 +66,15 @@ export interface Row {
/** The person's last asks and the last turns' summaries, newest first, when the daemon has them. */
asks?: string[]
about?: string
+ /** A cloud harness's maker state, beside [state]. Absent for a harness on this machine. */
+ cloud?: CloudMeta
+}
+
+/** What `ps`, `show` and `wait` JSON say about a cloud harness, beside Harness's own state. */
+export interface CloudMeta {
+ state: string
+ activity: string | null
+ providerStatus?: { status: string | null; detail: string | null }
}
/** How long a stopped harness stays one to list: what ⌘B offers (desktop task_route.dart `stoppedSessionsWithin`). */
@@ -73,6 +88,17 @@ const CLOUD_STATES: Record<string, State> = {
starting: 'starting', working: 'working', needs_input: 'needs-input', idle: 'idle', failed: 'failed', stopped: 'stopped',
}
+/** A cloud harness's maker state from its frame, for `ps`, `show` and `wait` JSON. Nothing for any other harness,
+ * and no `providerStatus` when the frame has none: an older harness, or Fo and Cursor. */
+export function cloudMeta(frame: Frame): CloudMeta | undefined {
+ if (frame.location !== 'cloud' || !frame.cloud || typeof frame.cloud.state !== 'string') return undefined
+ const raw = frame.cloud.providerStatus
+ const providerStatus = raw && typeof raw === 'object'
+ ? { status: typeof raw.status === 'string' ? raw.status : null, detail: typeof raw.detail === 'string' ? raw.detail : null }
+ : undefined
+ return { state: frame.cloud.state, activity: typeof frame.cloud.activity === 'string' ? frame.cloud.activity : null, ...(providerStatus ? { providerStatus } : {}) }
+}
+
export function stateOf(frame: Frame): State {
if (frame.status === 'stopped') return 'stopped'
if (frame.status === 'offline') return 'offline'
@@ -139,6 +165,7 @@ export function rowsOf(frames: Frame[], ctx: RowContext): Row[] {
const state = stateOf(frame)
const last = frame.updatedAt ? Date.parse(frame.updatedAt) : NaN
if (state === 'stopped' && (!ctx.all || !(ctx.now - last < STOPPED_WITHIN_MS))) continue
+ const cloud = cloudMeta(frame)
const member = { machineId: ctx.machineId, agentId: frame.id }
const you = ctx.caller?.agentId === frame.id && ctx.caller.machineId === ctx.machineId
const parent = ctx.ledger.parentOf(member)
@@ -155,6 +182,7 @@ export function rowsOf(frames: Frame[], ctx: RowContext): Row[] {
yours,
self: you,
lastActive: Number.isFinite(last) ? new Date(last).toISOString() : null,
+ ...(cloud ? { cloud } : {}),
})
}
// Working first, then by last activity: what an agent choosing where work goes looks at first.
diff --git a/cli/src/cloud/adapters.spec.ts b/cli/src/cloud/adapters.spec.ts
index da92c8bdf..44dda8a35 100644
--- a/cli/src/cloud/adapters.spec.ts
+++ b/cli/src/cloud/adapters.spec.ts
@@ -121,10 +121,10 @@ describe('Devin Cloud', () => {
])
const devin = devinAdapter(bridge, async () => 'devin')
const started = await devin.start({ task: 'fix it', repository: 'acme/api', options: {} })
- expect(started).toEqual({ remote: { id: 'devin-9' }, links: [{ label: 'Session', url: 'https://app.devin.ai/s/9' }], update: { messages: [], state: 'starting' } })
+ expect(started).toEqual({ remote: { id: 'devin-9' }, links: [{ label: 'Session', url: 'https://app.devin.ai/s/9' }], update: { messages: [], state: 'starting', providerStatus: { status: 'new', detail: null } } })
expect(calls[1]).toEqual(['POST', '/v3/organizations/org-1/sessions', { prompt: 'fix it', repos: ['acme/api'], max_acu_limit: DEFAULT_ACU_LIMIT, title: 'fix it' }])
const update = await devin.poll({ id: 'devin-9' })
- expect(update).toMatchObject({ messages: [{ id: 'e2', text: 'Which branch?', at: 't1' }], state: 'needs_input', question: { text: 'Which branch?', choices: [] }, remote: { cursor: 'c1' } })
+ expect(update).toMatchObject({ messages: [{ id: 'e2', text: 'Which branch?', at: 't1' }], state: 'needs_input', question: { text: 'Which branch?', choices: [] }, remote: { cursor: 'c1' }, providerStatus: { status: 'running', detail: 'waiting_for_user' } })
expect(calls.slice(2).map(([method, path]) => `${method} ${path}`)).toEqual([
'GET /v3/organizations/org-1/sessions/devin-9',
'GET /v3/organizations/org-1/sessions/devin-9/messages?first=100',
@@ -142,7 +142,7 @@ describe('Devin Cloud', () => {
{ status: 401, json: {} },
])
const devin = devinAdapter(bridge, async () => 'devin')
- expect(await devin.poll({ id: 'd', cursor: 'c0' })).toMatchObject({ state: 'failed', activity: 'It reached its ACU limit.', question: null, remote: { cursor: 'c0' } })
+ expect(await devin.poll({ id: 'd', cursor: 'c0' })).toMatchObject({ state: 'failed', activity: 'It reached its ACU limit.', question: null, remote: { cursor: 'c0' }, providerStatus: { status: 'suspended', detail: 'usage_limit_exceeded' } })
await devin.send({ id: 'd' }, 'go on')
await devin.stop!({ id: 'd' })
expect(calls.slice(3)).toEqual([['POST', '/v3/organizations/org-1/sessions/d/messages', { message: 'go on' }], ['POST', '/v3/organizations/org-1/sessions/d/archive', undefined]])
@@ -156,7 +156,44 @@ describe('Devin Cloud', () => {
expect(calls[1][2]).toEqual({ prompt: 't', max_acu_limit: 2, title: 't' })
const waiting = apiBridge([{ json: { org_id: 'o' } }, { json: { status: 'running', status_detail: 'waiting_for_approval' } }, { json: { items: [] } }])
// Waiting with nothing new said: the question already asked stands (the service asks one if none was).
- expect((await devinAdapter(waiting.bridge, async () => 'd').poll({ id: 'x' })).question).toBeUndefined()
+ const polled = await devinAdapter(waiting.bridge, async () => 'd').poll({ id: 'x' })
+ expect(polled.question).toBeUndefined()
+ expect(polled).toMatchObject({ state: 'needs_input', providerStatus: { status: 'running', detail: 'waiting_for_approval' } })
+ })
+
+ it('keeps Devin\'s own status beside Harness\'s, and a stop is not a finished task', async () => {
+ const steps: Array<{ status: string; detail?: string; state: string; activity: string | null }> = [
+ { status: 'running', detail: 'working', state: 'working', activity: null },
+ { status: 'running', detail: 'finished', state: 'idle', activity: null },
+ { status: 'running', detail: 'waiting_for_user', state: 'needs_input', activity: null },
+ { status: 'running', detail: 'waiting_for_approval', state: 'needs_input', activity: null },
+ { status: 'suspended', detail: 'inactivity', state: 'stopped', activity: 'Devin went to sleep after inactivity.' },
+ { status: 'suspended', detail: 'user_request', state: 'stopped', activity: 'The session was stopped by request.' },
+ { status: 'suspended', detail: 'usage_limit_exceeded', state: 'failed', activity: 'It reached its ACU limit.' },
+ { status: 'suspended', detail: 'out_of_quota', state: 'failed', activity: 'The Devin account is out of quota.' },
+ { status: 'suspended', detail: 'payment_declined', state: 'failed', activity: 'Devin declined the payment.' },
+ { status: 'error', state: 'failed', activity: null },
+ { status: 'exit', state: 'idle', activity: null },
+ { status: 'paused', detail: 'not_a_known_detail', state: 'working', activity: null },
+ ]
+ const answers: Array<{ json: Record<string, unknown> }> = [{ json: { org_id: 'org-1' } }]
+ for (const step of steps) {
+ answers.push({ json: { status: step.status, ...(step.detail ? { status_detail: step.detail } : {}) } })
+ answers.push({ json: { items: [] } })
+ }
+ // A progress message on a stop, then an empty page: neither one is a finished task.
+ answers.push({ json: { status: 'suspended', status_detail: 'user_request' } }, { json: { items: [{ event_id: 'e9', source: 'devin', message: 'I drafted a plan.', created_at: 't9' }] } })
+ answers.push({ json: { status: 'suspended', status_detail: 'inactivity' } }, { json: { items: [] } })
+ const devin = devinAdapter(apiBridge(answers).bridge, async () => 'devin')
+ for (const step of steps) {
+ expect(await devin.poll({ id: 'd' })).toMatchObject({
+ state: step.state, activity: step.activity, providerStatus: { status: step.status, detail: step.detail ?? null },
+ })
+ }
+ const said = await devin.poll({ id: 'd' })
+ expect(said).toMatchObject({ state: 'stopped', activity: 'The session was stopped by request.', messages: [{ text: 'I drafted a plan.' }], providerStatus: { status: 'suspended', detail: 'user_request' } })
+ expect(said.state).not.toBe('idle')
+ expect(await devin.poll({ id: 'd' })).toMatchObject({ state: 'stopped', messages: [], activity: 'Devin went to sleep after inactivity.', providerStatus: { status: 'suspended', detail: 'inactivity' } })
})
})
diff --git a/cli/src/cloud/devin.ts b/cli/src/cloud/devin.ts
index 80d8949c2..53ec1d7be 100644
--- a/cli/src/cloud/devin.ts
+++ b/cli/src/cloud/devin.ts
@@ -3,7 +3,9 @@
* organization the key belongs to (`GET /v3/self`), read by its status and its messages, every few seconds
* while someone watches. `status` + `status_detail` say where it is: `running`/`working`, waiting on the
* person (`waiting_for_user`, `waiting_for_approval`), `finished`, or `suspended` (asleep: Stop archives
- * it, and a message wakes it). It bills ACUs while it works, so every session gets a limit.
+ * it, and a message wakes it). Those two strings are kept beside Harness's state: `finished` and a wait,
+ * and a sleep and a stop, can share a normalized state, and a message's words do not say which. It bills
+ * ACUs while it works, so every session gets a limit.
*/
import { CLOUD_AGENTS, type CloudState } from '../lib/cloudAgents.js'
import { refusal, type Bridge } from './bridge.js'
@@ -30,6 +32,12 @@ export function devinState(status: unknown, detail: unknown): CloudState {
const SUSPENDED: Record<string, string> = {
usage_limit_exceeded: 'It reached its ACU limit.', out_of_credits: 'The Devin account is out of credits.', out_of_quota: 'The Devin account is out of quota.',
payment_declined: 'Devin declined the payment.', org_usage_limit_exceeded: 'The organization reached its ACU limit.',
+ inactivity: 'Devin went to sleep after inactivity.', user_request: 'The session was stopped by request.',
+}
+
+/** Devin's own status. Missing values are null so the next look replaces the pair instead of keeping a stale detail. */
+function providerStatus(session: Json): NonNullable<CloudUpdate['providerStatus']> {
+ return { status: str(session.status), detail: str(session.status_detail) }
}
export function devinLinks(session: Json): CloudLink[] {
@@ -67,7 +75,7 @@ export function devinAdapter(bridge: Bridge, code: () => Promise<string>): Cloud
})
const id = str(session.session_id)
if (!id) throw refusal(NAME, 502, { detail: 'No session was made.' })
- return { remote: { id }, links: devinLinks(session), update: { messages: [], state: devinState(session.status, session.status_detail) } }
+ return { remote: { id }, links: devinLinks(session), update: { messages: [], state: devinState(session.status, session.status_detail), providerStatus: providerStatus(session) } }
},
async send(remote, text) {
await call('POST', `${await base()}/${encodeURIComponent(remote.id)}/messages`, { message: text })
@@ -91,6 +99,7 @@ export function devinAdapter(bridge: Bridge, code: () => Promise<string>): Cloud
return {
messages,
state,
+ providerStatus: providerStatus(session),
activity: session.status === 'suspended' ? SUSPENDED[String(session.status_detail)] ?? null : null,
// Asked from Devin's newest words; with none new, the question already asked stands (cloud/service.ts).
question: state !== 'needs_input' ? null : lastWords ? { text: lastWords.slice(0, 500), choices: [] } : undefined,
diff --git a/cli/src/cloud/service.spec.ts b/cli/src/cloud/service.spec.ts
index 84b4e33bf..f3537219f 100644
--- a/cli/src/cloud/service.spec.ts
+++ b/cli/src/cloud/service.spec.ts
@@ -289,6 +289,59 @@ describe('a cloud harness', () => {
service.stop()
})
+ it('keeps the maker\'s status beside its own, and drops it when the person writes or stops', async () => {
+ const devin = maker({ start: vi.fn(async () => ({ remote: { id: 'devin-1' }, links: [], update: { messages: [], state: 'starting' as const, providerStatus: { status: 'new', detail: null } } })) })
+ const service = start({ 'devin-cloud': devin })
+ await service.port.create({ engine: 'devin-cloud', prompt: 'fix it', repository: 'acme/api' })
+ const agentId = published()[0].agentId
+ const file = join(dataDir, 'cloud', 'harnesses.json')
+ expect(published()[0].providerStatus).toEqual({ status: 'new', detail: null })
+ expect(JSON.parse(readFileSync(file, 'utf8')).harnesses[0].harness.providerStatus).toEqual({ status: 'new', detail: null })
+ // No new messages: the status still moves, and a detail that went away does not stay.
+ devin.looks.push({ messages: [], providerStatus: { status: 'running', detail: 'working' } })
+ devin.looks.push({ messages: [], providerStatus: { status: 'running', detail: null } })
+ await tick()
+ expect(published()[0]).toMatchObject({ state: 'starting', providerStatus: { status: 'running', detail: null } })
+ devin.looks.push({ messages: [{ id: 'm1', text: 'Done.', at: 'x' }], state: 'idle', providerStatus: { status: 'running', detail: 'finished' } })
+ await tick()
+ expect(published()[0]).toMatchObject({ state: 'idle', providerStatus: { status: 'running', detail: 'finished' } })
+ service.stop()
+ doors.publish.mockClear()
+ const again = start({ 'devin-cloud': devin })
+ again.republish()
+ expect(published()[0].providerStatus).toEqual({ status: 'running', detail: 'finished' })
+ // A harness saved before this field existed is still a harness.
+ const saved = JSON.parse(readFileSync(file, 'utf8'))
+ delete saved.harnesses[0].harness.providerStatus
+ writeFileSync(file, JSON.stringify(saved))
+ again.stop()
+ const restarted = start({ 'devin-cloud': devin })
+ restarted.republish()
+ expect(published()[0].providerStatus).toBeUndefined()
+ expect(published()[0]).toMatchObject({ agentId, state: 'idle' })
+ devin.looks.push({ messages: [], state: 'working', providerStatus: { status: 'running', detail: 'working' } })
+ expect(await restarted.port.deliver(agentId, 'go on')).toEqual({ ok: true })
+ await tick()
+ expect(published()[0].providerStatus).toEqual({ status: 'running', detail: 'working' })
+ doors.ask.mockClear()
+ expect(await restarted.port.deliver(agentId, 'and more')).toEqual({ ok: true })
+ expect(published()[0].providerStatus).toBeUndefined()
+ // The wait just answered is not asked again. The status on that look still replaces the one the send cleared.
+ devin.looks.push({ messages: [], state: 'needs_input', question: { text: 'Which branch?', choices: [] }, providerStatus: { status: 'running', detail: 'waiting_for_user' } })
+ await tick()
+ expect(doors.ask).not.toHaveBeenCalled()
+ expect(published()[0]).toMatchObject({ state: 'working', providerStatus: { status: 'running', detail: 'waiting_for_user' } })
+ devin.looks.push({ messages: [{ id: 'm2', text: 'I drafted a plan.', at: 'x' }], state: 'stopped', activity: 'The session was stopped by request.', providerStatus: { status: 'suspended', detail: 'user_request' } })
+ await tick()
+ expect(published()[0]).toMatchObject({ state: 'stopped', activity: 'The session was stopped by request.', providerStatus: { status: 'suspended', detail: 'user_request' } })
+ expect(restarted.transcript(agentId).some((message) => message.text === 'I drafted a plan.')).toBe(true)
+ await restarted.port.stopHarness(agentId)
+ expect(published()[0]).toMatchObject({ state: 'stopped' })
+ expect(published()[0].providerStatus).toBeUndefined()
+ expect(JSON.parse(readFileSync(file, 'utf8')).harnesses[0].harness.providerStatus).toBeUndefined()
+ restarted.stop()
+ })
+
it('stops looking at one unchanged for a day', async () => {
const devin = maker()
const service = start({ 'devin-cloud': devin })
@@ -336,7 +389,7 @@ describe('what the review found', () => {
const devin = maker()
const service = start({ 'devin-cloud': devin })
await service.port.create({ engine: 'devin-cloud', prompt: 'fix it', repository: 'acme/api' })
- devin.looks.push({ messages: [{ id: 'm1', text: 'Done.', at: 'x' }], state: 'idle', activity: null })
+ devin.looks.push({ messages: [{ id: 'm1', text: 'Done.', at: 'x' }], state: 'idle', activity: null, providerStatus: { status: 'running', detail: 'finished' } })
await tick()
const agentId = published()[0].agentId
expect(published()[0].state).toBe('idle')
@@ -345,14 +398,15 @@ describe('what the review found', () => {
const sent = service.port.deliver(agentId, 'and the docs')
await new Promise((resolve) => setTimeout(resolve, 0))
expect(published()[0]).toMatchObject({ state: 'working', activity: null })
+ expect(published()[0].providerStatus).toBeUndefined()
release()
expect(await sent).toEqual({ ok: true })
expect([...timers.values()].map((timer) => timer.ms)).toEqual([2_000])
- devin.looks.push({ messages: [{ id: 'm2', text: 'Docs too.', at: 'x' }], state: 'idle', activity: 'Finished' })
+ devin.looks.push({ messages: [{ id: 'm2', text: 'Docs too.', at: 'x' }], state: 'idle', activity: 'Finished', providerStatus: { status: 'running', detail: 'finished' } })
await tick()
devin.send = vi.fn(async () => { throw new CloudError('BUSY', 'Devin Cloud is still working.') })
expect(await service.port.deliver(agentId, 'more')).toMatchObject({ ok: false, error: 'BUSY' })
- expect(published()[0]).toMatchObject({ state: 'idle', activity: 'Finished' })
+ expect(published()[0]).toMatchObject({ state: 'idle', activity: 'Finished', providerStatus: { status: 'running', detail: 'finished' } })
// Not saved while it was only told.
expect(JSON.parse(readFileSync(join(dataDir, 'cloud', 'harnesses.json'), 'utf8')).harnesses[0].harness.state).toBe('idle')
service.stop()
diff --git a/cli/src/cloud/service.ts b/cli/src/cloud/service.ts
index e9bd4cc86..3ff23b56e 100644
--- a/cli/src/cloud/service.ts
+++ b/cli/src/cloud/service.ts
@@ -170,6 +170,9 @@ export function startCloudService(options: CloudServiceOptions) {
if (update.state === 'needs_input' && !entry.heard) update = { ...update, state: undefined, question: undefined }
if (update.state) entry.harness.state = update.state
if (update.activity !== undefined) entry.harness.activity = update.activity
+ // Refreshed even when this look brought no messages, and when its "waiting" was the wait just answered.
+ // A null detail replaces the old one: the maker no longer reports it.
+ if (update.providerStatus) entry.harness.providerStatus = { status: update.providerStatus.status, detail: update.providerStatus.detail }
if (update.branch !== undefined) entry.harness.branch = update.branch
if (update.links) entry.harness.links = update.links
if (update.remote) entry.remote = { ...entry.remote, ...update.remote }
@@ -289,9 +292,12 @@ export function startCloudService(options: CloudServiceOptions) {
// Working from the moment the words go, as a terminal agent's turn starts with its prompt: Fo answers
// `ask_fo` with its whole reply, 15 s later, and the dial sat on the last recap all that time (2026-10-11).
// Told, not saved: refused, it is back where it was.
- const was = { state: entry.harness.state, activity: entry.harness.activity }
+ const was = { state: entry.harness.state, activity: entry.harness.activity, providerStatus: entry.harness.providerStatus }
entry.harness.state = 'working'
entry.harness.activity = null
+ // The status from before these words is not this turn's. It stands again when the next look says so;
+ // a refused send puts the old one back, because the maker never took the words.
+ delete entry.harness.providerStatus
publish()
const adapter = adapters[entry.harness.agent]
try {
@@ -299,6 +305,7 @@ export function startCloudService(options: CloudServiceOptions) {
if (moved) entry.remote = { ...entry.remote, ...moved }
} catch (error) {
Object.assign(entry.harness, was)
+ if (!was.providerStatus) delete entry.harness.providerStatus
publish()
return refused(error, entry.harness.agent)
}
@@ -346,6 +353,8 @@ export function startCloudService(options: CloudServiceOptions) {
timers.delete(agentId)
entry.harness.state = 'stopped'
entry.harness.activity = adapter.stop ? null : `${CLOUD_AGENTS[entry.harness.agent].name} keeps working on its own.`
+ // A local stop is not the maker's last report. Showing that report would call a finished session current.
+ delete entry.harness.providerStatus
ask(entry, null)
touched(entry)
return adapter.stop ? { ok: true } : { ok: true, detail: `${CLOUD_AGENTS[entry.harness.agent].name} keeps working on its own.` }
diff --git a/cli/src/cloud/types.ts b/cli/src/cloud/types.ts
index b8dc14b40..a018cce9d 100644
--- a/cli/src/cloud/types.ts
+++ b/cli/src/cloud/types.ts
@@ -3,7 +3,7 @@
* translates between Harness and one maker's API. The service (cloud/service.ts) does the rest: the
* harnesses and their transcripts, how often to look, the questions, and what the core is told.
*/
-import type { CloudAgentId, CloudState } from '../lib/cloudAgents.js'
+import type { CloudAgentId, CloudProviderStatus, CloudState } from '../lib/cloudAgents.js'
export interface CloudLink { label: string; url: string }
@@ -25,6 +25,8 @@ export interface CloudUpdate {
messages: CloudMessage[]
state?: CloudState
activity?: string | null
+ /** The maker's own status and detail, when this look read them. A null field is a reading, not "leave the old one". */
+ providerStatus?: CloudProviderStatus
/** The agent waits on the person: what it asks, with the choices it offers. Absent: the question already asked stands. */
question?: { text: string; choices: string[] } | null
branch?: string | null
diff --git a/cli/src/lib/cloudAgents.spec.ts b/cli/src/lib/cloudAgents.spec.ts
index c52f42d7e..c22e69aeb 100644
--- a/cli/src/lib/cloudAgents.spec.ts
+++ b/cli/src/lib/cloudAgents.spec.ts
@@ -23,6 +23,14 @@ describe('cloud agents', () => {
expect(cloudHarnessIn({ ...harness, name: '', activity: 5, repository: '', links: [{ label: 'x', url: 'http://no' }, { url: 'https://a' }, null], messages: -1 }))
.toMatchObject({ name: 'Devin Cloud', activity: null, repository: null, links: [], messages: 0 })
expect(cloudHarnessIn({ ...harness, links: 'x', messages: 1.5 })).toMatchObject({ links: [], messages: 0 })
+ // An older harness has no maker status. A bad one is dropped or cut down, and the harness still stands.
+ expect(cloudHarnessIn(harness)).not.toHaveProperty('providerStatus')
+ expect(cloudHarnessIn({ ...harness, providerStatus: 'nope' })).toEqual({ ...harness, said: null })
+ expect(cloudHarnessIn({ ...harness, providerStatus: ['suspended'] })).toEqual({ ...harness, said: null })
+ expect(cloudHarnessIn({ ...harness, providerStatus: { status: ` ${'s'.repeat(400)}`, detail: 3 } })!.providerStatus)
+ .toEqual({ status: 's'.repeat(200), detail: null })
+ expect(cloudHarnessIn({ ...harness, providerStatus: { status: 'suspended', detail: null } })!.providerStatus)
+ .toEqual({ status: 'suspended', detail: null })
})
// What it said stays in the core: the apps read the whole conversation.
@@ -37,6 +45,9 @@ describe('cloud agents', () => {
gitContext: { state: 'workspace' },
cloud: { place: "Devin's cloud", state: 'working', activity: null, links: harness.links, messages: 3 },
})
+ expect(cloudAgentFrame(harness).cloud).not.toHaveProperty('providerStatus')
+ expect(cloudAgentFrame({ ...harness, providerStatus: { status: 'running', detail: null } }).cloud.providerStatus)
+ .toEqual({ status: 'running', detail: null })
expect(cloudAgentFrame({ ...harness, state: 'stopped', repository: null })).toMatchObject({ status: 'stopped', project: null, gitContext: { state: 'unavailable', current: null }, activity: { state: 'idle', validForMs: 0 } })
expect(cloudAgentFrame({ ...harness, state: 'starting' }).launch).toEqual({ state: 'starting' })
expect(cloudAgentFrame({ ...harness, state: 'failed' }).launch).toEqual({ state: 'failed', error: 'CLOUD_FAILED', detail: 'Devin Cloud stopped with an error.' })
diff --git a/cli/src/lib/cloudAgents.ts b/cli/src/lib/cloudAgents.ts
index abe2af58e..d2d551573 100644
--- a/cli/src/lib/cloudAgents.ts
+++ b/cli/src/lib/cloudAgents.ts
@@ -51,6 +51,16 @@ export function isCloudAgent(id: unknown): id is CloudAgentId {
export type CloudState = 'starting' | 'working' | 'needs_input' | 'idle' | 'failed' | 'stopped'
export const CLOUD_STATES: readonly CloudState[] = ['starting', 'working', 'needs_input', 'idle', 'failed', 'stopped']
+/**
+ * The maker's own status, beside Harness's. A null is a reading where the maker gave none, so a later look
+ * can drop a detail that went away. It does not say whether the words in the transcript were a question:
+ * Devin's `finished` and a wait can look the same, and the text is not a status.
+ */
+export interface CloudProviderStatus {
+ status: string | null
+ detail: string | null
+}
+
/** One cloud harness, as the cloud service tells the core about it (`core.cloud.publish`). */
export interface CloudHarness {
/** Harness's own id for it, `cloud_…`: never the vendor's session id, which the service keeps. */
@@ -60,6 +70,8 @@ export interface CloudHarness {
state: CloudState
/** What it is doing, in a line ("Calling Hair Lab"), or null. */
activity: string | null
+ /** The maker's own status. Absent on a harness saved before it was kept, and for a maker that does not report one. */
+ providerStatus?: CloudProviderStatus
/** The GitHub repository a coding agent works on (`owner/name`), or null. */
repository: string | null
branch: string | null
@@ -76,10 +88,19 @@ export interface CloudHarness {
/** As much of its last words as the dial's longest card draws, and some over (lib/deviceRecap.ts). */
export const SAID_MAX = 4_000
+/** A maker's own status string on the way into the core: long enough for an unknown detail, and no more. */
+const PROVIDER_STATUS_MAX = 200
const text = (value: unknown, max = 500): string | null => (typeof value === 'string' && value.trim() ? value.trim().slice(0, max) : null)
const stamp = (value: unknown): string | null => (typeof value === 'string' && Number.isFinite(Date.parse(value)) ? value : null)
+/** A maker's status beside the harness, or nothing when it is absent or not an object. A bad field is dropped, not the harness. */
+function providerStatusIn(raw: unknown): CloudProviderStatus | undefined {
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return undefined
+ const value = raw as Record<string, unknown>
+ return { status: text(value.status, PROVIDER_STATUS_MAX), detail: text(value.detail, PROVIDER_STATUS_MAX) }
+}
+
/** A harness as a service reported it, or null for anything else: the core keeps nothing it cannot read. */
export function cloudHarnessIn(raw: unknown): CloudHarness | null {
if (!raw || typeof raw !== 'object') return null
@@ -92,12 +113,14 @@ export function cloudHarnessIn(raw: unknown): CloudHarness | null {
const label = text(entry?.label, 80), url = text(entry?.url, 2048)
return label && url && /^https:\/\//.test(url) ? [{ label, url }] : []
}).slice(0, 8) : []
+ const providerStatus = providerStatusIn(value.providerStatus)
return {
agentId,
agent: value.agent,
name: text(value.name, 120) ?? CLOUD_AGENTS[value.agent].name,
state: value.state as CloudState,
activity: text(value.activity, 200),
+ ...(providerStatus ? { providerStatus } : {}),
repository: text(value.repository, 200),
branch: text(value.branch, 200),
links,
@@ -115,6 +138,8 @@ export interface CloudFrameBlock {
activity: string | null
links: { label: string; url: string }[]
messages: number
+ /** Absent when the harness has no maker status (an older one, or Fo and Cursor). */
+ providerStatus?: CloudProviderStatus
}
export type CloudAgentFrame = Omit<AgentFrame, 'engine'> & { engine: CloudAgentId; location: 'cloud'; cloud: CloudFrameBlock }
@@ -170,6 +195,9 @@ export function cloudAgentFrame(harness: CloudHarness): CloudAgentFrame {
bypassPermission: null,
namedAgent: null,
location: 'cloud',
- cloud: { place: CLOUD_AGENTS[harness.agent].place, state: harness.state, activity: harness.activity, links: harness.links, messages: harness.messages },
+ cloud: {
+ place: CLOUD_AGENTS[harness.agent].place, state: harness.state, activity: harness.activity, links: harness.links, messages: harness.messages,
+ ...(harness.providerStatus ? { providerStatus: { status: harness.providerStatus.status, detail: harness.providerStatus.detail } } : {}),
+ },
}
}