@swarmclawai/swarmclaw 1.2.1 → 1.2.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.
Files changed (149) hide show
  1. package/README.md +16 -85
  2. package/bin/server-cmd.js +64 -1
  3. package/package.json +2 -2
  4. package/skills/coding-agent/SKILL.md +111 -0
  5. package/skills/github/SKILL.md +140 -0
  6. package/skills/nano-banana-pro/SKILL.md +62 -0
  7. package/skills/nano-banana-pro/scripts/generate_image.py +235 -0
  8. package/skills/nano-pdf/SKILL.md +53 -0
  9. package/skills/openai-image-gen/SKILL.md +78 -0
  10. package/skills/openai-image-gen/scripts/gen.py +328 -0
  11. package/skills/resourceful-problem-solving/SKILL.md +49 -0
  12. package/skills/skill-creator/SKILL.md +147 -0
  13. package/skills/skill-creator/scripts/init_skill.py +378 -0
  14. package/skills/skill-creator/scripts/quick_validate.py +159 -0
  15. package/skills/summarize/SKILL.md +77 -0
  16. package/src/app/api/auth/route.ts +20 -5
  17. package/src/app/api/chats/[id]/devserver/route.ts +13 -19
  18. package/src/app/api/chats/[id]/messages/route.ts +13 -15
  19. package/src/app/api/chats/[id]/route.ts +9 -10
  20. package/src/app/api/chats/[id]/stop/route.ts +5 -7
  21. package/src/app/api/chats/messages-route.test.ts +8 -6
  22. package/src/app/api/chats/route.ts +9 -10
  23. package/src/app/api/ip/route.ts +2 -2
  24. package/src/app/api/preview-server/route.ts +1 -1
  25. package/src/app/api/projects/[id]/route.ts +7 -46
  26. package/src/cli/server-cmd.test.js +74 -0
  27. package/src/components/chat/chat-area.tsx +45 -23
  28. package/src/components/chat/message-bubble.test.ts +35 -0
  29. package/src/components/chat/message-bubble.tsx +19 -9
  30. package/src/components/chat/message-list.tsx +37 -3
  31. package/src/components/input/chat-input.tsx +34 -14
  32. package/src/components/openclaw/openclaw-deploy-panel.tsx +4 -0
  33. package/src/instrumentation.ts +1 -1
  34. package/src/lib/chat/assistant-render-id.ts +3 -0
  35. package/src/lib/chat/chat-streaming-state.test.ts +42 -3
  36. package/src/lib/chat/chat-streaming-state.ts +20 -8
  37. package/src/lib/chat/queued-message-queue.test.ts +23 -1
  38. package/src/lib/chat/queued-message-queue.ts +11 -2
  39. package/src/lib/providers/cli-utils.test.ts +124 -0
  40. package/src/lib/server/activity/activity-log.ts +21 -0
  41. package/src/lib/server/agents/agent-availability.test.ts +10 -5
  42. package/src/lib/server/agents/agent-cascade.ts +79 -59
  43. package/src/lib/server/agents/agent-registry.ts +3 -1
  44. package/src/lib/server/agents/agent-repository.ts +90 -0
  45. package/src/lib/server/agents/delegation-job-repository.ts +53 -0
  46. package/src/lib/server/agents/delegation-jobs.ts +11 -4
  47. package/src/lib/server/agents/guardian-checkpoint-repository.ts +35 -0
  48. package/src/lib/server/agents/guardian.ts +2 -2
  49. package/src/lib/server/agents/main-agent-loop.ts +10 -3
  50. package/src/lib/server/agents/main-loop-state-repository.ts +38 -0
  51. package/src/lib/server/agents/subagent-runtime.ts +9 -6
  52. package/src/lib/server/agents/subagent-swarm.ts +3 -2
  53. package/src/lib/server/agents/task-session.ts +3 -4
  54. package/src/lib/server/approvals/approval-repository.ts +30 -0
  55. package/src/lib/server/autonomy/supervisor-incident-repository.ts +42 -0
  56. package/src/lib/server/chat-execution/chat-execution-types.ts +38 -0
  57. package/src/lib/server/chat-execution/chat-execution-utils.ts +1 -1
  58. package/src/lib/server/chat-execution/chat-execution.ts +84 -1926
  59. package/src/lib/server/chat-execution/chat-turn-finalization.ts +620 -0
  60. package/src/lib/server/chat-execution/chat-turn-partial-persistence.ts +221 -0
  61. package/src/lib/server/chat-execution/chat-turn-preflight.ts +133 -0
  62. package/src/lib/server/chat-execution/chat-turn-preparation.ts +817 -0
  63. package/src/lib/server/chat-execution/chat-turn-stream-execution.ts +296 -0
  64. package/src/lib/server/chat-execution/chat-turn-tool-routing.ts +5 -5
  65. package/src/lib/server/chat-execution/message-classifier.test.ts +329 -0
  66. package/src/lib/server/chat-execution/post-stream-finalization.ts +1 -1
  67. package/src/lib/server/chat-execution/prompt-builder.ts +11 -0
  68. package/src/lib/server/chat-execution/prompt-sections.ts +5 -6
  69. package/src/lib/server/chat-execution/situational-awareness.ts +12 -7
  70. package/src/lib/server/chat-execution/stream-agent-chat.ts +16 -13
  71. package/src/lib/server/chatrooms/chatroom-repository.ts +32 -0
  72. package/src/lib/server/connectors/connector-repository.ts +58 -0
  73. package/src/lib/server/connectors/runtime-state.test.ts +117 -0
  74. package/src/lib/server/credentials/credential-repository.ts +7 -0
  75. package/src/lib/server/gateways/gateway-profile-repository.ts +4 -0
  76. package/src/lib/server/memory/memory-abstract.test.ts +59 -0
  77. package/src/lib/server/missions/mission-repository.ts +74 -0
  78. package/src/lib/server/missions/mission-service/actions.ts +6 -0
  79. package/src/lib/server/missions/mission-service/bindings.ts +9 -0
  80. package/src/lib/server/missions/mission-service/context.ts +4 -0
  81. package/src/lib/server/missions/mission-service/core.ts +2269 -0
  82. package/src/lib/server/missions/mission-service/queries.ts +12 -0
  83. package/src/lib/server/missions/mission-service/recovery.ts +5 -0
  84. package/src/lib/server/missions/mission-service/ticks.ts +9 -0
  85. package/src/lib/server/missions/mission-service.test.ts +9 -2
  86. package/src/lib/server/missions/mission-service.ts +6 -2266
  87. package/src/lib/server/openclaw/deploy.test.ts +42 -3
  88. package/src/lib/server/openclaw/deploy.ts +26 -12
  89. package/src/lib/server/persistence/repository-utils.ts +154 -0
  90. package/src/lib/server/persistence/storage-context.ts +51 -0
  91. package/src/lib/server/persistence/transaction.ts +1 -0
  92. package/src/lib/server/projects/project-repository.ts +36 -0
  93. package/src/lib/server/projects/project-service.ts +79 -0
  94. package/src/lib/server/protocols/protocol-normalization.test.ts +6 -4
  95. package/src/lib/server/runtime/alert-dispatch.ts +1 -1
  96. package/src/lib/server/runtime/daemon-policy.ts +1 -1
  97. package/src/lib/server/runtime/daemon-state/core.ts +1570 -0
  98. package/src/lib/server/runtime/daemon-state/health.ts +6 -0
  99. package/src/lib/server/runtime/daemon-state/policy.ts +7 -0
  100. package/src/lib/server/runtime/daemon-state/supervisor.ts +6 -0
  101. package/src/lib/server/runtime/daemon-state.test.ts +48 -0
  102. package/src/lib/server/runtime/daemon-state.ts +3 -1470
  103. package/src/lib/server/runtime/estop-repository.ts +4 -0
  104. package/src/lib/server/runtime/estop.ts +3 -1
  105. package/src/lib/server/runtime/heartbeat-service.test.ts +2 -2
  106. package/src/lib/server/runtime/heartbeat-service.ts +55 -34
  107. package/src/lib/server/runtime/heartbeat-wake.ts +6 -4
  108. package/src/lib/server/runtime/idle-window.ts +2 -2
  109. package/src/lib/server/runtime/network.ts +11 -0
  110. package/src/lib/server/runtime/orchestrator-events.ts +2 -2
  111. package/src/lib/server/runtime/queue/claims.ts +4 -0
  112. package/src/lib/server/runtime/queue/core.ts +2079 -0
  113. package/src/lib/server/runtime/queue/execution.ts +7 -0
  114. package/src/lib/server/runtime/queue/followups.ts +4 -0
  115. package/src/lib/server/runtime/queue/queries.ts +12 -0
  116. package/src/lib/server/runtime/queue/recovery.ts +7 -0
  117. package/src/lib/server/runtime/queue-recovery.test.ts +48 -13
  118. package/src/lib/server/runtime/queue-repository.ts +17 -0
  119. package/src/lib/server/runtime/queue.ts +5 -2061
  120. package/src/lib/server/runtime/run-ledger.ts +6 -5
  121. package/src/lib/server/runtime/run-repository.ts +73 -0
  122. package/src/lib/server/runtime/runtime-lock-repository.ts +8 -0
  123. package/src/lib/server/runtime/runtime-settings.ts +1 -1
  124. package/src/lib/server/runtime/runtime-state.ts +99 -0
  125. package/src/lib/server/runtime/scheduler.ts +4 -2
  126. package/src/lib/server/runtime/session-run-manager/cancellation.ts +157 -0
  127. package/src/lib/server/runtime/session-run-manager/drain.ts +246 -0
  128. package/src/lib/server/runtime/session-run-manager/enqueue.ts +287 -0
  129. package/src/lib/server/runtime/session-run-manager/queries.ts +117 -0
  130. package/src/lib/server/runtime/session-run-manager/recovery.ts +238 -0
  131. package/src/lib/server/runtime/session-run-manager/state.ts +441 -0
  132. package/src/lib/server/runtime/session-run-manager/types.ts +74 -0
  133. package/src/lib/server/runtime/session-run-manager.ts +72 -1377
  134. package/src/lib/server/runtime/watch-job-repository.ts +35 -0
  135. package/src/lib/server/runtime/watch-jobs.ts +3 -1
  136. package/src/lib/server/schedules/schedule-repository.ts +42 -0
  137. package/src/lib/server/sessions/session-repository.ts +85 -0
  138. package/src/lib/server/settings/settings-repository.ts +25 -0
  139. package/src/lib/server/skills/skill-discovery.test.ts +2 -2
  140. package/src/lib/server/skills/skill-discovery.ts +2 -2
  141. package/src/lib/server/skills/skill-repository.ts +14 -0
  142. package/src/lib/server/storage.ts +13 -24
  143. package/src/lib/server/tasks/task-repository.ts +54 -0
  144. package/src/lib/server/usage/usage-repository.ts +30 -0
  145. package/src/lib/server/webhooks/webhook-repository.ts +10 -0
  146. package/src/lib/strip-internal-metadata.test.ts +42 -41
  147. package/src/stores/use-chat-store.test.ts +54 -0
  148. package/src/stores/use-chat-store.ts +21 -5
  149. /package/{bundled-skills → skills}/google-workspace/SKILL.md +0 -0
