MCPcopy Create free account
hub / github.com/Facets-cloud/flow / bgAgentsJSON

Function bgAgentsJSON

internal/app/background_test.go:46–63  ·  view source on GitHub ↗

bgAgentsJSON builds a `claude agents --json` array of LIVE entries (pid set) — one per session id (short id = first 8 chars).

(sids ...string)

Source from the content-addressed store, hash-verified

44// bgAgentsJSON builds a `claude agents --json` array of LIVE entries
45// (pid set) — one per session id (short id = first 8 chars).
46func bgAgentsJSON(sids ...string) string {
47 var b strings.Builder
48 b.WriteString("[")
49 for i, sid := range sids {
50 if i > 0 {
51 b.WriteString(",")
52 }
53 short := sid
54 if len(short) >= 8 {
55 short = short[:8]
56 }
57 fmt.Fprintf(&b,
58 `{"pid":%d,"id":%q,"cwd":"/w","kind":"background","startedAt":1,"sessionId":%q,"name":"n","status":"busy","state":"working"}`,
59 1000+i, short, sid)
60 }
61 b.WriteString("]")
62 return b.String()
63}
64
65// bgAgentsJSONExited builds a registry entry for an exited session (no
66// pid / status — `state` only), as `claude agents --json --all` reports a

Calls 1

StringMethod · 0.80

Tested by

no test coverage detected