@swarmclawai/swarmclaw 1.5.0 → 1.5.1
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 +4 -0
- package/package.json +1 -1
- package/src/lib/server/daemon/controller.ts +55 -0
package/README.md
CHANGED
|
@@ -215,6 +215,10 @@ SwarmClaw agents can join [SwarmFeed](https://swarmfeed.ai) — a social network
|
|
|
215
215
|
|
|
216
216
|
Read the docs at [swarmclaw.ai/docs/swarmfeed](https://swarmclaw.ai/docs/swarmfeed) and visit [swarmfeed.ai](https://swarmfeed.ai) for the platform itself.
|
|
217
217
|
|
|
218
|
+
### v1.5.1 Highlights
|
|
219
|
+
|
|
220
|
+
- **Standalone connector lifecycle**: connector start, stop, status, and repair now work correctly in standalone production builds (`npm start` / pm2) where the daemon runs in-process. Previously these operations silently failed because the controller assumed a daemon subprocess was always present. (Community contribution by [@borislavnnikolov](https://github.com/borislavnnikolov) -- PR #35)
|
|
221
|
+
|
|
218
222
|
### v1.5.0 Highlights
|
|
219
223
|
|
|
220
224
|
- **First-run activation refresh**: setup now includes a dedicated start-path step, broad starter shapes instead of niche presets, and draft agents generated directly from the chosen setup shape.
|
package/package.json
CHANGED
|
@@ -523,6 +523,24 @@ export async function runDaemonHealthCheckViaAdmin(source: string): Promise<Daem
|
|
|
523
523
|
}
|
|
524
524
|
|
|
525
525
|
export async function listDaemonConnectorRuntime(): Promise<Record<string, DaemonConnectorRuntimeState>> {
|
|
526
|
+
// When the daemon is running in-process, read runtime state directly.
|
|
527
|
+
const inProcessStatus = getDaemonStatus()
|
|
528
|
+
if (inProcessStatus.running) {
|
|
529
|
+
const { listRunningConnectors, getConnectorStatus, isConnectorAuthenticated, hasConnectorCredentials, getConnectorQR, getConnectorPresence } =
|
|
530
|
+
await import('@/lib/server/connectors/connector-lifecycle')
|
|
531
|
+
const result: Record<string, DaemonConnectorRuntimeState> = {}
|
|
532
|
+
for (const { id } of listRunningConnectors()) {
|
|
533
|
+
result[id] = {
|
|
534
|
+
status: getConnectorStatus(id),
|
|
535
|
+
authenticated: isConnectorAuthenticated(id),
|
|
536
|
+
hasCredentials: hasConnectorCredentials(id),
|
|
537
|
+
qrDataUrl: getConnectorQR(id),
|
|
538
|
+
presence: getConnectorPresence(id),
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
return result
|
|
542
|
+
}
|
|
543
|
+
|
|
526
544
|
const metadata = readDaemonAdminMetadata()
|
|
527
545
|
if (!metadata || !isProcessRunning(metadata.pid)) return {}
|
|
528
546
|
try {
|
|
@@ -534,6 +552,22 @@ export async function listDaemonConnectorRuntime(): Promise<Record<string, Daemo
|
|
|
534
552
|
}
|
|
535
553
|
|
|
536
554
|
export async function getDaemonConnectorRuntime(connectorId: string): Promise<DaemonConnectorRuntimeState | null> {
|
|
555
|
+
// When the daemon is running in-process, read runtime state directly from
|
|
556
|
+
// the connector lifecycle module instead of an unreachable subprocess HTTP API.
|
|
557
|
+
const inProcessStatus = getDaemonStatus()
|
|
558
|
+
if (inProcessStatus.running) {
|
|
559
|
+
const { getConnectorStatus, getConnectorQR, isConnectorAuthenticated, hasConnectorCredentials, getConnectorPresence } =
|
|
560
|
+
await import('@/lib/server/connectors/connector-lifecycle')
|
|
561
|
+
const status = getConnectorStatus(connectorId)
|
|
562
|
+
return {
|
|
563
|
+
status,
|
|
564
|
+
authenticated: isConnectorAuthenticated(connectorId),
|
|
565
|
+
hasCredentials: hasConnectorCredentials(connectorId),
|
|
566
|
+
qrDataUrl: getConnectorQR(connectorId),
|
|
567
|
+
presence: getConnectorPresence(connectorId),
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
537
571
|
const metadata = readDaemonAdminMetadata()
|
|
538
572
|
if (!metadata || !isProcessRunning(metadata.pid)) return null
|
|
539
573
|
try {
|
|
@@ -555,6 +589,27 @@ export async function runDaemonConnectorAction(
|
|
|
555
589
|
if (action !== 'stop') {
|
|
556
590
|
await ensureDaemonProcessRunning(source, { manualStart: true })
|
|
557
591
|
}
|
|
592
|
+
|
|
593
|
+
// When the daemon is running in-process (e.g. standalone production build),
|
|
594
|
+
// there is no subprocess admin server or daemon-admin.json. Execute the
|
|
595
|
+
// connector lifecycle action directly in the current process.
|
|
596
|
+
const inProcessStatus = getDaemonStatus()
|
|
597
|
+
if (inProcessStatus.running) {
|
|
598
|
+
try {
|
|
599
|
+
const { startConnector, stopConnector, repairConnector } = await import('@/lib/server/connectors/connector-lifecycle')
|
|
600
|
+
if (action === 'start') {
|
|
601
|
+
await startConnector(connectorId)
|
|
602
|
+
} else if (action === 'stop') {
|
|
603
|
+
await stopConnector(connectorId)
|
|
604
|
+
} else if (action === 'repair') {
|
|
605
|
+
await repairConnector(connectorId)
|
|
606
|
+
}
|
|
607
|
+
} catch (err: unknown) {
|
|
608
|
+
log.error(TAG, `In-process connector action "${action}" failed for ${connectorId}:`, errorMessage(err))
|
|
609
|
+
}
|
|
610
|
+
return null
|
|
611
|
+
}
|
|
612
|
+
|
|
558
613
|
const metadata = readDaemonAdminMetadata()
|
|
559
614
|
if (!metadata || !isProcessRunning(metadata.pid)) return null
|
|
560
615
|
const result = await requestDaemon<{ connector: DaemonConnectorRuntimeState | null }>(
|