clawsql 0.2.3 → 0.2.6
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 +68 -16
- package/dist/api/schemas/index.d.ts +20 -20
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +12 -0
- package/dist/app.js.map +1 -1
- package/dist/bin/clawsql.js +0 -0
- package/dist/cli/agent/index.d.ts +1 -1
- package/dist/cli/agent/index.d.ts.map +1 -1
- package/dist/cli/agent/index.js +4 -1
- package/dist/cli/agent/index.js.map +1 -1
- package/dist/cli/agent/openclaw-integration.d.ts +20 -1
- package/dist/cli/agent/openclaw-integration.d.ts.map +1 -1
- package/dist/cli/agent/openclaw-integration.js +84 -13
- package/dist/cli/agent/openclaw-integration.js.map +1 -1
- package/dist/cli/commands/clusters.d.ts +1 -1
- package/dist/cli/commands/clusters.d.ts.map +1 -1
- package/dist/cli/commands/clusters.js +292 -57
- package/dist/cli/commands/clusters.js.map +1 -1
- package/dist/cli/commands/openclaw.d.ts.map +1 -1
- package/dist/cli/commands/openclaw.js +11 -1
- package/dist/cli/commands/openclaw.js.map +1 -1
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +42 -17
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +5 -0
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/templates.d.ts +11 -0
- package/dist/cli/commands/templates.d.ts.map +1 -0
- package/dist/cli/commands/templates.js +206 -0
- package/dist/cli/commands/templates.js.map +1 -0
- package/dist/cli/formatter.d.ts +24 -0
- package/dist/cli/formatter.d.ts.map +1 -1
- package/dist/cli/formatter.js +22 -0
- package/dist/cli/formatter.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/raw-input.d.ts +2 -0
- package/dist/cli/raw-input.d.ts.map +1 -1
- package/dist/cli/raw-input.js +70 -47
- package/dist/cli/raw-input.js.map +1 -1
- package/dist/cli/utils/args.d.ts +25 -0
- package/dist/cli/utils/args.d.ts.map +1 -0
- package/dist/cli/utils/args.js +51 -0
- package/dist/cli/utils/args.js.map +1 -0
- package/dist/config/settings.d.ts +38 -6
- package/dist/config/settings.d.ts.map +1 -1
- package/dist/config/settings.js +8 -0
- package/dist/config/settings.js.map +1 -1
- package/dist/core/discovery/cluster-view.d.ts +1 -0
- package/dist/core/discovery/cluster-view.d.ts.map +1 -1
- package/dist/core/discovery/cluster-view.js +23 -17
- package/dist/core/discovery/cluster-view.js.map +1 -1
- package/dist/core/discovery/topology.d.ts +1 -0
- package/dist/core/discovery/topology.d.ts.map +1 -1
- package/dist/core/discovery/topology.js +9 -1
- package/dist/core/discovery/topology.js.map +1 -1
- package/dist/core/provisioning/cluster-provisioner.d.ts +99 -0
- package/dist/core/provisioning/cluster-provisioner.d.ts.map +1 -0
- package/dist/core/provisioning/cluster-provisioner.js +415 -0
- package/dist/core/provisioning/cluster-provisioner.js.map +1 -0
- package/dist/core/provisioning/index.d.ts +12 -0
- package/dist/core/provisioning/index.d.ts.map +1 -0
- package/dist/core/provisioning/index.js +21 -0
- package/dist/core/provisioning/index.js.map +1 -0
- package/dist/core/provisioning/predefined-templates.d.ts +43 -0
- package/dist/core/provisioning/predefined-templates.d.ts.map +1 -0
- package/dist/core/provisioning/predefined-templates.js +117 -0
- package/dist/core/provisioning/predefined-templates.js.map +1 -0
- package/dist/core/provisioning/template-manager.d.ts +113 -0
- package/dist/core/provisioning/template-manager.d.ts.map +1 -0
- package/dist/core/provisioning/template-manager.js +274 -0
- package/dist/core/provisioning/template-manager.js.map +1 -0
- package/dist/core/routing/proxysql-manager.d.ts +18 -0
- package/dist/core/routing/proxysql-manager.d.ts.map +1 -1
- package/dist/core/routing/proxysql-manager.js +129 -9
- package/dist/core/routing/proxysql-manager.js.map +1 -1
- package/dist/types/index.d.ts +52 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +45 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/database.d.ts.map +1 -1
- package/dist/utils/database.js +40 -0
- package/dist/utils/database.js.map +1 -1
- package/docker/Dockerfile.allinone +1 -1
- package/docker/Dockerfile.node +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ MySQL High Availability Management Platform with automatic failover, read/write
|
|
|
13
13
|
|
|
14
14
|
## Prerequisites
|
|
15
15
|
|
|
16
|
+
- **Node.js**: v22.22+ (for CLI)
|
|
16
17
|
- **Container Runtime**: Docker or Podman
|
|
17
18
|
- **Docker Compose**: docker-compose or podman-compose
|
|
18
19
|
|
|
@@ -120,7 +121,7 @@ After starting, access these services:
|
|
|
120
121
|
| Orchestrator | http://localhost:3000 | MySQL topology manager |
|
|
121
122
|
| Prometheus | http://localhost:9090 | Metrics collection |
|
|
122
123
|
| Grafana | http://localhost:3001 | Dashboards (admin/admin) |
|
|
123
|
-
| ProxySQL | localhost:6033 | MySQL traffic (
|
|
124
|
+
| ProxySQL | localhost:6033+ | MySQL traffic (per-cluster ports) |
|
|
124
125
|
| OpenClaw Gateway | ws://localhost:18789 | AI agent gateway |
|
|
125
126
|
| OpenClaw UI | http://localhost:18790 | AI control panel |
|
|
126
127
|
|
|
@@ -204,16 +205,62 @@ Available configuration keys:
|
|
|
204
205
|
|
|
205
206
|
### Cluster Management
|
|
206
207
|
|
|
208
|
+
ClawSQL uses a **provisioning-first approach** - create clusters from predefined templates for consistent, validated configurations.
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# Primary: Template-based provisioning (recommended)
|
|
212
|
+
/clusters provision # Interactive template selection
|
|
213
|
+
/clusters provision --template <name> --cluster <name> --hosts <h:p,...>
|
|
214
|
+
# Provision cluster from template
|
|
215
|
+
# First host becomes primary, rest become replicas
|
|
216
|
+
# Auto-configures replication and ProxySQL with dedicated port
|
|
217
|
+
|
|
218
|
+
/clusters quick <template> <cluster> <h:p,...> # Fast provisioning (minimal args)
|
|
219
|
+
/clusters deprovision <cluster> --force # Remove provisioned cluster
|
|
220
|
+
|
|
221
|
+
# View clusters and topology
|
|
222
|
+
/clusters list # List all clusters
|
|
223
|
+
/clusters topology [--name <cluster>] # Show topology
|
|
224
|
+
|
|
225
|
+
# Manual operations (for advanced use cases)
|
|
226
|
+
/clusters manual create --name <name> --primary <h:p> [--replicas <h:p,...>]
|
|
227
|
+
/clusters manual import --primary <h:p> # Import existing topology
|
|
228
|
+
/clusters manual sync [--name <cluster>] # Sync to ProxySQL
|
|
229
|
+
/clusters manual promote --name <cluster> --host <h:p> # Promote replica
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Predefined Templates
|
|
233
|
+
|
|
234
|
+
Templates are automatically initialized on platform startup. No need to create them manually:
|
|
235
|
+
|
|
236
|
+
| Template | Nodes | Mode | Use Case |
|
|
237
|
+
|----------|-------|------|----------|
|
|
238
|
+
| `dev-single` | 1 | async | Development/testing, CI/CD |
|
|
239
|
+
| `dev-replica` | 2 | async | Development with backup |
|
|
240
|
+
| `standard` | 3 | async | General production workloads |
|
|
241
|
+
| `ha-semisync` | 3 | semi-sync | Critical production, zero data loss |
|
|
242
|
+
| `read-heavy` | 5 | async | Analytics, reporting, high read throughput |
|
|
243
|
+
| `production-ha` | 4 | semi-sync | Mission-critical, enterprise databases |
|
|
244
|
+
| `geo-distributed` | 6 | async | Multi-region, disaster recovery |
|
|
245
|
+
|
|
246
|
+
Quick example:
|
|
247
|
+
```bash
|
|
248
|
+
# Provision a standard 3-node cluster
|
|
249
|
+
> /clusters quick standard mycluster mysql1:3306,mysql2:3306,mysql3:3306
|
|
250
|
+
Cluster "mycluster" ready at port 6033
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Template Management
|
|
254
|
+
|
|
207
255
|
```bash
|
|
208
|
-
/
|
|
209
|
-
/
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
--
|
|
213
|
-
|
|
214
|
-
/
|
|
215
|
-
/
|
|
216
|
-
/clusters remove-replica --name <cluster> --host <h:p> # Remove replica
|
|
256
|
+
/templates list # List available templates (includes predefined)
|
|
257
|
+
/templates create --name <name> # Create custom template
|
|
258
|
+
--replicas <n> Number of replicas (default: 2)
|
|
259
|
+
--mode <mode> Replication mode: async, semi-sync (default: async)
|
|
260
|
+
--description <desc> Optional description
|
|
261
|
+
|
|
262
|
+
/templates show <name> # Show template details
|
|
263
|
+
/templates delete <name> --force # Delete custom template (predefined cannot be deleted)
|
|
217
264
|
```
|
|
218
265
|
|
|
219
266
|
### Failover Operations
|
|
@@ -307,13 +354,15 @@ Key settings:
|
|
|
307
354
|
┌─────────────────────────────────────────────────────────────────┐
|
|
308
355
|
│ ProxySQL │
|
|
309
356
|
│ (Read/Write Splitting) │
|
|
310
|
-
│
|
|
357
|
+
│ Per-Cluster Ports: 6033 (cluster1), 6034 (cluster2), ... │
|
|
358
|
+
│ Port 6032 - Admin Interface │
|
|
311
359
|
└───────────────┬─────────────────────────────┬───────────────────┘
|
|
312
360
|
│ │
|
|
313
361
|
┌───────▼───────┐ ┌───────▼───────┐
|
|
314
362
|
│ Primary │ │ Replica │
|
|
315
363
|
│ (Writer) │────────────▶│ (Reader) │
|
|
316
|
-
│
|
|
364
|
+
│ Hostgroup N │ Repl │ Hostgroup N+10│
|
|
365
|
+
│ Port 3306 │ │ Port 3306 │
|
|
317
366
|
└───────────────┘ └───────────────┘
|
|
318
367
|
│ │
|
|
319
368
|
└──────────────┬──────────────┘
|
|
@@ -324,10 +373,11 @@ Key settings:
|
|
|
324
373
|
│ │ Orchestrator│ │ Failover │ │ Monitoring │ │
|
|
325
374
|
│ │ Client │ │ Engine │ │ Service │ │
|
|
326
375
|
│ └─────────────┘ └─────────────┘ └─────────────┘ │
|
|
327
|
-
│
|
|
328
|
-
│ │ OpenClaw AI Gateway
|
|
329
|
-
│ │ Port 18789 - Gateway | Port 18790
|
|
330
|
-
│
|
|
376
|
+
│ ┌─────────────┐ ┌─────────────────────────────────────────────┐│
|
|
377
|
+
│ │ Provisioning│ │ OpenClaw AI Gateway ││
|
|
378
|
+
│ │ Engine │ │ Port 18789 - Gateway | Port 18790 ││
|
|
379
|
+
│ │ (Templates) │ └─────────────────────────────────────────────┘│
|
|
380
|
+
│ └─────────────┘ │
|
|
331
381
|
└─────────────────────────────────────────────────────────────────┘
|
|
332
382
|
```
|
|
333
383
|
|
|
@@ -375,9 +425,11 @@ clawsql/
|
|
|
375
425
|
│ │ ├── discovery/ # Instance discovery and topology
|
|
376
426
|
│ │ ├── monitoring/ # Metrics and health checks
|
|
377
427
|
│ │ ├── failover/ # Failover operations
|
|
428
|
+
│ │ ├── provisioning/ # Template-based cluster provisioning
|
|
378
429
|
│ │ └── routing/ # ProxySQL integration
|
|
379
430
|
│ ├── api/ # REST API routes
|
|
380
431
|
│ ├── cli/ # CLI commands
|
|
432
|
+
│ │ └── utils/ # CLI utilities (arg parsing, etc.)
|
|
381
433
|
│ ├── utils/ # Utilities
|
|
382
434
|
│ └── __tests__/ # Test files
|
|
383
435
|
├── docker/ # Docker configurations
|
|
@@ -137,6 +137,7 @@ export declare const InstanceListResponse: z.ZodObject<{
|
|
|
137
137
|
page: z.ZodNumber;
|
|
138
138
|
page_size: z.ZodNumber;
|
|
139
139
|
}, "strip", z.ZodTypeAny, {
|
|
140
|
+
total: number;
|
|
140
141
|
page: number;
|
|
141
142
|
page_size: number;
|
|
142
143
|
items: {
|
|
@@ -153,8 +154,8 @@ export declare const InstanceListResponse: z.ZodObject<{
|
|
|
153
154
|
last_seen: Date;
|
|
154
155
|
created_at: Date;
|
|
155
156
|
}[];
|
|
156
|
-
total: number;
|
|
157
157
|
}, {
|
|
158
|
+
total: number;
|
|
158
159
|
page: number;
|
|
159
160
|
page_size: number;
|
|
160
161
|
items: {
|
|
@@ -171,7 +172,6 @@ export declare const InstanceListResponse: z.ZodObject<{
|
|
|
171
172
|
last_seen: Date;
|
|
172
173
|
created_at: Date;
|
|
173
174
|
}[];
|
|
174
|
-
total: number;
|
|
175
175
|
}>;
|
|
176
176
|
export declare const InstanceMetricsResponse: z.ZodObject<{
|
|
177
177
|
instance_id: z.ZodString;
|
|
@@ -294,7 +294,7 @@ export declare const DiscoveryResponse: z.ZodObject<{
|
|
|
294
294
|
started_at: z.ZodOptional<z.ZodDate>;
|
|
295
295
|
completed_at: z.ZodOptional<z.ZodDate>;
|
|
296
296
|
}, "strip", z.ZodTypeAny, {
|
|
297
|
-
status: "failed" | "completed" | "
|
|
297
|
+
status: "failed" | "completed" | "pending" | "running";
|
|
298
298
|
network_segments: string[];
|
|
299
299
|
task_id: string;
|
|
300
300
|
instances_found: number;
|
|
@@ -316,7 +316,7 @@ export declare const DiscoveryResponse: z.ZodObject<{
|
|
|
316
316
|
started_at?: Date | undefined;
|
|
317
317
|
completed_at?: Date | undefined;
|
|
318
318
|
}, {
|
|
319
|
-
status: "failed" | "completed" | "
|
|
319
|
+
status: "failed" | "completed" | "pending" | "running";
|
|
320
320
|
network_segments: string[];
|
|
321
321
|
task_id: string;
|
|
322
322
|
instances_found: number;
|
|
@@ -675,6 +675,7 @@ export declare const ClusterListResponse: z.ZodObject<{
|
|
|
675
675
|
page: z.ZodNumber;
|
|
676
676
|
page_size: z.ZodNumber;
|
|
677
677
|
}, "strip", z.ZodTypeAny, {
|
|
678
|
+
total: number;
|
|
678
679
|
page: number;
|
|
679
680
|
page_size: number;
|
|
680
681
|
items: {
|
|
@@ -714,8 +715,8 @@ export declare const ClusterListResponse: z.ZodObject<{
|
|
|
714
715
|
health_status: "unknown" | "healthy" | "degraded" | "unhealthy";
|
|
715
716
|
updated_at: Date;
|
|
716
717
|
}[];
|
|
717
|
-
total: number;
|
|
718
718
|
}, {
|
|
719
|
+
total: number;
|
|
719
720
|
page: number;
|
|
720
721
|
page_size: number;
|
|
721
722
|
items: {
|
|
@@ -755,7 +756,6 @@ export declare const ClusterListResponse: z.ZodObject<{
|
|
|
755
756
|
health_status: "unknown" | "healthy" | "degraded" | "unhealthy";
|
|
756
757
|
updated_at: Date;
|
|
757
758
|
}[];
|
|
758
|
-
total: number;
|
|
759
759
|
}>;
|
|
760
760
|
export declare const FailoverStateSchema: z.ZodEnum<["idle", "detecting", "candidate_selection", "promoting", "reconfiguring", "completed", "failed"]>;
|
|
761
761
|
export declare const FailoverRequest: z.ZodObject<{
|
|
@@ -785,10 +785,10 @@ export declare const FailoverOperationResponse: z.ZodObject<{
|
|
|
785
785
|
}, "strip", z.ZodTypeAny, {
|
|
786
786
|
error: string | null;
|
|
787
787
|
state: "failed" | "idle" | "detecting" | "candidate_selection" | "promoting" | "reconfiguring" | "completed";
|
|
788
|
-
reason: string | null;
|
|
789
|
-
cluster_id: string;
|
|
790
788
|
steps: string[];
|
|
791
789
|
manual: boolean;
|
|
790
|
+
reason: string | null;
|
|
791
|
+
cluster_id: string;
|
|
792
792
|
operation_id: string;
|
|
793
793
|
started_at: string | null;
|
|
794
794
|
completed_at: string | null;
|
|
@@ -799,10 +799,10 @@ export declare const FailoverOperationResponse: z.ZodObject<{
|
|
|
799
799
|
}, {
|
|
800
800
|
error: string | null;
|
|
801
801
|
state: "failed" | "idle" | "detecting" | "candidate_selection" | "promoting" | "reconfiguring" | "completed";
|
|
802
|
-
reason: string | null;
|
|
803
|
-
cluster_id: string;
|
|
804
802
|
steps: string[];
|
|
805
803
|
manual: boolean;
|
|
804
|
+
reason: string | null;
|
|
805
|
+
cluster_id: string;
|
|
806
806
|
operation_id: string;
|
|
807
807
|
started_at: string | null;
|
|
808
808
|
completed_at: string | null;
|
|
@@ -829,10 +829,10 @@ export declare const FailoverListResponse: z.ZodObject<{
|
|
|
829
829
|
}, "strip", z.ZodTypeAny, {
|
|
830
830
|
error: string | null;
|
|
831
831
|
state: "failed" | "idle" | "detecting" | "candidate_selection" | "promoting" | "reconfiguring" | "completed";
|
|
832
|
-
reason: string | null;
|
|
833
|
-
cluster_id: string;
|
|
834
832
|
steps: string[];
|
|
835
833
|
manual: boolean;
|
|
834
|
+
reason: string | null;
|
|
835
|
+
cluster_id: string;
|
|
836
836
|
operation_id: string;
|
|
837
837
|
started_at: string | null;
|
|
838
838
|
completed_at: string | null;
|
|
@@ -843,10 +843,10 @@ export declare const FailoverListResponse: z.ZodObject<{
|
|
|
843
843
|
}, {
|
|
844
844
|
error: string | null;
|
|
845
845
|
state: "failed" | "idle" | "detecting" | "candidate_selection" | "promoting" | "reconfiguring" | "completed";
|
|
846
|
-
reason: string | null;
|
|
847
|
-
cluster_id: string;
|
|
848
846
|
steps: string[];
|
|
849
847
|
manual: boolean;
|
|
848
|
+
reason: string | null;
|
|
849
|
+
cluster_id: string;
|
|
850
850
|
operation_id: string;
|
|
851
851
|
started_at: string | null;
|
|
852
852
|
completed_at: string | null;
|
|
@@ -857,13 +857,14 @@ export declare const FailoverListResponse: z.ZodObject<{
|
|
|
857
857
|
}>, "many">;
|
|
858
858
|
total: z.ZodNumber;
|
|
859
859
|
}, "strip", z.ZodTypeAny, {
|
|
860
|
+
total: number;
|
|
860
861
|
items: {
|
|
861
862
|
error: string | null;
|
|
862
863
|
state: "failed" | "idle" | "detecting" | "candidate_selection" | "promoting" | "reconfiguring" | "completed";
|
|
863
|
-
reason: string | null;
|
|
864
|
-
cluster_id: string;
|
|
865
864
|
steps: string[];
|
|
866
865
|
manual: boolean;
|
|
866
|
+
reason: string | null;
|
|
867
|
+
cluster_id: string;
|
|
867
868
|
operation_id: string;
|
|
868
869
|
started_at: string | null;
|
|
869
870
|
completed_at: string | null;
|
|
@@ -872,15 +873,15 @@ export declare const FailoverListResponse: z.ZodObject<{
|
|
|
872
873
|
duration_seconds: number | null;
|
|
873
874
|
triggered_by: string | null;
|
|
874
875
|
}[];
|
|
875
|
-
total: number;
|
|
876
876
|
}, {
|
|
877
|
+
total: number;
|
|
877
878
|
items: {
|
|
878
879
|
error: string | null;
|
|
879
880
|
state: "failed" | "idle" | "detecting" | "candidate_selection" | "promoting" | "reconfiguring" | "completed";
|
|
880
|
-
reason: string | null;
|
|
881
|
-
cluster_id: string;
|
|
882
881
|
steps: string[];
|
|
883
882
|
manual: boolean;
|
|
883
|
+
reason: string | null;
|
|
884
|
+
cluster_id: string;
|
|
884
885
|
operation_id: string;
|
|
885
886
|
started_at: string | null;
|
|
886
887
|
completed_at: string | null;
|
|
@@ -889,7 +890,6 @@ export declare const FailoverListResponse: z.ZodObject<{
|
|
|
889
890
|
duration_seconds: number | null;
|
|
890
891
|
triggered_by: string | null;
|
|
891
892
|
}[];
|
|
892
|
-
total: number;
|
|
893
893
|
}>;
|
|
894
894
|
export declare const HealthStatusResponse: z.ZodObject<{
|
|
895
895
|
status: z.ZodEnum<["healthy", "unhealthy"]>;
|
package/dist/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAGL,eAAe,EAChB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAGL,eAAe,EAChB,MAAM,2BAA2B,CAAC;AAkBnC;;GAEG;AACH,wBAAsB,SAAS,wSAsI9B;AAED;;GAEG;AACH,wBAAsB,WAAW,wSAwDhC"}
|
package/dist/app.js
CHANGED
|
@@ -18,6 +18,7 @@ const settings_js_1 = require("./config/settings.js");
|
|
|
18
18
|
const logger_js_1 = require("./utils/logger.js");
|
|
19
19
|
const database_js_1 = require("./utils/database.js");
|
|
20
20
|
const exceptions_js_1 = require("./utils/exceptions.js");
|
|
21
|
+
const index_js_1 = require("./core/provisioning/index.js");
|
|
21
22
|
// Import routes
|
|
22
23
|
const instances_js_1 = __importDefault(require("./api/routes/instances.js"));
|
|
23
24
|
const clusters_js_1 = __importDefault(require("./api/routes/clusters.js"));
|
|
@@ -161,6 +162,17 @@ async function startServer() {
|
|
|
161
162
|
// Initialize database
|
|
162
163
|
try {
|
|
163
164
|
await (0, database_js_1.initDatabase)();
|
|
165
|
+
// Initialize predefined templates for cluster provisioning
|
|
166
|
+
try {
|
|
167
|
+
const templateManager = (0, index_js_1.getTemplateManager)();
|
|
168
|
+
const templatesCreated = await templateManager.initializePredefinedTemplates();
|
|
169
|
+
if (templatesCreated > 0) {
|
|
170
|
+
fastify.log.info(`Initialized ${templatesCreated} predefined templates`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
fastify.log.warn({ error }, 'Failed to initialize predefined templates, continuing with existing templates');
|
|
175
|
+
}
|
|
164
176
|
}
|
|
165
177
|
catch (error) {
|
|
166
178
|
fastify.log.warn({ error }, 'Failed to initialize database, continuing without persistence');
|
package/dist/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AAgCH,8BAsIC;AAKD,kCAwDC;AAjOD,sDAAgD;AAChD,yDAAiC;AACjC,6DAAqC;AACrC,+DAAuC;AACvC,qEAA4C;AAC5C,yEAImC;AACnC,sDAAmD;AACnD,iDAAgD;AAChD,qDAAmD;AACnD,yDAAqD;AACrD,2DAAkE;AAElE,gBAAgB;AAChB,6EAAwD;AACxD,2EAAsD;AACtD,2EAAsD;AACtD,+EAA0D;AAC1D,uEAAkD;AAClD,2EAAqD;AAErD,uBAAuB;AACvB,yEAAqE;AAErE;;GAEG;AACI,KAAK,UAAU,SAAS;IAC7B,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAC/B,IAAA,uBAAW,GAAE,CAAC;IAEd,MAAM,OAAO,GAAG,IAAA,iBAAO,EAAC;QACtB,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,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CAAC;YACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC;QAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;QACjD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QAE/C,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/dist/bin/clawsql.js
CHANGED
|
File without changes
|
|
@@ -10,6 +10,6 @@ export { loadAIConfig } from './providers/base.js';
|
|
|
10
10
|
export { AnthropicProvider, getAnthropicProvider } from './providers/anthropic.js';
|
|
11
11
|
export { OpenAIProvider, getOpenAIProvider } from './providers/openai.js';
|
|
12
12
|
export { createAgentTools } from './tools/index.js';
|
|
13
|
-
export { OpenClawAgent, createOpenClawAgent, isOpenClawAvailable, isDockerOpenClawAvailable, isLocalOpenClawAvailable, isGatewayHealthy, getOpenClawStatus, ensureOpenClawRunning, sendToOpenClaw, sendToOpenClawStream, scheduleCron, sendNotification, writeToMemory, getModelProviderInfo, configureModelProvider, testOpenClawConnection, getDetailedOpenClawStatus, SUPPORTED_PROVIDERS, } from './openclaw-integration.js';
|
|
13
|
+
export { OpenClawAgent, createOpenClawAgent, isOpenClawAvailable, isDockerOpenClawAvailable, isLocalOpenClawAvailable, isGatewayHealthy, getOpenClawStatus, ensureOpenClawRunning, sendToOpenClaw, sendToOpenClawStream, scheduleCron, sendNotification, writeToMemory, getModelProviderInfo, configureModelProvider, testOpenClawConnection, getDetailedOpenClawStatus, printUnknownGatewayGuidance, INTERNAL_CLUSTER_PREFIXES, INTERNAL_CLUSTER_NAMES, SUPPORTED_PROVIDERS, } from './openclaw-integration.js';
|
|
14
14
|
export type { ModelProviderInfo, OpenClawOptions, OpenClawStatus } from './openclaw-integration.js';
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/agent/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtD,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAClH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/agent/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtD,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAClH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,EAC3B,yBAAyB,EACzB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/cli/agent/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Exports for the AI agent system.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.SUPPORTED_PROVIDERS = exports.getDetailedOpenClawStatus = exports.testOpenClawConnection = exports.configureModelProvider = exports.getModelProviderInfo = exports.writeToMemory = exports.sendNotification = exports.scheduleCron = exports.sendToOpenClawStream = exports.sendToOpenClaw = exports.ensureOpenClawRunning = exports.getOpenClawStatus = exports.isGatewayHealthy = exports.isLocalOpenClawAvailable = exports.isDockerOpenClawAvailable = exports.isOpenClawAvailable = exports.createOpenClawAgent = exports.OpenClawAgent = exports.createAgentTools = exports.getOpenAIProvider = exports.OpenAIProvider = exports.getAnthropicProvider = exports.AnthropicProvider = exports.loadAIConfig = exports.createAIAgent = exports.AIAgent = void 0;
|
|
8
|
+
exports.SUPPORTED_PROVIDERS = exports.INTERNAL_CLUSTER_NAMES = exports.INTERNAL_CLUSTER_PREFIXES = exports.printUnknownGatewayGuidance = exports.getDetailedOpenClawStatus = exports.testOpenClawConnection = exports.configureModelProvider = exports.getModelProviderInfo = exports.writeToMemory = exports.sendNotification = exports.scheduleCron = exports.sendToOpenClawStream = exports.sendToOpenClaw = exports.ensureOpenClawRunning = exports.getOpenClawStatus = exports.isGatewayHealthy = exports.isLocalOpenClawAvailable = exports.isDockerOpenClawAvailable = exports.isOpenClawAvailable = exports.createOpenClawAgent = exports.OpenClawAgent = exports.createAgentTools = exports.getOpenAIProvider = exports.OpenAIProvider = exports.getAnthropicProvider = exports.AnthropicProvider = exports.loadAIConfig = exports.createAIAgent = exports.AIAgent = void 0;
|
|
9
9
|
var handler_js_1 = require("./handler.js");
|
|
10
10
|
Object.defineProperty(exports, "AIAgent", { enumerable: true, get: function () { return handler_js_1.AIAgent; } });
|
|
11
11
|
Object.defineProperty(exports, "createAIAgent", { enumerable: true, get: function () { return handler_js_1.createAIAgent; } });
|
|
@@ -37,5 +37,8 @@ Object.defineProperty(exports, "getModelProviderInfo", { enumerable: true, get:
|
|
|
37
37
|
Object.defineProperty(exports, "configureModelProvider", { enumerable: true, get: function () { return openclaw_integration_js_1.configureModelProvider; } });
|
|
38
38
|
Object.defineProperty(exports, "testOpenClawConnection", { enumerable: true, get: function () { return openclaw_integration_js_1.testOpenClawConnection; } });
|
|
39
39
|
Object.defineProperty(exports, "getDetailedOpenClawStatus", { enumerable: true, get: function () { return openclaw_integration_js_1.getDetailedOpenClawStatus; } });
|
|
40
|
+
Object.defineProperty(exports, "printUnknownGatewayGuidance", { enumerable: true, get: function () { return openclaw_integration_js_1.printUnknownGatewayGuidance; } });
|
|
41
|
+
Object.defineProperty(exports, "INTERNAL_CLUSTER_PREFIXES", { enumerable: true, get: function () { return openclaw_integration_js_1.INTERNAL_CLUSTER_PREFIXES; } });
|
|
42
|
+
Object.defineProperty(exports, "INTERNAL_CLUSTER_NAMES", { enumerable: true, get: function () { return openclaw_integration_js_1.INTERNAL_CLUSTER_NAMES; } });
|
|
40
43
|
Object.defineProperty(exports, "SUPPORTED_PROVIDERS", { enumerable: true, get: function () { return openclaw_integration_js_1.SUPPORTED_PROVIDERS; } });
|
|
41
44
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/agent/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,2CAAsD;AAA7C,qGAAA,OAAO,OAAA;AAAE,2GAAA,aAAa,OAAA;AAG/B,+CAAmD;AAA1C,uGAAA,YAAY,OAAA;AACrB,yDAAmF;AAA1E,iHAAA,iBAAiB,OAAA;AAAE,oHAAA,oBAAoB,OAAA;AAChD,mDAA0E;AAAjE,2GAAA,cAAc,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AAC1C,6CAAoD;AAA3C,4GAAA,gBAAgB,OAAA;AACzB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/agent/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,2CAAsD;AAA7C,qGAAA,OAAO,OAAA;AAAE,2GAAA,aAAa,OAAA;AAG/B,+CAAmD;AAA1C,uGAAA,YAAY,OAAA;AACrB,yDAAmF;AAA1E,iHAAA,iBAAiB,OAAA;AAAE,oHAAA,oBAAoB,OAAA;AAChD,mDAA0E;AAAjE,2GAAA,cAAc,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AAC1C,6CAAoD;AAA3C,4GAAA,gBAAgB,OAAA;AACzB,qEAsBmC;AArBjC,wHAAA,aAAa,OAAA;AACb,8HAAA,mBAAmB,OAAA;AACnB,8HAAA,mBAAmB,OAAA;AACnB,oIAAA,yBAAyB,OAAA;AACzB,mIAAA,wBAAwB,OAAA;AACxB,2HAAA,gBAAgB,OAAA;AAChB,4HAAA,iBAAiB,OAAA;AACjB,gIAAA,qBAAqB,OAAA;AACrB,yHAAA,cAAc,OAAA;AACd,+HAAA,oBAAoB,OAAA;AACpB,uHAAA,YAAY,OAAA;AACZ,2HAAA,gBAAgB,OAAA;AAChB,wHAAA,aAAa,OAAA;AACb,+HAAA,oBAAoB,OAAA;AACpB,iIAAA,sBAAsB,OAAA;AACtB,iIAAA,sBAAsB,OAAA;AACtB,oIAAA,yBAAyB,OAAA;AACzB,sIAAA,2BAA2B,OAAA;AAC3B,oIAAA,yBAAyB,OAAA;AACzB,iIAAA,sBAAsB,OAAA;AACtB,8HAAA,mBAAmB,OAAA"}
|
|
@@ -13,6 +13,11 @@ export declare const CONFIG: {
|
|
|
13
13
|
healthCheckTimeout: number;
|
|
14
14
|
containerName: string;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Internal cluster names to filter out from topology
|
|
18
|
+
*/
|
|
19
|
+
export declare const INTERNAL_CLUSTER_PREFIXES: string[];
|
|
20
|
+
export declare const INTERNAL_CLUSTER_NAMES: string[];
|
|
16
21
|
export interface OpenClawOptions {
|
|
17
22
|
gatewayUrl?: string;
|
|
18
23
|
gatewayToken?: string;
|
|
@@ -23,6 +28,10 @@ export interface OpenClawStatus {
|
|
|
23
28
|
available: boolean;
|
|
24
29
|
isLocal: boolean;
|
|
25
30
|
isDocker: boolean;
|
|
31
|
+
/** Gateway is healthy but source is unknown (no CLI, no Docker container) */
|
|
32
|
+
isUnknown: boolean;
|
|
33
|
+
/** Error message explaining why available=false */
|
|
34
|
+
error?: string;
|
|
26
35
|
}
|
|
27
36
|
export interface ModelProviderInfo {
|
|
28
37
|
provider: string | null;
|
|
@@ -39,6 +48,8 @@ export declare function isDockerOpenClawAvailable(): Promise<boolean>;
|
|
|
39
48
|
export declare function isGatewayHealthy(): Promise<boolean>;
|
|
40
49
|
/**
|
|
41
50
|
* Check if local OpenClaw CLI is running (not in container)
|
|
51
|
+
* This checks if the gateway is healthy AND the openclaw CLI reports local mode.
|
|
52
|
+
* Note: This does NOT check for Docker - Docker and local can coexist.
|
|
42
53
|
*/
|
|
43
54
|
export declare function isLocalOpenClawAvailable(): Promise<boolean>;
|
|
44
55
|
/**
|
|
@@ -48,6 +59,8 @@ export declare function isLocalOpenClawAvailable(): Promise<boolean>;
|
|
|
48
59
|
export declare function isOpenClawAvailable(): Promise<boolean>;
|
|
49
60
|
/**
|
|
50
61
|
* Get OpenClaw status summary
|
|
62
|
+
* Prioritizes local installation over Docker container.
|
|
63
|
+
* Returns error if gateway is healthy but source is unknown (no CLI, no Docker).
|
|
51
64
|
*/
|
|
52
65
|
export declare function getOpenClawStatus(): Promise<OpenClawStatus>;
|
|
53
66
|
/**
|
|
@@ -137,11 +150,12 @@ export declare function testOpenClawConnection(query?: string): Promise<{
|
|
|
137
150
|
*/
|
|
138
151
|
export declare function getDetailedOpenClawStatus(): Promise<{
|
|
139
152
|
available: boolean;
|
|
140
|
-
mode: 'docker' | 'local' | 'unavailable';
|
|
153
|
+
mode: 'docker' | 'local' | 'unknown' | 'unavailable';
|
|
141
154
|
gatewayHealthy: boolean;
|
|
142
155
|
modelInfo: ModelProviderInfo;
|
|
143
156
|
controlUI: string;
|
|
144
157
|
gatewayUrl: string;
|
|
158
|
+
error?: string;
|
|
145
159
|
}>;
|
|
146
160
|
/** @deprecated Use isDockerOpenClawAvailable */
|
|
147
161
|
export declare const isDockerOpenClawContainerRunning: typeof isDockerOpenClawAvailable;
|
|
@@ -149,4 +163,9 @@ export declare const isDockerOpenClawContainerRunning: typeof isDockerOpenClawAv
|
|
|
149
163
|
export declare const isOpenClawGatewayReachable: typeof isGatewayHealthy;
|
|
150
164
|
/** @deprecated Use isGatewayHealthy() in a loop */
|
|
151
165
|
export declare function ensureOpenClawRunning(timeoutSeconds?: number): Promise<boolean>;
|
|
166
|
+
/**
|
|
167
|
+
* Print guidance for unknown gateway status
|
|
168
|
+
* Used by both /start and /openclaw status commands
|
|
169
|
+
*/
|
|
170
|
+
export declare function printUnknownGatewayGuidance(error: string | undefined, log: (msg: string) => void): void;
|
|
152
171
|
//# sourceMappingURL=openclaw-integration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openclaw-integration.d.ts","sourceRoot":"","sources":["../../../src/cli/agent/openclaw-integration.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAU5C,eAAO,MAAM,MAAM;;;;;;;CAOlB,CAAC;
|
|
1
|
+
{"version":3,"file":"openclaw-integration.d.ts","sourceRoot":"","sources":["../../../src/cli/agent/openclaw-integration.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAU5C,eAAO,MAAM,MAAM;;;;;;;CAOlB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,UAAuC,CAAC;AAC9E,eAAO,MAAM,sBAAsB,UAAY,CAAC;AAgBhD,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,SAAS,EAAE,OAAO,CAAC;IACnB,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACr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AM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAgBD;AAMD,gDAAgD;AAChD,eAAO,MAAM,gCAAgC,kCAA4B,CAAC;AAE1E,uCAAuC;AACvC,eAAO,MAAM,0BAA0B,yBAAmB,CAAC;AAE3D,mDAAmD;AACnD,wBAAsB,qBAAqB,CAAC,cAAc,SAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAOjF;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GACzB,IAAI,CAWN"}
|
|
@@ -39,7 +39,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
39
39
|
};
|
|
40
40
|
})();
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.isOpenClawGatewayReachable = exports.isDockerOpenClawContainerRunning = exports.SUPPORTED_PROVIDERS = exports.OpenClawAgent = exports.CONFIG = void 0;
|
|
42
|
+
exports.isOpenClawGatewayReachable = exports.isDockerOpenClawContainerRunning = exports.SUPPORTED_PROVIDERS = exports.OpenClawAgent = exports.INTERNAL_CLUSTER_NAMES = exports.INTERNAL_CLUSTER_PREFIXES = exports.CONFIG = void 0;
|
|
43
43
|
exports.isDockerOpenClawAvailable = isDockerOpenClawAvailable;
|
|
44
44
|
exports.isGatewayHealthy = isGatewayHealthy;
|
|
45
45
|
exports.isLocalOpenClawAvailable = isLocalOpenClawAvailable;
|
|
@@ -56,6 +56,7 @@ exports.configureModelProvider = configureModelProvider;
|
|
|
56
56
|
exports.testOpenClawConnection = testOpenClawConnection;
|
|
57
57
|
exports.getDetailedOpenClawStatus = getDetailedOpenClawStatus;
|
|
58
58
|
exports.ensureOpenClawRunning = ensureOpenClawRunning;
|
|
59
|
+
exports.printUnknownGatewayGuidance = printUnknownGatewayGuidance;
|
|
59
60
|
const child_process_1 = require("child_process");
|
|
60
61
|
const fs = __importStar(require("fs"));
|
|
61
62
|
const path = __importStar(require("path"));
|
|
@@ -72,6 +73,11 @@ exports.CONFIG = {
|
|
|
72
73
|
healthCheckTimeout: 5000,
|
|
73
74
|
containerName: 'openclaw',
|
|
74
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* Internal cluster names to filter out from topology
|
|
78
|
+
*/
|
|
79
|
+
exports.INTERNAL_CLUSTER_PREFIXES = ['metadata-mysql', 'metadata_mysql'];
|
|
80
|
+
exports.INTERNAL_CLUSTER_NAMES = ['mysql'];
|
|
75
81
|
// Cached runtime detection
|
|
76
82
|
let cachedRuntime;
|
|
77
83
|
async function getContainerRuntime() {
|
|
@@ -255,18 +261,22 @@ async function isGatewayHealthy() {
|
|
|
255
261
|
}
|
|
256
262
|
/**
|
|
257
263
|
* Check if local OpenClaw CLI is running (not in container)
|
|
264
|
+
* This checks if the gateway is healthy AND the openclaw CLI reports local mode.
|
|
265
|
+
* Note: This does NOT check for Docker - Docker and local can coexist.
|
|
258
266
|
*/
|
|
259
267
|
async function isLocalOpenClawAvailable() {
|
|
260
|
-
if (
|
|
261
|
-
|
|
262
|
-
if (!(await isGatewayHealthy()))
|
|
268
|
+
// First check if gateway is healthy (fast HTTP check)
|
|
269
|
+
if (!(await isGatewayHealthy())) {
|
|
263
270
|
return false;
|
|
271
|
+
}
|
|
272
|
+
// Then check if openclaw CLI reports local mode
|
|
264
273
|
const result = await execCommand('openclaw', ['status', '--json'], { timeout: exports.CONFIG.healthCheckTimeout });
|
|
265
274
|
if (!result.success)
|
|
266
275
|
return false;
|
|
267
276
|
try {
|
|
268
277
|
const status = JSON.parse(result.stdout);
|
|
269
|
-
|
|
278
|
+
// Local mode can be 'local' or the gateway might just be running locally
|
|
279
|
+
return (status.gateway?.mode === 'local' || status.gateway?.mode === 'standalone') && !!status.gateway?.url;
|
|
270
280
|
}
|
|
271
281
|
catch {
|
|
272
282
|
return false;
|
|
@@ -284,15 +294,57 @@ async function isOpenClawAvailable() {
|
|
|
284
294
|
// Fallback: check if container is running (slower, spawns subprocess)
|
|
285
295
|
return isDockerOpenClawAvailable();
|
|
286
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* Check if openclaw CLI binary exists
|
|
299
|
+
*/
|
|
300
|
+
async function isOpenClawCLIInstalled() {
|
|
301
|
+
const result = await execCommand('which', ['openclaw'], { timeout: 2000 });
|
|
302
|
+
return result.success && result.stdout.trim().length > 0;
|
|
303
|
+
}
|
|
287
304
|
/**
|
|
288
305
|
* Get OpenClaw status summary
|
|
306
|
+
* Prioritizes local installation over Docker container.
|
|
307
|
+
* Returns error if gateway is healthy but source is unknown (no CLI, no Docker).
|
|
289
308
|
*/
|
|
290
309
|
async function getOpenClawStatus() {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
310
|
+
// Check gateway health first (fast HTTP check)
|
|
311
|
+
const gatewayHealthy = await isGatewayHealthy();
|
|
312
|
+
if (!gatewayHealthy) {
|
|
313
|
+
// Gateway not healthy - check if Docker container exists at all
|
|
314
|
+
const isDocker = await isDockerOpenClawAvailable();
|
|
315
|
+
return { available: isDocker, isDocker, isLocal: false, isUnknown: false };
|
|
316
|
+
}
|
|
317
|
+
// Gateway is healthy - determine if it's local or Docker
|
|
318
|
+
// Check for local OpenClaw CLI first (prioritize local over Docker)
|
|
319
|
+
const isLocal = await isLocalOpenClawAvailable();
|
|
320
|
+
if (isLocal) {
|
|
321
|
+
return { available: true, isDocker: false, isLocal: true, isUnknown: false };
|
|
322
|
+
}
|
|
323
|
+
// Gateway is healthy but not local - check if Docker container is running
|
|
324
|
+
const isDocker = await isDockerOpenClawAvailable();
|
|
325
|
+
if (isDocker) {
|
|
326
|
+
return { available: true, isDocker: true, isLocal: false, isUnknown: false };
|
|
327
|
+
}
|
|
328
|
+
// Gateway is healthy but we can't determine source - this is problematic
|
|
329
|
+
// Either a local gateway is running without CLI, or something else is using port 18789
|
|
330
|
+
const cliInstalled = await isOpenClawCLIInstalled();
|
|
331
|
+
if (!cliInstalled) {
|
|
332
|
+
return {
|
|
333
|
+
available: false,
|
|
334
|
+
isDocker: false,
|
|
335
|
+
isLocal: false,
|
|
336
|
+
isUnknown: true,
|
|
337
|
+
error: 'Gateway is running on port 18789 but openclaw CLI is not installed. Install the CLI or stop the gateway to use Docker.',
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
// CLI exists but couldn't get status - still problematic
|
|
341
|
+
return {
|
|
342
|
+
available: false,
|
|
343
|
+
isDocker: false,
|
|
344
|
+
isLocal: false,
|
|
345
|
+
isUnknown: true,
|
|
346
|
+
error: 'Gateway is running but unable to determine its source. Check OpenClaw installation.',
|
|
347
|
+
};
|
|
296
348
|
}
|
|
297
349
|
// ============================================================================
|
|
298
350
|
// Agent Functions
|
|
@@ -498,15 +550,18 @@ async function testOpenClawConnection(query = 'Hello') {
|
|
|
498
550
|
*/
|
|
499
551
|
async function getDetailedOpenClawStatus() {
|
|
500
552
|
const status = await getOpenClawStatus();
|
|
501
|
-
|
|
553
|
+
// For unknown status, gateway is healthy (that's why we detected it)
|
|
554
|
+
// For unavailable, gateway is not healthy
|
|
555
|
+
const gatewayHealthy = status.isUnknown || (status.available && await isGatewayHealthy());
|
|
502
556
|
const modelInfo = status.available ? await getModelProviderInfo() : { provider: null, model: null, configured: false };
|
|
503
557
|
return {
|
|
504
558
|
available: status.available,
|
|
505
|
-
mode: status.isDocker ? 'docker' : status.isLocal ? 'local' : 'unavailable',
|
|
559
|
+
mode: status.isUnknown ? 'unknown' : status.isDocker ? 'docker' : status.isLocal ? 'local' : 'unavailable',
|
|
506
560
|
gatewayHealthy,
|
|
507
561
|
modelInfo,
|
|
508
562
|
controlUI: 'http://localhost:18790',
|
|
509
563
|
gatewayUrl: exports.CONFIG.gatewayUrl,
|
|
564
|
+
error: status.error,
|
|
510
565
|
};
|
|
511
566
|
}
|
|
512
567
|
// ============================================================================
|
|
@@ -522,8 +577,24 @@ async function ensureOpenClawRunning(timeoutSeconds = 30) {
|
|
|
522
577
|
while (Date.now() < deadline) {
|
|
523
578
|
if (await isGatewayHealthy())
|
|
524
579
|
return true;
|
|
525
|
-
await new Promise(r => setTimeout(r,
|
|
580
|
+
await new Promise(r => setTimeout(r, 1000));
|
|
526
581
|
}
|
|
527
582
|
return false;
|
|
528
583
|
}
|
|
584
|
+
/**
|
|
585
|
+
* Print guidance for unknown gateway status
|
|
586
|
+
* Used by both /start and /openclaw status commands
|
|
587
|
+
*/
|
|
588
|
+
function printUnknownGatewayGuidance(error, log) {
|
|
589
|
+
log(` Gateway detected but source is unclear.`);
|
|
590
|
+
if (error) {
|
|
591
|
+
log(` ${error}`);
|
|
592
|
+
}
|
|
593
|
+
log('');
|
|
594
|
+
log(' Options:');
|
|
595
|
+
log(' 1. Install openclaw CLI to use local gateway');
|
|
596
|
+
log(' 2. Stop the gateway process to use Docker');
|
|
597
|
+
log(' Find process: ss -tlnp | grep 18789');
|
|
598
|
+
log(' Kill process: kill <PID>');
|
|
599
|
+
}
|
|
529
600
|
//# sourceMappingURL=openclaw-integration.js.map
|