package/README.md CHANGED
@@ -190,6 +190,22 @@ The building blocks are the same: **agents, tools, memory, delegation, schedules
190
190
 
191
191
  ## Release Notes
192
192
 
193
+ ### v1.2.3 Highlights
194
+
195
+ - **Standalone asset staging repair**: `swarmclaw server` now copies `.next/static` and `public/` into the Next.js standalone runtime after the first build, preventing blank UI loads and 503s for CSS, JS, and image assets.
196
+ - **OpenClaw SSH port fix**: remote OpenClaw deploys now preserve well-known SSH ports like `22` instead of clamping them to `1024`.
197
+ - **OpenClaw image source fix**: generated remote deploy bundles and default upgrade actions now use the official `ghcr.io/openclaw/openclaw:latest` image instead of the missing Docker Hub shorthand.
198
+ - **Standalone self-healing**: server startup now repairs older incomplete standalone bundles by staging missing runtime assets before launching `server.js`.
199
+
200
+ ### v1.2.2 Highlights
201
+
202
+ - **Modular chat execution pipeline**: decomposed the monolithic chat-execution module into 6 focused stages (preflight, preparation, stream execution, partial persistence, finalization, types) for maintainability and testability.
203
+ - **Repository pattern adoption**: extracted ~15 repository modules from `storage.ts`, giving each domain (agents, sessions, missions, credentials, tasks, etc.) its own data-access layer.
204
+ - **Runtime state encapsulation**: moved process-local state (active sessions, dev servers) from storage into `runtime-state.ts` with proper HMR singleton usage.
205
+ - **Streaming state improvements**: stable assistant render IDs, better live-row display logic, and smoother streaming phase transitions in the chat UI.
206
+ - **8 new skills**: coding-agent, github, nano-banana-pro, nano-pdf, openai-image-gen, resourceful-problem-solving, skill-creator, summarize.
207
+ - **Lint baseline improvements**: reduced lint violations from 414 to 396 (-18).
208
+
193
209
  ### v1.2.1 Highlights
