beeos-claw 0.6.50-staging.2 → 0.6.50-staging.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -38,6 +38,40 @@ The agent initiates an outbound WebSocket connection to the Bridge server (Phone
38
38
 
39
39
  Requires both `bridge.url` and `bridge.keyFile` to be configured.
40
40
 
41
+ ## Run Output Routing
42
+
43
+ Process ownership is separate from protocol adaptation. `index.ts` composes
44
+ the one OpenClaw Gateway source, Agent Projection worker, Agent Mapping
45
+ registry, Message Service client, and output-router policy. For output
46
+ composition, `ACPServer` subscribes to those ports and contributes only the ACP
47
+ adapter; it does not create or stop the process Gateway/Projection and does not
48
+ own Message Service or Agent Mapping state.
49
+
50
+ Gateway output is normalized once and projected through an immutable,
51
+ run-scoped channel plan. ACP and Message Service implement the same lifecycle:
52
+ `open`, append-only `project` deltas, then one `terminal` operation. Wire-format
53
+ conversion belongs to the channel adapter; ownership and routing never do.
54
+ Run-domain completion is a separate lifecycle port invoked once alongside
55
+ terminal fan-out, so neither channel adapter owns session cleanup.
56
+
57
+ The channel plan is created only when run ownership is known:
58
+
59
+ | Run ownership | Output plan |
60
+ |---|---|
61
+ | ACP prompt or internal `agentSend` | ACP |
62
+ | Adopted background run with an originating conversation | ACP + Message Service |
63
+ | Run already owned by interactive Message Service dispatch | ACP observation only; the dispatch remains the single Message Service writer |
64
+ | Cron run | ACP plus the existing dedicated cron delivery path; never the background Message Service adapter |
65
+
66
+ Projection, upload, terminal, and persisted-message reconciliation require an
67
+ existing route and cannot create or mutate one. Background dual-channel runs
68
+ wait for the matching persisted-message reconciliation revision before
69
+ terminal fan-out. Persistence reconciliation is pending from route creation,
70
+ including runs with no live chunks, and has its own 10-second deadline; upload
71
+ and other async work retain the general settlement budget. A late
72
+ reconciliation after route closure is reported and never reopens an ACP-only
73
+ route.
74
+
41
75
  ## Configuration
42
76
 
43
77
  Configuration is resolved from three sources in priority order:
@@ -0,0 +1 @@
1
+ import{toAcpRunOutputUpdate}from"./acp-run-output-mapper.js";export class AcpRunOutputChannel{deps;id="acp";constructor(s){this.deps=s}open(s){}project(s,t){this.session(s).sessionLoadInProgress||this.deps.transport.sendSessionUpdate(s.sessionId,toAcpRunOutputUpdate(t),{turnId:s.runId})}async terminal(s,t,e){}session(s){const t=this.deps.state.sessions.get(s.sessionId);if(!t||t.gatewaySessionKey!==s.gatewaySessionKey)throw new Error(`ACP run output session unavailable: ${s.sessionId}`);return t}}
@@ -0,0 +1 @@
1
+ export function fromAcpRunOutputUpdate(t){const e={...t.timestamp?{timestamp:t.timestamp}:{},...void 0!==t._seq?{sequence:t._seq}:{},...t.messageId?{messageId:String(t.messageId)}:{}};switch(t.sessionUpdate){case"agent_message_chunk":return{type:"assistant_delta",content:t.content,...t.metadata?{metadata:t.metadata}:{},...e};case"agent_thought_chunk":return{type:"thought_chunk",content:t.content,...e};case"tool_call":return{type:"tool_call",toolCallId:String(t.toolCallId),title:t.title,...t.name?{name:t.name}:{},...t.kind?{toolKind:t.kind}:{},status:t.status,...void 0!==t.arguments?{arguments:t.arguments}:{},...void 0!==t.rawInput?{rawInput:t.rawInput}:{},...void 0!==t.output?{output:t.output}:{},...void 0!==t.content?{content:t.content}:{},...e};case"tool_call_update":return{type:"tool_call_update",toolCallId:String(t.toolCallId),...t.name?{name:t.name}:{},...t.title?{title:t.title}:{},...t.kind?{toolKind:t.kind}:{},status:t.status,...void 0!==t.output?{output:t.output}:{},...void 0!==t.result?{result:t.result}:{},...void 0!==t.text?{text:t.text}:{},...void 0!==t.content?{content:t.content}:{},...void 0!==t.rawOutput?{rawOutput:t.rawOutput}:{},...e};default:return}}export function toAcpRunOutputUpdate(t){const e={...t.timestamp?{timestamp:t.timestamp}:{},...void 0!==t.sequence?{_seq:t.sequence}:{},...t.messageId?{messageId:t.messageId}:{}};switch(t.type){case"assistant_delta":return{sessionUpdate:"agent_message_chunk",content:t.content,...t.metadata?{metadata:t.metadata}:{},...e};case"thought_chunk":return{sessionUpdate:"agent_thought_chunk",content:t.content,...e};case"tool_call":return{sessionUpdate:"tool_call",toolCallId:t.toolCallId,title:t.title,...t.name?{name:t.name}:{},...t.toolKind?{kind:t.toolKind}:{},status:t.status,...void 0!==t.arguments?{arguments:t.arguments}:{},...void 0!==t.rawInput?{rawInput:t.rawInput}:{},...void 0!==t.output?{output:t.output}:{},...void 0!==t.content?{content:t.content}:{},...e};case"tool_call_update":return{sessionUpdate:"tool_call_update",toolCallId:t.toolCallId,...t.name?{name:t.name}:{},...t.title?{title:t.title}:{},...t.toolKind?{kind:t.toolKind}:{},status:t.status,...void 0!==t.output?{output:t.output}:{},...void 0!==t.result?{result:t.result}:{},...void 0!==t.text?{text:t.text}:{},...void 0!==t.content?{content:t.content}:{},...void 0!==t.rawOutput?{rawOutput:t.rawOutput}:{},...e}}}