Skip to content

Commit 443ca48

Browse files
samzongfrankekn
andauthored
[Feat] surface spawnedBy in chat and agent broadcast payloads (#63244)
Merged via squash. Prepared head SHA: ff0fe5d Co-authored-by: samzong <13782141+samzong@users.noreply.github.com> Co-authored-by: frankekn <4488090+frankekn@users.noreply.github.com> Reviewed-by: @frankekn
1 parent 390a759 commit 443ca48

7 files changed

Lines changed: 482 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Docs: https://docs.openclaw.ai
1515
- Active Memory: return bounded partial recall summaries when the hidden memory sub-agent times out, including the default temporary-transcript path, so useful recovered context is not discarded. (#73219) Thanks @joeykrug.
1616
- Docker setup: add `OPENCLAW_SKIP_ONBOARDING` so automated Docker installs can skip the interactive onboarding step while still applying gateway defaults. (#55518) Thanks @jinjimz.
1717
- Gateway/memory: add a read-only `doctor.memory.remHarness` RPC so operator clients can preview bounded REM dreaming output without running mutation paths. (#66673) Thanks @samzong.
18+
- Gateway/events: surface `spawnedBy` on subagent chat and agent broadcast payloads so clients can route child session events without an extra session lookup. (#63244) Thanks @samzong.
1819

1920
### Fixes
2021

apps/macos/Sources/OpenClawProtocol/GatewayModels.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,19 +385,22 @@ public struct AgentEvent: Codable, Sendable {
385385
public let seq: Int
386386
public let stream: String
387387
public let ts: Int
388+
public let spawnedby: String?
388389
public let data: [String: AnyCodable]
389390

390391
public init(
391392
runid: String,
392393
seq: Int,
393394
stream: String,
394395
ts: Int,
396+
spawnedby: String?,
395397
data: [String: AnyCodable])
396398
{
397399
self.runid = runid
398400
self.seq = seq
399401
self.stream = stream
400402
self.ts = ts
403+
self.spawnedby = spawnedby
401404
self.data = data
402405
}
403406

@@ -406,6 +409,7 @@ public struct AgentEvent: Codable, Sendable {
406409
case seq
407410
case stream
408411
case ts
412+
case spawnedby = "spawnedBy"
409413
case data
410414
}
411415
}
@@ -4753,6 +4757,7 @@ public struct ChatInjectParams: Codable, Sendable {
47534757
public struct ChatEvent: Codable, Sendable {
47544758
public let runid: String
47554759
public let sessionkey: String
4760+
public let spawnedby: String?
47564761
public let seq: Int
47574762
public let state: AnyCodable
47584763
public let message: AnyCodable?
@@ -4764,6 +4769,7 @@ public struct ChatEvent: Codable, Sendable {
47644769
public init(
47654770
runid: String,
47664771
sessionkey: String,
4772+
spawnedby: String?,
47674773
seq: Int,
47684774
state: AnyCodable,
47694775
message: AnyCodable?,
@@ -4774,6 +4780,7 @@ public struct ChatEvent: Codable, Sendable {
47744780
{
47754781
self.runid = runid
47764782
self.sessionkey = sessionkey
4783+
self.spawnedby = spawnedby
47774784
self.seq = seq
47784785
self.state = state
47794786
self.message = message
@@ -4786,6 +4793,7 @@ public struct ChatEvent: Codable, Sendable {
47864793
private enum CodingKeys: String, CodingKey {
47874794
case runid = "runId"
47884795
case sessionkey = "sessionKey"
4796+
case spawnedby = "spawnedBy"
47894797
case seq
47904798
case state
47914799
case message

apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,19 +385,22 @@ public struct AgentEvent: Codable, Sendable {
385385
public let seq: Int
386386
public let stream: String
387387
public let ts: Int
388+
public let spawnedby: String?
388389
public let data: [String: AnyCodable]
389390

390391
public init(
391392
runid: String,
392393
seq: Int,
393394
stream: String,
394395
ts: Int,
396+
spawnedby: String?,
395397
data: [String: AnyCodable])
396398
{
397399
self.runid = runid
398400
self.seq = seq
399401
self.stream = stream
400402
self.ts = ts
403+
self.spawnedby = spawnedby
401404
self.data = data
402405
}
403406

@@ -406,6 +409,7 @@ public struct AgentEvent: Codable, Sendable {
406409
case seq
407410
case stream
408411
case ts
412+
case spawnedby = "spawnedBy"
409413
case data
410414
}
411415
}
@@ -4753,6 +4757,7 @@ public struct ChatInjectParams: Codable, Sendable {
47534757
public struct ChatEvent: Codable, Sendable {
47544758
public let runid: String
47554759
public let sessionkey: String
4760+
public let spawnedby: String?
47564761
public let seq: Int
47574762
public let state: AnyCodable
47584763
public let message: AnyCodable?
@@ -4764,6 +4769,7 @@ public struct ChatEvent: Codable, Sendable {
47644769
public init(
47654770
runid: String,
47664771
sessionkey: String,
4772+
spawnedby: String?,
47674773
seq: Int,
47684774
state: AnyCodable,
47694775
message: AnyCodable?,
@@ -4774,6 +4780,7 @@ public struct ChatEvent: Codable, Sendable {
47744780
{
47754781
self.runid = runid
47764782
self.sessionkey = sessionkey
4783+
self.spawnedby = spawnedby
47774784
self.seq = seq
47784785
self.state = state
47794786
self.message = message
@@ -4786,6 +4793,7 @@ public struct ChatEvent: Codable, Sendable {
47864793
private enum CodingKeys: String, CodingKey {
47874794
case runid = "runId"
47884795
case sessionkey = "sessionKey"
4796+
case spawnedby = "spawnedBy"
47894797
case seq
47904798
case state
47914799
case message

src/gateway/protocol/schema/agent.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export const AgentEventSchema = Type.Object(
3030
seq: Type.Integer({ minimum: 0 }),
3131
stream: NonEmptyString,
3232
ts: Type.Integer({ minimum: 0 }),
33+
spawnedBy: Type.Optional(NonEmptyString),
3334
data: Type.Record(Type.String(), Type.Unknown()),
3435
},
3536
{ additionalProperties: false },

src/gateway/protocol/schema/logs-chat.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export const ChatEventSchema = Type.Object(
7272
{
7373
runId: NonEmptyString,
7474
sessionKey: NonEmptyString,
75+
spawnedBy: Type.Optional(NonEmptyString),
7576
seq: Type.Integer({ minimum: 0 }),
7677
state: Type.Union([
7778
Type.Literal("delta"),

0 commit comments

Comments
 (0)