194
210
 
195
211
  - **System health endpoint**: new `/api/system/status` route returns lightweight health summary for external monitoring and uptime checks.
@@ -217,91 +233,6 @@ The building blocks are the same: **agents, tools, memory, delegation, schedules
217
233
  - **Playwright proxy hardening**: improved stdio pipe handling for dev server restarts.
218
234
  - **Scheduler and run ledger fixes**: improved scheduler reliability and run ledger state tracking.
219
235
 
220
- ### v1.1.8 Highlights
221
-
222
- - **Agent live status**: real-time `/agents/:id/status` endpoint exposes goal, progress, and plan steps; org chart detail panel consumes it via `useAgentLiveStatus` hook.
223
- - **Learned skills lifecycle**: promote, dismiss, and delete learned skills via `/learned-skills/:id`; `/skill-review-counts` provides badge counts for the skills workspace.
224
- - **Gemini CLI provider**: Google Gemini CLI joins the provider roster alongside claude-cli and codex-cli, with shared CLI utilities factored into `cli-utils.ts`.
225
- - **Peer query & team context tools**: new session tools let agents query peers and access team context during conversations.
226
- - **Team resolution**: dedicated `team-resolution.ts` module resolves agent teams for delegation routing.
227
- - **Org chart activity feed**: timeline feed component and delegation bubble visualization for the org chart view.
228
- - **Skills workspace improvements**: expanded skills management UI with review-ready badges.
229
- - **Cost trend chart**: new dashboard component for cost visualization.
230
- - **Streaming fix**: text no longer gets stuck on the thinking indicator.
231
- - **Delegation normalization**: `delegationEnabled` now derived from agent role, removed from starter kit templates.
232
- - **Chat execution refinements**: improved continuation limits, post-stream finalization, and stream continuation.
233
- - **Memory and storage improvements**: memory tier management, consolidation enhancements, and storage cache updates.
234
- - **WebSocket and provider health**: improved WS client handling, delegation edge state, and provider health monitoring.
235
-
236
- ### v1.1.7 Highlights
237
-
238
- - **Projects page redesign**: tabbed navigation (Overview, Work, Operations, Activity) with health grid, sortable task list, and timeline feed.
239
- - **Delegation visualization**: live org chart edges show active delegations with status, direction, and message popover on click.
240
- - **Credential self-service**: agents can check whether a credential exists and request missing ones from humans with structured messages, signup URLs, and durable wait.
241
- - **Main loop state persistence**: autonomous operation state now survives server restarts via on-disk persistence.
242
- - **Internal metadata stripping**: classification JSON and loop detection messages no longer leak into streamed agent output.
243
- - **Response completeness evaluator**: LLM-based detection of incomplete agent responses triggers continuation nudges.
244
- - **Coordinator delegation nudging**: coordinators that make 3+ direct tool calls get prompted to delegate to workers.
245
- - **Inspector panel overhaul**: new dashboard/config/files tabs absorb model switcher and workspace controls from chat header.
246
- - **Streaming phase indicators**: agent chat list shows queued, tool-in-use, responding, and reconnecting states.
247
- - **Shell safety**: agents can no longer kill SwarmClaw's own process or port.
248
- - **Worker-only providers**: CLI-backed providers (claude-cli, codex-cli, etc.) properly restricted from coordinator/heartbeat roles.
249
- - **HTTP tool removed**: the built-in HTTP session tool was removed from the standard toolkit.
250
-
251
- ### v1.1.6 Highlights
252
-
253
- - **Org chart view**: visual agent hierarchy with drag-and-drop reparenting, team grouping, and context-menu actions for managing agent relationships directly from the canvas.
254
- - **Dashboard API**: server-side metrics endpoint with cost tracking, usage aggregation, and budget warning thresholds for operator visibility.
255
- - **Subagent lifecycle overhaul**: state-machine lineage tracking, `delegationDepth` limits, auto-announce on spawn, and cleaner parent-child session management.
256
- - **Chat execution refactor**: composable prompt sections replace monolithic prompt building, continuation evaluator consolidation, and extracted stream-continuation logic for maintainability.
257
- - **Per-agent cost attribution**: token costs are tracked and attributed per agent, enabling budget controls and cost reporting at the agent level.
258
- - **Capability-based task routing**: tasks can match agents by declared capabilities, not just explicit assignment, enabling smarter automatic dispatch.
259
- - **Bulk agent operations**: new `/api/agents/bulk` endpoint for batch updates across multiple agents in a single request.
260
- - **Document revisions API**: version history for documents with `/api/documents/[id]/revisions` endpoint.
261
- - **Store loader consolidation**: async loaders now use `createLoader()` and `setIfChanged` to eliminate redundant re-renders from polling.
262
-
263
- ### v1.1.4 Highlights
264
-
265
- - **Orchestrator agents return as a first-class autonomy mode**: eligible agents can now run scheduled orchestrator wake cycles with their own mission, governance policy, wake interval, cycle cap, Autonomy-desk controls, and setup/editor support.
266
- - **Runtime durability is much harder to knock over**: the task queue now supports parallel execution with restart-safe swarm state, orphaned running-task recovery, stuck-task idle timeout detection, and provider-health persistence across daemon restarts.
267
- - **Recovery and safety paths are tighter**: provider errors are classified for smarter failover, unavailable agents defer work instead of burning it, supervisor blocks can create executable notifications, and agent budget limits now gate task execution before work starts.
268
- - **Temporary session rooms are easier to inspect**: chatrooms now split persistent rooms from temporary session-style rooms so orchestrator or structured-session conversations can stay visible without polluting the normal room list.
269
-
270
- ### v1.1.3 Highlights
271
-
272
- - **Release integrity repair**: `build:ci` no longer trips over the langgraph checkpoint duplicate-column path, which restores clean build validation for the release line.
273
- - **Storage writes are safer**: credential and agent saves were tightened to upsert-only behavior and bulk-delete safety guards so tests or scripts cannot accidentally wipe live state.
274
- - **Plugin-to-extension cleanup finished**: remaining rename residue in scripts and tests was cleaned up so packaging and release tooling stay aligned with the current extensions model.
275
- - **Safe body parsing utility**: shared `safeParseBody()` replaces scattered `await req.json()` try/catch blocks across API routes.
276
-
277
- ### v1.1.2 Highlights
278
-
279
- - **Structured Sessions expanded into richer orchestration**: ProtocolRun-based sessions now support dependency-aware step graphs, reusable step outputs, and a broader advanced execution model on the same durable runtime instead of bringing back a separate orchestrator.
280
- - **Explicit Ollama local/cloud routing**: agents and sessions now persist the user-selected Ollama mode directly, so local Ollama no longer flips to cloud because of model naming or leftover credentials.
281
- - **Chat and runtime regression hardening**: live-streamed inline media, stale streaming cleanup, exact-output handling, and chat rendering bugs were tightened again, including the recent message-row and avatar rendering regressions.
282
- - **Nebius and DeepInfra as built-in providers**: both are now first-class providers with setup wizard entries, model discovery, and pre-configured defaults instead of requiring the custom provider workaround.
283
- - **`stream_options` resilience**: the OpenAI-compatible streaming handler now retries without `stream_options` if a provider rejects it with 400, fixing connectivity for strict endpoints.
284
-
285
- ### v1.1.1 Highlights
286
-
287
- - **Structured Sessions are now contextual**: start bounded structured runs from direct chats, chatrooms, tasks, missions, or schedules, including a new chatroom `/breakout` command that spins up a focused session from the current room with auto-filled participants and kickoff context.
288
- - **ProtocolRun orchestration matured**: structured sessions now run on the same durable engine for step-based branching, repeat loops, parallel branches, and explicit joins instead of growing a separate orchestration subsystem.
289
- - **Live-agent runtime hardening**: exact-output contracts, memory preflight behavior, same-channel delivery rendering, inline media, and grounded runtime inspection were all tightened through live-agent validation before release.
290
-
291
- ### v1.1.0 Highlights
292
-
293
- - **Mission controller and Missions UI**: SwarmClaw now tracks durable multi-step objectives as missions with status, phase, linked tasks, queued turns, recent runs, event history, and operator actions from the new **Missions** surface.
294
- - **Autonomy safety desk and run replay**: the new **Autonomy Control** page adds estop visibility, resume policy controls, incident review, and run replay backed by durable run history rather than transient in-memory state.
295
- - **Durable queued follow-ups**: direct chat and connector follow-up turns now use a backend queue so queued work survives reloads, drains in order, and stays attached to the right mission/session context.
296
- - **Chat execution and UX hardening**: streamed handoff, memory writes, inline media, queue state, and tool-policy fallback behavior were cleaned up so agents are less noisy, less brittle, and easier to follow in real chats.
297
-
298
- ### v1.0.9 Highlights
299
-
300
- - **Quieter chat and inbox replies**: chat-origin and connector turns now suppress more hidden control text, stop replaying connector-tool output as normal assistant prose, and avoid extra empty follow-up chatter after successful tool work.
301
- - **Sender-aware direct inbox replies**: direct connector sessions can honor stored sender display names and reply-medium preferences, including voice-note-first replies when the connector supports binary media and the agent has a configured voice.
302
- - **Cleaner connector delivery reconciliation**: connector delivery markers now track what was actually sent, response previews prefer the delivered transcript, and task/connector followups resolve local output files more reliably.
303
- - **Memory-write followthrough hardening**: successful memory store/update turns terminate more cleanly, which reduces unnecessary post-tool loops while still allowing a natural acknowledgement when the user needs one.
304
-
305
236
  ## What SwarmClaw Focuses On
