@swarmclawai/swarmclaw 1.5.2 → 1.5.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
@@ -255,6 +255,10 @@ SwarmClaw agents can join [SwarmFeed](https://swarmfeed.ai) — a social network
255
255
 
256
256
  Read the docs at [swarmclaw.ai/docs/swarmfeed](https://swarmclaw.ai/docs/swarmfeed) and visit [swarmfeed.ai](https://swarmfeed.ai) for the platform itself.
257
257
 
258
+ ### v1.5.3 Highlights
259
+
260
+ - **Copilot CLI v1.x compatibility**: the `copilot-cli` provider now handles the current event format (`assistant.message_delta`, `assistant.message`, updated `result` payload) while keeping backward compatibility with the legacy format. Also fixes `--resume` flag syntax. (Community contribution by [@borislavnnikolov](https://github.com/borislavnnikolov) -- PR #36)
261
+
258
262
  ### v1.5.2 Highlights
259
263
 
260
264
  - **Hosted deploy path for SwarmClaw itself**: added root-level `render.yaml`, `fly.toml`, and `railway.json` so the published `ghcr.io/swarmclawai/swarmclaw:latest` image is easier to run on always-on platforms.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swarmclawai/swarmclaw",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "Build and run autonomous AI agents with OpenClaw, Hermes, multiple model providers, orchestration, delegation, memory, skills, schedules, and chat connectors.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -46,7 +46,7 @@ export function streamCopilotCliChat({ session, message, imagePath, systemPrompt
46
46
  const prompt = promptParts.join('\n\n')
47
47
 
48
48
  const args = ['-p', prompt, '--output-format=json', '-s', '--yolo']
49
- if (session.copilotSessionId) args.push('--resume', session.copilotSessionId)
49
+ if (session.copilotSessionId) args.push(`--resume=${session.copilotSessionId}`)
50
50
  if (session.model) args.push('--model', session.model)
51
51
 
52
52
  // System prompt: write temp AGENTS.override.md in a temp config dir
@@ -106,14 +106,35 @@ export function streamCopilotCliChat({ session, message, imagePath, systemPrompt
106
106
  const ev = JSON.parse(line) as Record<string, unknown>
107
107
  eventCount++
108
108
 
109
- // Capture session ID from init event
109
+ const data = ev.data as Record<string, unknown> | undefined
110
+
111
+ // Capture session ID — legacy 'init' event or modern 'result' event
110
112
  if (ev.type === 'init' && typeof ev.session_id === 'string') {
111
113
  session.copilotSessionId = ev.session_id
112
- log.info('copilot-cli', `Got session_id: ${ev.session_id}`)
114
+ log.info('copilot-cli', `Got session_id (init): ${ev.session_id}`)
115
+ } else if (ev.type === 'result' && typeof ev.sessionId === 'string') {
116
+ session.copilotSessionId = ev.sessionId
117
+ log.info('copilot-cli', `Got session_id (result): ${ev.sessionId}`)
118
+ }
119
+
120
+ // Modern format: streaming delta — assistant.message_delta { data: { deltaContent } }
121
+ if (ev.type === 'assistant.message_delta' && typeof data?.deltaContent === 'string') {
122
+ fullResponse += data.deltaContent
123
+ write(`data: ${JSON.stringify({ t: 'd', text: data.deltaContent })}\n\n`)
124
+ }
125
+
126
+ // Modern format: full assistant message — assistant.message { data: { content } }
127
+ else if (ev.type === 'assistant.message' && typeof data?.content === 'string') {
128
+ // Only emit as final result if we haven't been streaming deltas
129
+ if (!fullResponse) {
130
+ fullResponse = data.content
131
+ write(`data: ${JSON.stringify({ t: 'r', text: data.content })}\n\n`)
132
+ }
133
+ log.debug('copilot-cli', `Assistant message (${data.content.length} chars)`)
113
134
  }
114
135
 
115
- // Streaming text deltas
116
- if (ev.type === 'content_block_delta') {
136
+ // Legacy: streaming text deltas — content_block_delta { delta: { text } }
137
+ else if (ev.type === 'content_block_delta') {
117
138
  const delta = ev.delta as Record<string, unknown> | undefined
118
139
  if (typeof delta?.text === 'string') {
119
140
  fullResponse += delta.text
@@ -121,19 +142,19 @@ export function streamCopilotCliChat({ session, message, imagePath, systemPrompt
121
142
  }
122
143
  }
123
144
 
124
- // Agent message chunks (ACP format)
145
+ // Legacy: agent message chunks (ACP format)
125
146
  else if (ev.type === 'agent_message_chunk' && typeof ev.text === 'string') {
126
147
  fullResponse += ev.text
127
148
  write(`data: ${JSON.stringify({ t: 'd', text: ev.text })}\n\n`)
128
149
  }
129
150
 
130
- // Assistant message content
151
+ // Legacy: assistant message content
131
152
  else if (ev.type === 'message' && ev.role === 'assistant' && typeof ev.content === 'string') {
132
153
  fullResponse += ev.content
133
154
  write(`data: ${JSON.stringify({ t: 'd', text: ev.content })}\n\n`)
134
155
  }
135
156
 
136
- // Completed item with agent_message
157
+ // Legacy: completed item with agent_message
137
158
  else if (ev.type === 'item.completed' && (ev.item as Record<string, unknown>)?.type === 'agent_message') {
138
159
  const item = ev.item as Record<string, unknown>
139
160
  if (typeof item.text === 'string') {
@@ -143,7 +164,7 @@ export function streamCopilotCliChat({ session, message, imagePath, systemPrompt
143
164
  }
144
165
  }
145
166
 
146
- // Final result
167
+ // Legacy: final result with string result field
147
168
  else if (ev.type === 'result' && typeof ev.result === 'string') {
148
169
  fullResponse = ev.result
149
170
  write(`data: ${JSON.stringify({ t: 'r', text: ev.result })}\n\n`)