@powerhousedao/switchboard 4.1.0-dev.9 → 4.1.0-staging.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/CHANGELOG.md +219 -0
- package/Dockerfile +4 -2
- package/dist/src/config.d.ts +1 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +1 -0
- package/dist/src/config.js.map +1 -1
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +103 -50
- package/dist/src/server.js.map +1 -1
- package/dist/src/types.d.ts +3 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,222 @@
|
|
|
1
|
+
## 4.1.0-staging.1 (2025-08-21)
|
|
2
|
+
|
|
3
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
4
|
+
|
|
5
|
+
## 4.1.0-dev.33 (2025-08-21)
|
|
6
|
+
|
|
7
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
8
|
+
|
|
9
|
+
## 4.1.0-dev.32 (2025-08-21)
|
|
10
|
+
|
|
11
|
+
### 🩹 Fixes
|
|
12
|
+
|
|
13
|
+
- **ph-cli:** resolve local document model loading in switchboard and vetra ([262f13035](https://github.com/powerhouse-inc/powerhouse/commit/262f13035))
|
|
14
|
+
|
|
15
|
+
### ❤️ Thank You
|
|
16
|
+
|
|
17
|
+
- Guillermo Puente @gpuente
|
|
18
|
+
|
|
19
|
+
## 4.1.0-dev.31 (2025-08-20)
|
|
20
|
+
|
|
21
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
22
|
+
|
|
23
|
+
## 4.1.0-dev.30 (2025-08-20)
|
|
24
|
+
|
|
25
|
+
### 🩹 Fixes
|
|
26
|
+
|
|
27
|
+
- add additional tags ([4f0cf8658](https://github.com/powerhouse-inc/powerhouse/commit/4f0cf8658))
|
|
28
|
+
|
|
29
|
+
### ❤️ Thank You
|
|
30
|
+
|
|
31
|
+
- Frank
|
|
32
|
+
|
|
33
|
+
## 4.1.0-dev.29 (2025-08-20)
|
|
34
|
+
|
|
35
|
+
### 🩹 Fixes
|
|
36
|
+
|
|
37
|
+
- fetch tags :-) ([df0b7beba](https://github.com/powerhouse-inc/powerhouse/commit/df0b7beba))
|
|
38
|
+
|
|
39
|
+
### ❤️ Thank You
|
|
40
|
+
|
|
41
|
+
- Frank
|
|
42
|
+
|
|
43
|
+
## 4.1.0-dev.28 (2025-08-20)
|
|
44
|
+
|
|
45
|
+
### 🩹 Fixes
|
|
46
|
+
|
|
47
|
+
- removed metadata extraction from commit ([637960021](https://github.com/powerhouse-inc/powerhouse/commit/637960021))
|
|
48
|
+
|
|
49
|
+
### ❤️ Thank You
|
|
50
|
+
|
|
51
|
+
- Frank
|
|
52
|
+
|
|
53
|
+
## 4.1.0-dev.27 (2025-08-20)
|
|
54
|
+
|
|
55
|
+
### 🩹 Fixes
|
|
56
|
+
|
|
57
|
+
- extract metadata tags and labels for docker ([bb9c81ce7](https://github.com/powerhouse-inc/powerhouse/commit/bb9c81ce7))
|
|
58
|
+
- use github tag properly ([95ccff4b8](https://github.com/powerhouse-inc/powerhouse/commit/95ccff4b8))
|
|
59
|
+
- proper tag for docker images ([e73e10617](https://github.com/powerhouse-inc/powerhouse/commit/e73e10617))
|
|
60
|
+
- use patname secret instead of github token ([db9dfd5cd](https://github.com/powerhouse-inc/powerhouse/commit/db9dfd5cd))
|
|
61
|
+
|
|
62
|
+
### ❤️ Thank You
|
|
63
|
+
|
|
64
|
+
- Frank
|
|
65
|
+
|
|
66
|
+
## 4.1.0-dev.26 (2025-08-20)
|
|
67
|
+
|
|
68
|
+
### 🩹 Fixes
|
|
69
|
+
|
|
70
|
+
- docker deploy alternative approach ([2a5522cdc](https://github.com/powerhouse-inc/powerhouse/commit/2a5522cdc))
|
|
71
|
+
|
|
72
|
+
### ❤️ Thank You
|
|
73
|
+
|
|
74
|
+
- Frank
|
|
75
|
+
|
|
76
|
+
## 4.1.0-dev.25 (2025-08-20)
|
|
77
|
+
|
|
78
|
+
### 🩹 Fixes
|
|
79
|
+
|
|
80
|
+
- docker deploy ([b057a7cce](https://github.com/powerhouse-inc/powerhouse/commit/b057a7cce))
|
|
81
|
+
|
|
82
|
+
### ❤️ Thank You
|
|
83
|
+
|
|
84
|
+
- Frank
|
|
85
|
+
|
|
86
|
+
## 4.1.0-dev.24 (2025-08-20)
|
|
87
|
+
|
|
88
|
+
### 🚀 Features
|
|
89
|
+
|
|
90
|
+
- **codegen:** add drive explorer template ([9c27219dc](https://github.com/powerhouse-inc/powerhouse/commit/9c27219dc))
|
|
91
|
+
- **connect,reactor-browser:** remove more old electron garbage ([5cd255568](https://github.com/powerhouse-inc/powerhouse/commit/5cd255568))
|
|
92
|
+
- **connect:** remove broken electron code ([3f28d6a46](https://github.com/powerhouse-inc/powerhouse/commit/3f28d6a46))
|
|
93
|
+
- **reactor-browser,connect,vetra:** move state hooks into reactor browser and eliminate redundant and dead code ([30fa16f1f](https://github.com/powerhouse-inc/powerhouse/commit/30fa16f1f))
|
|
94
|
+
- **connect,state,renown:** add state hook for renown ([5beb1252b](https://github.com/powerhouse-inc/powerhouse/commit/5beb1252b))
|
|
95
|
+
- **connect:** remove unused dep ([ef492bc7a](https://github.com/powerhouse-inc/powerhouse/commit/ef492bc7a))
|
|
96
|
+
- **connect,state,reactor-browser:** eliminate jotai ([53b1ab759](https://github.com/powerhouse-inc/powerhouse/commit/53b1ab759))
|
|
97
|
+
- **state:** rename to vetra packages ([c415b7dc2](https://github.com/powerhouse-inc/powerhouse/commit/c415b7dc2))
|
|
98
|
+
- **state:** use ph packages atoms ([6421fbeea](https://github.com/powerhouse-inc/powerhouse/commit/6421fbeea))
|
|
99
|
+
|
|
100
|
+
### 🩹 Fixes
|
|
101
|
+
|
|
102
|
+
- today claude taught me I could mock a package to fix circular references ([dcb83174c](https://github.com/powerhouse-inc/powerhouse/commit/dcb83174c))
|
|
103
|
+
- **monorepo:** numerous build issues ([04349dd25](https://github.com/powerhouse-inc/powerhouse/commit/04349dd25))
|
|
104
|
+
|
|
105
|
+
### ❤️ Thank You
|
|
106
|
+
|
|
107
|
+
- Benjamin Jordan (@thegoldenmule)
|
|
108
|
+
- ryanwolhuter @ryanwolhuter
|
|
109
|
+
|
|
110
|
+
## 4.1.0-dev.23 (2025-08-19)
|
|
111
|
+
|
|
112
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
113
|
+
|
|
114
|
+
## 4.1.0-dev.22 (2025-08-15)
|
|
115
|
+
|
|
116
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
117
|
+
|
|
118
|
+
## 4.1.0-dev.21 (2025-08-15)
|
|
119
|
+
|
|
120
|
+
### 🚀 Features
|
|
121
|
+
|
|
122
|
+
- **vetra:** update manifest when new module is added ([#1766](https://github.com/powerhouse-inc/powerhouse/pull/1766))
|
|
123
|
+
|
|
124
|
+
### 🩹 Fixes
|
|
125
|
+
|
|
126
|
+
- fixed debug launch configuration now that source maps are in the proper locations ([c75d793ed](https://github.com/powerhouse-inc/powerhouse/commit/c75d793ed))
|
|
127
|
+
|
|
128
|
+
### ❤️ Thank You
|
|
129
|
+
|
|
130
|
+
- Benjamin Jordan (@thegoldenmule)
|
|
131
|
+
- Guillermo Puente Sandoval @gpuente
|
|
132
|
+
|
|
133
|
+
## 4.1.0-dev.20 (2025-08-15)
|
|
134
|
+
|
|
135
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
136
|
+
|
|
137
|
+
## 4.1.0-dev.19 (2025-08-14)
|
|
138
|
+
|
|
139
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
140
|
+
|
|
141
|
+
## 4.1.0-dev.18 (2025-08-14)
|
|
142
|
+
|
|
143
|
+
### 🩹 Fixes
|
|
144
|
+
|
|
145
|
+
- overly aggressive linter fixes ([e074de3df](https://github.com/powerhouse-inc/powerhouse/commit/e074de3df))
|
|
146
|
+
|
|
147
|
+
### ❤️ Thank You
|
|
148
|
+
|
|
149
|
+
- Benjamin Jordan (@thegoldenmule)
|
|
150
|
+
|
|
151
|
+
## 4.1.0-dev.17 (2025-08-12)
|
|
152
|
+
|
|
153
|
+
### 🚀 Features
|
|
154
|
+
|
|
155
|
+
- refactor vetra command and remove vetra deps in connect and reactor ([#1753](https://github.com/powerhouse-inc/powerhouse/pull/1753))
|
|
156
|
+
|
|
157
|
+
### ❤️ Thank You
|
|
158
|
+
|
|
159
|
+
- Guillermo Puente Sandoval @gpuente
|
|
160
|
+
|
|
161
|
+
## 4.1.0-dev.16 (2025-08-12)
|
|
162
|
+
|
|
163
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
164
|
+
|
|
165
|
+
## 4.1.0-dev.15 (2025-08-12)
|
|
166
|
+
|
|
167
|
+
### 🚀 Features
|
|
168
|
+
|
|
169
|
+
- **reactor-mcp,reactor-api,reactor-local,switchboard,ph-cli:** run mcp on express app ([d51fa590e](https://github.com/powerhouse-inc/powerhouse/commit/d51fa590e))
|
|
170
|
+
|
|
171
|
+
### ❤️ Thank You
|
|
172
|
+
|
|
173
|
+
- acaldas @acaldas
|
|
174
|
+
|
|
175
|
+
## 4.1.0-dev.14 (2025-08-11)
|
|
176
|
+
|
|
177
|
+
### 🚀 Features
|
|
178
|
+
|
|
179
|
+
- update document engineering dep ([54dcee90d](https://github.com/powerhouse-inc/powerhouse/commit/54dcee90d))
|
|
180
|
+
|
|
181
|
+
### ❤️ Thank You
|
|
182
|
+
|
|
183
|
+
- acaldas @acaldas
|
|
184
|
+
|
|
185
|
+
## 4.1.0-dev.13 (2025-08-09)
|
|
186
|
+
|
|
187
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
188
|
+
|
|
189
|
+
## 4.1.0-dev.12 (2025-08-08)
|
|
190
|
+
|
|
191
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
192
|
+
|
|
193
|
+
## 4.1.0-dev.11 (2025-08-07)
|
|
194
|
+
|
|
195
|
+
### 🚀 Features
|
|
196
|
+
|
|
197
|
+
- **switchboard:** added dev mode to switchboard where local document models are loaded ([449e730b6](https://github.com/powerhouse-inc/powerhouse/commit/449e730b6))
|
|
198
|
+
- **switchboard,reactor-local,reactor-api:** moved vite loader to reactor-api package ([c84f0a2a3](https://github.com/powerhouse-inc/powerhouse/commit/c84f0a2a3))
|
|
199
|
+
- vetra package documents and app integration ([0e4053302](https://github.com/powerhouse-inc/powerhouse/commit/0e4053302))
|
|
200
|
+
- **vetra:** added vetra drive editor ([4ebafd143](https://github.com/powerhouse-inc/powerhouse/commit/4ebafd143))
|
|
201
|
+
- integrate package documents into reactor system ([939fe8e80](https://github.com/powerhouse-inc/powerhouse/commit/939fe8e80))
|
|
202
|
+
- **connect:** integrate Vetra package documents and editors ([2ecb9bd15](https://github.com/powerhouse-inc/powerhouse/commit/2ecb9bd15))
|
|
203
|
+
|
|
204
|
+
### ❤️ Thank You
|
|
205
|
+
|
|
206
|
+
- acaldas @acaldas
|
|
207
|
+
- Guillermo Puente @gpuente
|
|
208
|
+
- Guillermo Puente Sandoval @gpuente
|
|
209
|
+
|
|
210
|
+
## 4.1.0-dev.10 (2025-08-07)
|
|
211
|
+
|
|
212
|
+
### 🚀 Features
|
|
213
|
+
|
|
214
|
+
- **builder-tools,codegen,design-system,reactor-api:** updated document-engineering version ([e74068b43](https://github.com/powerhouse-inc/powerhouse/commit/e74068b43))
|
|
215
|
+
|
|
216
|
+
### ❤️ Thank You
|
|
217
|
+
|
|
218
|
+
- acaldas @acaldas
|
|
219
|
+
|
|
1
220
|
## 4.1.0-dev.9 (2025-08-07)
|
|
2
221
|
|
|
3
222
|
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
package/Dockerfile
CHANGED
|
@@ -38,8 +38,10 @@ ARG TAG=latest
|
|
|
38
38
|
ENV TAG=$TAG
|
|
39
39
|
|
|
40
40
|
RUN pnpm add -g ph-cmd@$TAG
|
|
41
|
-
RUN if [ "$TAG"
|
|
42
|
-
ph init project
|
|
41
|
+
RUN if [[ "$TAG" == *"dev"* ]]; then \
|
|
42
|
+
ph init project --dev --package-manager pnpm; \
|
|
43
|
+
elif [[ "$TAG" == *"staging"* ]]; then \
|
|
44
|
+
ph init project --staging --package-manager pnpm; \
|
|
43
45
|
else \
|
|
44
46
|
ph init project --package-manager pnpm; \
|
|
45
47
|
fi
|
package/dist/src/config.d.ts
CHANGED
package/dist/src/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAMA,UAAU,MAAM;IACd,QAAQ,EAAE;QACR,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;CACd;AACD,eAAO,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAMA,UAAU,MAAM;IACd,QAAQ,EAAE;QACR,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,OAAO,CAAC;CACd;AACD,eAAO,MAAM,MAAM,EAAE,MAcpB,CAAC"}
|
package/dist/src/config.js
CHANGED
package/dist/src/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,MAAM,QAAQ,GAAG,SAAS,EAAE,CAAC;AAC7B,MAAM,EAAE,WAAW,EAAE,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,MAAM,QAAQ,GAAG,SAAS,EAAE,CAAC;AAC7B,MAAM,EAAE,WAAW,EAAE,GAAG,QAAQ,CAAC;AAQjC,MAAM,CAAC,MAAM,MAAM,GAAW;IAC5B,QAAQ,EAAE;QACR,0FAA0F;QAC1F,GAAG,EACD,OAAO,CAAC,GAAG,CAAC,2BAA2B;YACvC,WAAW,EAAE,QAAQ,EAAE,GAAG;YAC1B,QAAQ;KACX;IACD,IAAI,EACF,OAAO,CAAC,GAAG,CAAC,mBAAmB;QAC/B,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QAC7C,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;QACzC,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,IAAI,IAAI,CAAC;IACjC,GAAG,EAAE,IAAI;CACV,CAAC"}
|
package/dist/src/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";AA0BA,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAyI9E,eAAO,MAAM,gBAAgB,GAC3B,UAAS,kBAAuB,KAC/B,OAAO,CAAC,kBAAkB,CAmB5B,CAAC;AAEF,cAAc,YAAY,CAAC"}
|
package/dist/src/server.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { startAPI } from "@powerhousedao/reactor-api";
|
|
3
|
+
import { VitePackageLoader, startViteServer, } from "@powerhousedao/reactor-api/packages/vite-loader";
|
|
3
4
|
import * as Sentry from "@sentry/node";
|
|
4
5
|
import { InMemoryCache, ReactorBuilder, driveDocumentModelModule, } from "document-drive";
|
|
6
|
+
import { DocumentAlreadyExistsError } from "document-drive/server/error";
|
|
5
7
|
import RedisCache from "document-drive/cache/redis";
|
|
6
8
|
import { FilesystemStorage } from "document-drive/storage/filesystem";
|
|
7
9
|
import { PrismaStorageFactory } from "document-drive/storage/prisma";
|
|
@@ -24,6 +26,106 @@ if (process.env.SENTRY_DSN) {
|
|
|
24
26
|
Sentry.setupExpressErrorHandler(app);
|
|
25
27
|
}
|
|
26
28
|
const DEFAULT_PORT = process.env.PORT ? Number(process.env.PORT) : 4001;
|
|
29
|
+
async function initServer(serverPort, options) {
|
|
30
|
+
const { dev, packages = [], remoteDrives = [] } = options;
|
|
31
|
+
// start redis if configured
|
|
32
|
+
const redisUrl = process.env.REDIS_TLS_URL ?? process.env.REDIS_URL;
|
|
33
|
+
let redis;
|
|
34
|
+
if (redisUrl) {
|
|
35
|
+
try {
|
|
36
|
+
redis = await initRedis(redisUrl);
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
console.error(e);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const connectionString = process.env.DATABASE_URL ?? "./.ph/drive-storage";
|
|
43
|
+
const dbUrl = connectionString.includes("amazonaws") &&
|
|
44
|
+
!connectionString.includes("sslmode=no-verify")
|
|
45
|
+
? connectionString + "?sslmode=no-verify"
|
|
46
|
+
: connectionString;
|
|
47
|
+
const cache = redis ? new RedisCache(redis) : new InMemoryCache();
|
|
48
|
+
const storageFactory = dbUrl.startsWith("postgresql")
|
|
49
|
+
? new PrismaStorageFactory(dbUrl, cache)
|
|
50
|
+
: undefined;
|
|
51
|
+
const storage = storageFactory
|
|
52
|
+
? storageFactory.build()
|
|
53
|
+
: new FilesystemStorage(path.join(process.cwd(), dbUrl));
|
|
54
|
+
const reactor = new ReactorBuilder([
|
|
55
|
+
documentModelDocumentModelModule,
|
|
56
|
+
driveDocumentModelModule,
|
|
57
|
+
])
|
|
58
|
+
.withStorage(storage)
|
|
59
|
+
.withCache(cache)
|
|
60
|
+
.build();
|
|
61
|
+
// init drive server
|
|
62
|
+
await reactor.initialize();
|
|
63
|
+
const dbPath = dbUrl.startsWith("postgresql") ? dbUrl : ".ph/read-storage";
|
|
64
|
+
let defaultDriveUrl = undefined;
|
|
65
|
+
// Create default drive if provided
|
|
66
|
+
if (options.drive) {
|
|
67
|
+
defaultDriveUrl = await addDefaultDrive(reactor, options.drive, serverPort);
|
|
68
|
+
}
|
|
69
|
+
// start vite server if dev mode is enabled
|
|
70
|
+
const vite = dev ? await startViteServer() : undefined;
|
|
71
|
+
// get paths to local document models
|
|
72
|
+
if (dev) {
|
|
73
|
+
// TODO get path from powerhouse config
|
|
74
|
+
const basePath = process.cwd();
|
|
75
|
+
packages.push(basePath);
|
|
76
|
+
}
|
|
77
|
+
// create loader
|
|
78
|
+
const packageLoader = vite ? await VitePackageLoader.build(vite) : undefined;
|
|
79
|
+
// Start the API with the reactor and options
|
|
80
|
+
const api = await startAPI(reactor, {
|
|
81
|
+
express: app,
|
|
82
|
+
port: serverPort,
|
|
83
|
+
dbPath: options.dbPath ?? dbPath,
|
|
84
|
+
https: options.https,
|
|
85
|
+
packageLoader,
|
|
86
|
+
packages: packages,
|
|
87
|
+
configFile: options.configFile ?? path.join(process.cwd(), "powerhouse.config.json"),
|
|
88
|
+
mcp: options.mcp ?? true,
|
|
89
|
+
});
|
|
90
|
+
// add vite middleware after express app is initialized if applicable
|
|
91
|
+
if (vite) {
|
|
92
|
+
api.app.use(vite.middlewares);
|
|
93
|
+
}
|
|
94
|
+
// Connect to remote drives AFTER packages are loaded
|
|
95
|
+
if (remoteDrives.length > 0) {
|
|
96
|
+
for (const remoteDriveUrl of remoteDrives) {
|
|
97
|
+
try {
|
|
98
|
+
await reactor.addRemoteDrive(remoteDriveUrl, {
|
|
99
|
+
availableOffline: true,
|
|
100
|
+
sharingType: "public",
|
|
101
|
+
listeners: [],
|
|
102
|
+
triggers: [],
|
|
103
|
+
});
|
|
104
|
+
// Use the first remote drive URL as the default
|
|
105
|
+
if (!defaultDriveUrl) {
|
|
106
|
+
defaultDriveUrl = remoteDriveUrl;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
if (error instanceof DocumentAlreadyExistsError) {
|
|
111
|
+
console.info(`Remote drive already added: ${remoteDriveUrl}`);
|
|
112
|
+
// Still use this drive URL as default if not already set
|
|
113
|
+
if (!defaultDriveUrl) {
|
|
114
|
+
defaultDriveUrl = remoteDriveUrl;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
console.error(`Failed to connect to remote drive ${remoteDriveUrl}:`, error);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
defaultDriveUrl,
|
|
125
|
+
api,
|
|
126
|
+
reactor,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
27
129
|
export const startSwitchboard = async (options = {}) => {
|
|
28
130
|
const serverPort = options.port ?? DEFAULT_PORT;
|
|
29
131
|
if (process.env.PYROSCOPE_SERVER_ADDRESS) {
|
|
@@ -36,56 +138,7 @@ export const startSwitchboard = async (options = {}) => {
|
|
|
36
138
|
}
|
|
37
139
|
}
|
|
38
140
|
try {
|
|
39
|
-
|
|
40
|
-
let redis;
|
|
41
|
-
if (redisUrl) {
|
|
42
|
-
try {
|
|
43
|
-
redis = await initRedis(redisUrl);
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
console.error(e);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const connectionString = process.env.DATABASE_URL ?? "./.ph/drive-storage";
|
|
50
|
-
const dbUrl = connectionString.includes("amazonaws") &&
|
|
51
|
-
!connectionString.includes("sslmode=no-verify")
|
|
52
|
-
? connectionString + "?sslmode=no-verify"
|
|
53
|
-
: connectionString;
|
|
54
|
-
const cache = redis ? new RedisCache(redis) : new InMemoryCache();
|
|
55
|
-
const storageFactory = dbUrl.startsWith("postgresql")
|
|
56
|
-
? new PrismaStorageFactory(dbUrl, cache)
|
|
57
|
-
: undefined;
|
|
58
|
-
const storage = storageFactory
|
|
59
|
-
? storageFactory.build()
|
|
60
|
-
: new FilesystemStorage(path.join(process.cwd(), dbUrl));
|
|
61
|
-
const reactor = new ReactorBuilder([
|
|
62
|
-
documentModelDocumentModelModule,
|
|
63
|
-
driveDocumentModelModule,
|
|
64
|
-
])
|
|
65
|
-
.withStorage(storage)
|
|
66
|
-
.withCache(cache)
|
|
67
|
-
.build();
|
|
68
|
-
// init drive server
|
|
69
|
-
await reactor.initialize();
|
|
70
|
-
const dbPath = dbUrl.startsWith("postgresql") ? dbUrl : ".ph/read-storage";
|
|
71
|
-
let defaultDriveUrl = undefined;
|
|
72
|
-
if (options.drive) {
|
|
73
|
-
defaultDriveUrl = await addDefaultDrive(reactor, options.drive, serverPort);
|
|
74
|
-
}
|
|
75
|
-
// Start the API with the reactor and options
|
|
76
|
-
await startAPI(reactor, {
|
|
77
|
-
express: app,
|
|
78
|
-
port: serverPort,
|
|
79
|
-
dbPath: options.dbPath ?? dbPath,
|
|
80
|
-
https: options.https,
|
|
81
|
-
packages: options.packages,
|
|
82
|
-
configFile: options.configFile ??
|
|
83
|
-
path.join(process.cwd(), "powerhouse.config.json"),
|
|
84
|
-
});
|
|
85
|
-
return {
|
|
86
|
-
defaultDriveUrl,
|
|
87
|
-
reactor,
|
|
88
|
-
};
|
|
141
|
+
return await initServer(serverPort, options);
|
|
89
142
|
}
|
|
90
143
|
catch (e) {
|
|
91
144
|
Sentry.captureException(e);
|
package/dist/src/server.js.map
CH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OAAO,CAAC,KAAK,CACX,qCAAqC,cAAc,GAAG,EACtD,KAAK,CACN,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,eAAe;QACf,GAAG;QACH,OAAO;KACR,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EACnC,UAA8B,EAAE,EACH,EAAE;IAC/B,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,IAAI,YAAY,CAAC;IAEhD,IAAI,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,CAAC;QACzC,IAAI,CAAC;YACH,MAAM,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;YAC3B,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAC3B,OAAO,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;QAChC,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC,CAAC;AAEF,cAAc,YAAY,CAAC"}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -7,9 +7,11 @@ export type StorageOptions = {
|
|
|
7
7
|
export type StartServerOptions = {
|
|
8
8
|
configFile?: string;
|
|
9
9
|
port?: number;
|
|
10
|
+
dev?: boolean;
|
|
10
11
|
dbPath?: string;
|
|
11
12
|
drive?: DriveInput;
|
|
12
13
|
packages?: string[];
|
|
14
|
+
remoteDrives?: string[];
|
|
13
15
|
https?: {
|
|
14
16
|
keyPath: string;
|
|
15
17
|
certPath: string;
|
|
@@ -20,6 +22,7 @@ export type StartServerOptions = {
|
|
|
20
22
|
users: string[];
|
|
21
23
|
admins: string[];
|
|
22
24
|
};
|
|
25
|
+
mcp?: boolean;
|
|
23
26
|
};
|
|
24
27
|
export type SwitchboardReactor = {
|
|
25
28
|
defaultDriveUrl: string | undefined;
|
package/dist/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE5E,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EACF;QACE,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;KAClB,GACD,OAAO,GACP,SAAS,CAAC;IACd,IAAI,CAAC,EAAE;QACL,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,MAAM,EAAE,MAAM,EAAE,CAAC;KAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,oBAAoB,EAAE,MAAM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