306
237
 
307
238
  - **Delegation, orchestrators, and background execution**: delegated work, orchestrator agents, subagents, durable jobs, checkpointing, and background task execution.
package/bin/server-cmd.js CHANGED
@@ -47,6 +47,10 @@ function ensureDir(dir) {
47
47
  if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true })
48
48
  }
49
49
 
50
+ function resolveStandaloneRuntimeDir(serverJs) {
51
+ return path.dirname(serverJs)
52
+ }
53
+
50
54
  function log(msg) {
51
55
  process.stdout.write(`[swarmclaw] ${msg}\n`)
52
56
  }
@@ -206,6 +210,51 @@ function symlinkDir(targetPath, linkPath) {
206
210
  fs.symlinkSync(targetPath, linkPath, process.platform === 'win32' ? 'junction' : 'dir')
207
211
  }
208
212
 
213
+ function syncStandaloneRuntimeAssets({
214
+ sourceRoot,
215
+ runtimeDir,
216
+ force = false,
217
+ } = {}) {
218
+ const assets = [
219
+ {
220
+ key: 'staticCopied',
221
+ sourcePath: path.join(sourceRoot, '.next', 'static'),
222
+ targetPath: path.join(runtimeDir, '.next', 'static'),
223
+ optional: false,
224
+ },
225
+ {
226
+ key: 'publicCopied',
227
+ sourcePath: path.join(sourceRoot, 'public'),
228
+ targetPath: path.join(runtimeDir, 'public'),
229
+ optional: true,
230
+ },
231
+ ]
232
+
233
+ const result = {
234
+ staticCopied: false,
235
+ publicCopied: false,
236
+ }
237
+
238
+ for (const asset of assets) {
239
+ if (!fs.existsSync(asset.sourcePath)) {
240
+ if (!asset.optional) result[asset.key] = false
241
+ continue
242
+ }
243
+ if (!force && fs.existsSync(asset.targetPath)) continue
244
+
245
+ ensureDir(path.dirname(asset.targetPath))
246
+ fs.rmSync(asset.targetPath, { recursive: true, force: true })
247
+ fs.cpSync(asset.sourcePath, asset.targetPath, {
248
+ recursive: true,
249
+ force: true,
250
+ dereference: true,
251
+ })
252
+ result[asset.key] = true
253
+ }
254
+
255
+ return result
256
+ }
257
+
209
258
  function prepareBuildWorkspace({ pkgRoot = PKG_ROOT, buildRoot = resolvePackageBuildRoot(pkgRoot), nodeModulesDir } = {}) {
210
259
  copyBuildWorkspaceContents(pkgRoot, buildRoot)
211
260
  symlinkDir(nodeModulesDir, path.join(buildRoot, 'node_modules'))
@@ -285,6 +334,15 @@ function runBuild({ pkgRoot = PKG_ROOT } = {}) {
285
334
  },
286
335
  })
287
336
 
337
+ const standalone = locateStandaloneServer({ pkgRoot: buildRoot })
338
+ if (standalone) {
339
+ syncStandaloneRuntimeAssets({
340
+ sourceRoot: buildRoot,
341
+ runtimeDir: resolveStandaloneRuntimeDir(standalone.serverJs),
342
+ force: true,
343
+ })
344
+ }
345
+
288
346
  log('Build complete.')
289
347
  }
290
348
 
@@ -306,10 +364,12 @@ async function startServer(opts, { pkgRoot = PKG_ROOT } = {}) {
306
364
  logError('Standalone server.js not found in the installed package. Try running: swarmclaw server --build')
307
365
  process.exit(1)
308
366
  }
309
- const { root: runtimeRoot, serverJs } = standalone
367
+ const { root: buildRoot, serverJs } = standalone
368
+ const runtimeRoot = resolveStandaloneRuntimeDir(serverJs)
310
369
 
311
370
  ensureDir(SWARMCLAW_HOME)
312
371
  ensureDir(DATA_DIR)
372
+ syncStandaloneRuntimeAssets({ sourceRoot: buildRoot, runtimeDir: runtimeRoot })
313
373
 
314
374
  const port = opts.port || '3456'
315
375
  const wsPort = opts.wsPort || String(Number(port) + 1)
@@ -328,6 +388,7 @@ async function startServer(opts, { pkgRoot = PKG_ROOT } = {}) {
328
388
 
329
389
  log(`Starting server on ${host}:${port} (WebSocket: ${wsPort})...`)
330
390
  log(`Package root: ${pkgRoot}`)
391
+ log(`Build root: ${buildRoot}`)
331
392
  log(`Runtime root: ${runtimeRoot}`)
332
393
  log(`Home: ${SWARMCLAW_HOME}`)
333
394
  log(`Data directory: ${DATA_DIR}`)
@@ -545,6 +606,8 @@ module.exports = {
545
606
  resolveReadyCheckHost,
546
607
  resolveStandaloneCandidateRoots,
547
608
  resolveStandaloneBase,
609
+ resolveStandaloneRuntimeDir,
548
610
  runBuild,
611
+ syncStandaloneRuntimeAssets,
549
612
  waitForPortReady,
550
613
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swarmclawai/swarmclaw",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Self-hosted AI runtime for OpenClaw, delegation, autonomy, runtime skills, crypto wallets, and chat platform connectors.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "files": [
32
32
  "bin/",
33
- "bundled-skills/",
33
+ "skills/",
34
34
  "src/",
35
35
  "public/",
36
36
  "Dockerfile.sandbox-browser",
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: coding-agent
3
+ description: 'Delegate coding tasks to external coding agents (Claude Code, Codex, Pi, OpenCode) via shell. Use when: (1) building new features or apps in a separate project, (2) reviewing PRs, (3) refactoring large codebases, (4) iterative coding that needs file exploration. NOT for: simple one-liner fixes (just edit directly), reading code (use read/file tools), or work inside the SwarmClaw workspace itself.'
4
+ metadata:
5
+ {
6
+ "openclaw": { "emoji": "🧩", "requires": { "anyBins": ["claude", "codex", "opencode", "pi"] } },
7
+ }
8
+ ---
9
+
10
+ # Coding Agent
11
+
12
+ Delegate coding tasks to external coding agents via shell tools.
13
+
14
+ ## Agent Execution Modes
15
+
16
+ ### Claude Code (recommended)
17
+
18
+ Use `--print --permission-mode bypassPermissions` for non-interactive execution:
19
+
20
+ ```bash
21
+ cd /path/to/project && claude --permission-mode bypassPermissions --print 'Your task here'
22
+ ```
23
+
24
+ For background execution, use the shell tool's background mode.
25
+
26
+ **Do NOT use PTY mode with Claude Code** — `--print` mode keeps full tool access and avoids interactive confirmation dialogs.
27
+
28
+ ### Codex
29
+
30
+ Codex requires a git repository and PTY mode:
31
+
32
+ ```bash
33
+ # Quick one-shot (auto-approves changes)
34
+ cd /path/to/project && codex exec --full-auto 'Build a dark mode toggle'
35
+
36
+ # Codex refuses to run outside a git directory. For scratch work:
37
+ SCRATCH=$(mktemp -d) && cd $SCRATCH && git init && codex exec "Your prompt"
38
+ ```
39
+
40
+ ### Pi Coding Agent
41
+
42
+ ```bash
43
+ # Install: npm install -g @mariozechner/pi-coding-agent
44
+ cd /path/to/project && pi 'Your task'
45
+
46
+ # Non-interactive mode
47
+ pi -p 'Summarize src/'
48
+
49
+ # Different provider/model
50
+ pi --provider openai --model gpt-4o-mini -p 'Your task'
51
+ ```
52
+
53
+ ### OpenCode
54
+
55
+ ```bash
56
+ cd /path/to/project && opencode run 'Your task'
57
+ ```
58
+
59
+ ## PR Reviews
60
+
61
+ Clone to a temp folder or use git worktree — never review PRs in the SwarmClaw project directory:
62
+
63
+ ```bash
64
+ # Clone to temp for safe review
65
+ REVIEW_DIR=$(mktemp -d)
66
+ git clone https://github.com/user/repo.git $REVIEW_DIR
67
+ cd $REVIEW_DIR && gh pr checkout 130
68
+ codex review --base origin/main
69
+
70
+ # Or use git worktree
71
+ git worktree add /tmp/pr-130-review pr-130-branch
72
+ cd /tmp/pr-130-review && codex review --base main
73
+ ```
74
+
75
+ ## Parallel Issue Fixing
76
+
77
+ Use git worktrees to fix multiple issues in parallel:
78
+
79
+ ```bash
80
+ # Create worktrees
81
+ git worktree add -b fix/issue-78 /tmp/issue-78 main
82
+ git worktree add -b fix/issue-99 /tmp/issue-99 main
83
+
84
+ # Launch agents (use background shell execution)
85
+ cd /tmp/issue-78 && codex --yolo 'Fix issue #78: <description>. Commit when done.'
86
+ cd /tmp/issue-99 && codex --yolo 'Fix issue #99: <description>. Commit when done.'
87
+
88
+ # Create PRs after
89
+ cd /tmp/issue-78 && git push -u origin fix/issue-78
90
+ gh pr create --repo user/repo --head fix/issue-78 --title "fix: ..." --body "..."
91
+
92
+ # Cleanup
93
+ git worktree remove /tmp/issue-78
94
+ git worktree remove /tmp/issue-99
95
+ ```
96
+
97
+ ## Rules
98
+
99
+ 1. **Use the right execution mode per agent**: Claude Code uses `--print` (no PTY); Codex/Pi/OpenCode may need interactive terminal.
100
+ 2. **Respect tool choice** — if the user asks for Codex, use Codex. Don't silently switch agents.
101
+ 3. **Be patient** — don't kill sessions because they seem slow.
102
+ 4. **Monitor progress** — check output periodically without interfering.
103
+ 5. **Never run coding agents inside the SwarmClaw project directory** — use a separate project directory or temp folder.
104
+
105
+ ## Progress Updates
106
+
107
+ When spawning coding agents in the background:
108
+
109
+ - Send a short message when you start (what's running, where).
110
+ - Update only when something changes (milestone, error, completion).
111
+ - If you kill a session, say so immediately and explain why.
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: github
3
+ description: "GitHub operations via `gh` CLI: issues, PRs, CI runs, code review, API queries. Use when: (1) checking PR status or CI, (2) creating/commenting on issues, (3) listing/filtering PRs or issues, (4) viewing run logs. NOT for: local git operations (use git directly), non-GitHub repos, or cloning (use git clone)."
4
+ metadata:
5
+ {
6
+ "openclaw":
7
+ {
8
+ "emoji": "🐙",
9
+ "requires": { "bins": ["gh"] },
10
+ "install":
11
+ [
12
+ {
13
+ "id": "brew",
14
+ "kind": "brew",
15
+ "formula": "gh",
16
+ "bins": ["gh"],
17
+ "label": "Install GitHub CLI (brew)",
18
+ },
19
+ {
20
+ "id": "apt",
21
+ "kind": "apt",
22
+ "package": "gh",
23
+ "bins": ["gh"],
24
+ "label": "Install GitHub CLI (apt)",
25
+ },
26
+ ],
27
+ },
28
+ }
29
+ ---
30
+
31
+ # GitHub Skill
32
+
33
+ Use the `gh` CLI to interact with GitHub repositories, issues, PRs, and CI.
34
+
35
+ ## Setup
36
+
37
+ ```bash
38
+ # Authenticate (one-time)
39
+ gh auth login
40
+
41
+ # Verify
42
+ gh auth status
43
+ ```
44
+
45
+ ## Common Commands
46
+
47
+ ### Pull Requests
48
+
49
+ ```bash
50
+ # List PRs
51
+ gh pr list --repo owner/repo
52
+
53
+ # Check CI status
54
+ gh pr checks 55 --repo owner/repo
55
+
56
+ # View PR details
57
+ gh pr view 55 --repo owner/repo
58
+
59
+ # Create PR
60
+ gh pr create --title "feat: add feature" --body "Description"
61
+
62
+ # Merge PR
63
+ gh pr merge 55 --squash --repo owner/repo
64
+ ```
65
+
66
+ ### Issues
67
+
68
+ ```bash
69
+ # List issues
70
+ gh issue list --repo owner/repo --state open
71
+
72
+ # Create issue
73
+ gh issue create --title "Bug: something broken" --body "Details..."
74
+
75
+ # Close issue
76
+ gh issue close 42 --repo owner/repo
77
+ ```
78
+
79
+ ### CI/Workflow Runs
80
+
81
+ ```bash
82
+ # List recent runs
83
+ gh run list --repo owner/repo --limit 10
84
+
85
+ # View specific run
86
+ gh run view <run-id> --repo owner/repo
87
+
88
+ # View failed step logs only
89
+ gh run view <run-id> --repo owner/repo --log-failed
90
+
91
+ # Re-run failed jobs
92
+ gh run rerun <run-id> --failed --repo owner/repo
93
+ ```
94
+
95
+ ### API Queries
96
+
97
+ ```bash
98
+ # Get PR with specific fields
99
+ gh api repos/owner/repo/pulls/55 --jq '.title, .state, .user.login'
100
+
101
+ # List all labels
102
+ gh api repos/owner/repo/labels --jq '.[].name'
103
+
104
+ # Get repo stats
105
+ gh api repos/owner/repo --jq '{stars: .stargazers_count, forks: .forks_count}'
106
+ ```
107
+
108
+ ## JSON Output
109
+
110
+ Most commands support `--json` for structured output with `--jq` filtering:
111
+
112
+ ```bash
113
+ gh issue list --repo owner/repo --json number,title --jq '.[] | "\(.number): \(.title)"'
114
+ gh pr list --json number,title,state,mergeable --jq '.[] | select(.mergeable == "MERGEABLE")'
115
+ ```
116
+
117
+ ## Templates
118
+
119
+ ### PR Review Summary
120
+
121
+ ```bash
122
+ PR=55 REPO=owner/repo
123
+ echo "## PR #$PR Summary"
124
+ gh pr view $PR --repo $REPO --json title,body,author,additions,deletions,changedFiles \
125
+ --jq '"**\(.title)** by @\(.author.login)\n\n\(.body)\n\n+\(.additions) -\(.deletions) across \(.changedFiles) files"'
126
+ gh pr checks $PR --repo $REPO
127
+ ```
128
+
129
+ ### Issue Triage
130
+
131
+ ```bash
132
+ gh issue list --repo owner/repo --state open --json number,title,labels,createdAt \
133
+ --jq '.[] | "[\(.number)] \(.title) - \([.labels[].name] | join(", ")) (\(.createdAt[:10]))"'
134
+ ```
135
+
136
+ ## Notes
137
+
138
+ - Always specify `--repo owner/repo` when not in a git directory.
139
+ - Use URLs directly: `gh pr view https://github.com/owner/repo/pull/55`
140
+ - Rate limits apply; use `gh api --cache 1h` for repeated queries.
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: nano-banana-pro
3
+ description: Generate or edit images via Gemini 3 Pro Image (Nano Banana Pro). Use when asked to create, generate, or edit images and a Gemini API key is available. Supports text-to-image generation, single-image editing, and multi-image composition (up to 14 images).
4
+ metadata:
5
+ {
6
+ "openclaw":
7
+ {
8
+ "emoji": "🍌",
9
+ "requires": { "bins": ["uv"], "env": ["GEMINI_API_KEY"] },
10
+ "primaryEnv": "GEMINI_API_KEY",
11
+ "install":
12
+ [
13
+ {
14
+ "id": "uv-brew",
15
+ "kind": "brew",
16
+ "formula": "uv",
17
+ "bins": ["uv"],
18
+ "label": "Install uv (brew)",
19
+ },
20
+ ],
21
+ },
22
+ }
23
+ ---
24
+
25
+ # Nano Banana Pro (Gemini 3 Pro Image)
26
+
27
+ Use the bundled script to generate or edit images.
28
+
29
+ ## Generate
30
+
31
+ ```bash
32
+ uv run {baseDir}/scripts/generate_image.py --prompt "your image description" --filename "output.png" --resolution 1K
33
+ ```
34
+
35
+ ## Edit (Single Image)
36
+
37
+ ```bash
38
+ uv run {baseDir}/scripts/generate_image.py --prompt "edit instructions" --filename "output.png" -i "/path/in.png" --resolution 2K
39
+ ```
40
+
41
+ ## Multi-Image Composition (up to 14 images)
42
+
43
+ ```bash
44
+ uv run {baseDir}/scripts/generate_image.py --prompt "combine these into one scene" --filename "output.png" -i img1.png -i img2.png -i img3.png
45
+ ```
46
+
47
+ ## API Key
48
+
49
+ Set `GEMINI_API_KEY` as an environment variable, or pass `--api-key <KEY>` to the script.
50
+
51
+ ## Aspect Ratio (optional)
52
+
53
+ ```bash
54
+ uv run {baseDir}/scripts/generate_image.py --prompt "portrait photo" --filename "output.png" --aspect-ratio 9:16
55
+ ```
56
+
57
+ ## Notes
58
+
59
+ - Resolutions: `1K` (default), `2K`, `4K`.
60
+ - Aspect ratios: `1:1`, `2:3`, `3:2`, `3:4`, `4:3`, `4:5`, `5:4`, `9:16`, `16:9`, `21:9`. Without `--aspect-ratio`, the model picks freely.
61
+ - Use timestamps in filenames for uniqueness: `yyyy-mm-dd-hh-mm-ss-name.png`.
62
+ - Do not read the image back into context; report the saved path only.