@powerhousedao/switchboard 5.1.0-dev.4 → 5.1.0-dev.41

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 CHANGED
@@ -1,3 +1,324 @@
1
+ ## 5.1.0-dev.41 (2026-01-13)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - less strict document models array type on reactor builder ([1548ddec7](https://github.com/powerhouse-inc/powerhouse/commit/1548ddec7))
6
+
7
+ ### ❤️ Thank You
8
+
9
+ - acaldas @acaldas
10
+
11
+ ## 5.1.0-dev.40 (2026-01-10)
12
+
13
+ ### 🚀 Features
14
+
15
+ - **builder-tools:** improved validation on doc model editor and unit tests ([336f5d575](https://github.com/powerhouse-inc/powerhouse/commit/336f5d575))
16
+ - **codegen:** add validation to package json test ([03d06ef57](https://github.com/powerhouse-inc/powerhouse/commit/03d06ef57))
17
+
18
+ ### ❤️ Thank You
19
+
20
+ - acaldas @acaldas
21
+ - ryanwolhuter @ryanwolhuter
22
+
23
+ ## 5.1.0-dev.39 (2026-01-09)
24
+
25
+ This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
26
+
27
+ ## 5.1.0-dev.38 (2026-01-09)
28
+
29
+ This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
30
+
31
+ ## 5.1.0-dev.37 (2026-01-09)
32
+
33
+ ### 🚀 Features
34
+
35
+ - **codegen,ph-cmd:** use templates for project boilerplate creation ([#2190](https://github.com/powerhouse-inc/powerhouse/pull/2190))
36
+
37
+ ### ❤️ Thank You
38
+
39
+ - Ryan Wolhuter @ryanwolhuter
40
+
41
+ ## 5.1.0-dev.36 (2026-01-09)
42
+
43
+ ### 🩹 Fixes
44
+
45
+ - **connect, switchboard:** run pnpm install after ph install in entrypoint ([c4145c07d](https://github.com/powerhouse-inc/powerhouse/commit/c4145c07d))
46
+ - **connect, switchboard:** create .npmrc after ph init and reinstall ([dc78e58f5](https://github.com/powerhouse-inc/powerhouse/commit/dc78e58f5))
47
+ - **connect, switchboard:** create .npmrc with hoisted node-linker before ph init ([4c8cdb1e5](https://github.com/powerhouse-inc/powerhouse/commit/4c8cdb1e5))
48
+ - **connect, switchboard:** scope node-linker hoisted to project only ([948cc7bdf](https://github.com/powerhouse-inc/powerhouse/commit/948cc7bdf))
49
+ - use hoisted node-linker for containerd/k8s compatibility ([5ae9e4abd](https://github.com/powerhouse-inc/powerhouse/commit/5ae9e4abd))
50
+
51
+ ### ❤️ Thank You
52
+
53
+ - Frank
54
+
55
+ ## 5.1.0-dev.35 (2026-01-08)
56
+
57
+ This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
58
+
59
+ ## 5.1.0-dev.34 (2026-01-07)
60
+
61
+ ### 🚀 Features
62
+
63
+ - adding feature flag support for v2 storage ([2f34fff4b](https://github.com/powerhouse-inc/powerhouse/commit/2f34fff4b))
64
+ - **ph-cli:** add index.html migration to migrate command ([#2186](https://github.com/powerhouse-inc/powerhouse/pull/2186))
65
+
66
+ ### ❤️ Thank You
67
+
68
+ - Benjamin Jordan (@thegoldenmule)
69
+ - Ryan Wolhuter @ryanwolhuter
70
+
71
+ ## 5.1.0-dev.33 (2026-01-06)
72
+
73
+ ### 🩹 Fixes
74
+
75
+ - added configuration to debug switchboard, and cleaned up some of the subgraph code ([9ce04c899](https://github.com/powerhouse-inc/powerhouse/commit/9ce04c899))
76
+
77
+ ### ❤️ Thank You
78
+
79
+ - Benjamin Jordan (@thegoldenmule)
80
+
81
+ ## 5.1.0-dev.32 (2026-01-02)
82
+
83
+ ### 🚀 Features
84
+
85
+ - **tracing:** migrate from Datadog to OpenTelemetry with Tempo service graphs ([6b4eb9c82](https://github.com/powerhouse-inc/powerhouse/commit/6b4eb9c82))
86
+
87
+ ### ❤️ Thank You
88
+
89
+ - Frank
90
+
91
+ ## 5.1.0-dev.31 (2026-01-02)
92
+
93
+ ### 🚀 Features
94
+
95
+ - **switchboard:** added tracing ([c978736b7](https://github.com/powerhouse-inc/powerhouse/commit/c978736b7))
96
+
97
+ ### ❤️ Thank You
98
+
99
+ - Frank
100
+
101
+ ## 5.1.0-dev.30 (2026-01-01)
102
+
103
+ ### 🩹 Fixes
104
+
105
+ - **document-drive:** do not export redis cache from index ([38b647cf9](https://github.com/powerhouse-inc/powerhouse/commit/38b647cf9))
106
+
107
+ ### ❤️ Thank You
108
+
109
+ - acaldas @acaldas
110
+
111
+ ## 5.1.0-dev.29 (2025-12-30)
112
+
113
+ ### 🩹 Fixes
114
+
115
+ - **connect,builder-tools,vetra:** avoid page reload on vite HMR ([1c3f5d1dd](https://github.com/powerhouse-inc/powerhouse/commit/1c3f5d1dd))
116
+
117
+ ### ❤️ Thank You
118
+
119
+ - acaldas @acaldas
120
+
121
+ ## 5.1.0-dev.28 (2025-12-30)
122
+
123
+ This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
124
+
125
+ ## 5.1.0-dev.27 (2025-12-24)
126
+
127
+ ### 🚀 Features
128
+
129
+ - **reactor-api:** datadog integration ([3c433c686](https://github.com/powerhouse-inc/powerhouse/commit/3c433c686))
130
+ - **reactor-browser:** improved document retrieval hooks ([4fed49391](https://github.com/powerhouse-inc/powerhouse/commit/4fed49391))
131
+
132
+ ### ❤️ Thank You
133
+
134
+ - acaldas @acaldas
135
+ - Frank
136
+
137
+ ## 5.1.0-dev.26 (2025-12-20)
138
+
139
+ This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
140
+
141
+ ## 5.1.0-dev.25 (2025-12-19)
142
+
143
+ ### 🩹 Fixes
144
+
145
+ - **switchboard, vetra:** fix issue with processors not being added on initial boot ([25432a663](https://github.com/powerhouse-inc/powerhouse/commit/25432a663))
146
+
147
+ ### ❤️ Thank You
148
+
149
+ - Benjamin Jordan (@thegoldenmule)
150
+
151
+ ## 5.1.0-dev.24 (2025-12-18)
152
+
153
+ ### 🩹 Fixes
154
+
155
+ - switchboard's new reactor signs everything ([b7fafb7fa](https://github.com/powerhouse-inc/powerhouse/commit/b7fafb7fa))
156
+ - don't sign default drive header as that changes the id, and pass along the unsigned header to the signed ([d8cd47c9d](https://github.com/powerhouse-inc/powerhouse/commit/d8cd47c9d))
157
+ - addDefaultDrive should not add if the drive already exists ([79352a5f8](https://github.com/powerhouse-inc/powerhouse/commit/79352a5f8))
158
+ - **switchboard:** use pglite inmemory ([f7c926fa9](https://github.com/powerhouse-inc/powerhouse/commit/f7c926fa9))
159
+ - **switchboard:** pglite path ([140422ab6](https://github.com/powerhouse-inc/powerhouse/commit/140422ab6))
160
+ - **switchboard:** use pglite for new reactor ([b5dece44e](https://github.com/powerhouse-inc/powerhouse/commit/b5dece44e))
161
+ - **switchboard:** added skip db migrations flag ([f1597c838](https://github.com/powerhouse-inc/powerhouse/commit/f1597c838))
162
+
163
+ ### ❤️ Thank You
164
+
165
+ - Benjamin Jordan (@thegoldenmule)
166
+ - Frank
167
+
168
+ ## 5.1.0-dev.23 (2025-12-17)
169
+
170
+ This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
171
+
172
+ ## 5.1.0-dev.22 (2025-12-16)
173
+
174
+ ### 🚀 Features
175
+
176
+ - added support for runtime document model subgraphs ([dc8248ec6](https://github.com/powerhouse-inc/powerhouse/commit/dc8248ec6))
177
+
178
+ ### ❤️ Thank You
179
+
180
+ - acaldas @acaldas
181
+
182
+ ## 5.1.0-dev.21 (2025-12-13)
183
+
184
+ This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
185
+
186
+ ## 5.1.0-dev.20 (2025-12-12)
187
+
188
+ ### 🚀 Features
189
+
190
+ - **reactor-browsers:** added onErrors callback to dispatch method ([4824a0a10](https://github.com/powerhouse-inc/powerhouse/commit/4824a0a10))
191
+
192
+ ### ❤️ Thank You
193
+
194
+ - acaldas @acaldas
195
+
196
+ ## 5.1.0-dev.19 (2025-12-12)
197
+
198
+ This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
199
+
200
+ ## 5.1.0-dev.18 (2025-12-11)
201
+
202
+ ### 🚀 Features
203
+
204
+ - **codegen:** add versioned document model generation ([#2130](https://github.com/powerhouse-inc/powerhouse/pull/2130))
205
+
206
+ ### ❤️ Thank You
207
+
208
+ - Ryan Wolhuter @ryanwolhuter
209
+
210
+ ## 5.1.0-dev.17 (2025-12-11)
211
+
212
+ ### 🩹 Fixes
213
+
214
+ - **ph-cli:** auth with access-token ([df48be6e9](https://github.com/powerhouse-inc/powerhouse/commit/df48be6e9))
215
+
216
+ ### ❤️ Thank You
217
+
218
+ - Frank
219
+
220
+ ## 5.1.0-dev.16 (2025-12-11)
221
+
222
+ ### 🚀 Features
223
+
224
+ - **ph-cli:** added access-token command ([e48181df6](https://github.com/powerhouse-inc/powerhouse/commit/e48181df6))
225
+ - **switchboard:** use identity ([1be03ddb7](https://github.com/powerhouse-inc/powerhouse/commit/1be03ddb7))
226
+ - **codegen:** update zod schema generation library ([#2129](https://github.com/powerhouse-inc/powerhouse/pull/2129))
227
+ - integrate visibility tools for remotes and pglite instance ([#2122](https://github.com/powerhouse-inc/powerhouse/pull/2122))
228
+
229
+ ### 🩹 Fixes
230
+
231
+ - backfill tests + create default via new reactor to get create/update ([889d890a3](https://github.com/powerhouse-inc/powerhouse/commit/889d890a3))
232
+ - syncenvelope shape was incorrect ([cc6226be9](https://github.com/powerhouse-inc/powerhouse/commit/cc6226be9))
233
+
234
+ ### ❤️ Thank You
235
+
236
+ - Benjamin Jordan (@thegoldenmule)
237
+ - Frank
238
+ - Guillermo Puente Sandoval @gpuente
239
+ - Ryan Wolhuter @ryanwolhuter
240
+
241
+ ## 5.1.0-dev.15 (2025-12-09)
242
+
243
+ ### 🩹 Fixes
244
+
245
+ - adding powerhouse drive to default options for switchboard when running with pnpm start ([4347307dc](https://github.com/powerhouse-inc/powerhouse/commit/4347307dc))
246
+
247
+ ### ❤️ Thank You
248
+
249
+ - Benjamin Jordan (@thegoldenmule)
250
+
251
+ ## 5.1.0-dev.14 (2025-12-08)
252
+
253
+ ### 🚀 Features
254
+
255
+ - **connect, switchboard:** added healthcheck route ([9a0671113](https://github.com/powerhouse-inc/powerhouse/commit/9a0671113))
256
+ - **academy:** added docker build and publish workflow ([b17562994](https://github.com/powerhouse-inc/powerhouse/commit/b17562994))
257
+
258
+ ### ❤️ Thank You
259
+
260
+ - Frank
261
+
262
+ ## 5.1.0-dev.13 (2025-12-08)
263
+
264
+ This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
265
+
266
+ ## 5.1.0-dev.12 (2025-12-08)
267
+
268
+ This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
269
+
270
+ ## 5.1.0-dev.11 (2025-12-08)
271
+
272
+ This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
273
+
274
+ ## 5.1.0-dev.10 (2025-12-06)
275
+
276
+ ### 🚀 Features
277
+
278
+ - **design-system:** added remotes inspector and channel inspector components ([093896ebf](https://github.com/powerhouse-inc/powerhouse/commit/093896ebf))
279
+
280
+ ### ❤️ Thank You
281
+
282
+ - Guillermo Puente @gpuente
283
+
284
+ ## 5.1.0-dev.9 (2025-12-05)
285
+
286
+ ### 🩹 Fixes
287
+
288
+ - **renown:** small ui fixes and made connectcrypto and renown id available in hooks ([c06e17226](https://github.com/powerhouse-inc/powerhouse/commit/c06e17226))
289
+
290
+ ### ❤️ Thank You
291
+
292
+ - Frank
293
+
294
+ ## 5.1.0-dev.8 (2025-12-05)
295
+
296
+ This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
297
+
298
+ ## 5.1.0-dev.7 (2025-12-04)
299
+
300
+ ### 🩹 Fixes
301
+
302
+ - set jsr as registry in dockerfiles ([291027b16](https://github.com/powerhouse-inc/powerhouse/commit/291027b16))
303
+
304
+ ### ❤️ Thank You
305
+
306
+ - Frank
307
+
308
+ ## 5.1.0-dev.6 (2025-12-04)
309
+
310
+ ### 🩹 Fixes
311
+
312
+ - **renown:** build issues ([1893c35a0](https://github.com/powerhouse-inc/powerhouse/commit/1893c35a0))
313
+
314
+ ### ❤️ Thank You
315
+
316
+ - Frank
317
+
318
+ ## 5.1.0-dev.5 (2025-12-04)
319
+
320
+ This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
321
+
1
322
  ## 5.1.0-dev.4 (2025-12-03)
2
323
 
3
324
  ### 🚀 Features
package/Dockerfile CHANGED
@@ -25,6 +25,7 @@ ENV PH_SWITCHBOARD_GUESTS_LIST="0x123,0x456"
25
25
  # Database
26
26
  ENV PH_SWITCHBOARD_DATABASE_URL="dev.db"
27
27
  ENV PH_SWITCHBOARD_REDIS_URL=""
28
+ ENV SKIP_DB_MIGRATIONS="false"
28
29
 
29
30
  # Heroku Workaround
30
31
  ENV PORT=4001
@@ -36,17 +37,24 @@ ENV PH_SWITCHBOARD_PORT=$PORT
36
37
  ARG TAG=latest
37
38
  ENV TAG=$TAG
38
39
  # RUN apk add --no-cache openssl
40
+ # Configure JSR registry for @jsr scoped packages
41
+ RUN pnpm config set @jsr:registry https://npm.jsr.io
39
42
  RUN pnpm add -g ph-cmd@$TAG prisma@5.17.0
43
+
40
44
  RUN case "$TAG" in \
41
45
  *dev*) ph init project --dev --package-manager pnpm ;; \
42
46
  *staging*) ph init project --staging --package-manager pnpm ;; \
43
47
  *) ph init project --package-manager pnpm ;; \
44
48
  esac
45
49
 
46
-
47
50
  WORKDIR /app/project
48
51
 
49
- # Copy and set up entrypoint script
52
+ # Install curl for health checks
53
+ RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
54
+
55
+ EXPOSE $PORT
50
56
 
57
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=30s --retries=3 \
58
+ CMD curl -f http://localhost:${PORT}/health || exit 1
51
59
 
52
60
  ENTRYPOINT ["/app/entrypoint.sh"]
@@ -1,9 +1,11 @@
1
+ import type { DriveInput } from "document-drive";
1
2
  interface Config {
2
3
  database: {
3
4
  url: string;
4
5
  };
5
6
  port: number;
6
7
  mcp: boolean;
8
+ drive: DriveInput;
7
9
  }
8
10
  export declare const config: Config;
9
11
  export {};
@@ -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;IACb,GAAG,EAAE,OAAO,CAAC;CACd;AACD,eAAO,MAAM,MAAM,EAAE,MAcpB,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,UAAU,MAAM;IACd,QAAQ,EAAE;QACR,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,UAAU,CAAC;CACnB;AACD,eAAO,MAAM,MAAM,EAAE,MA4BpB,CAAC"}
@@ -15,5 +15,19 @@ export const config = {
15
15
  ? Number(process.env.PH_SWITCHBOARD_PORT)
16
16
  : (switchboard?.port ?? 4001),
17
17
  mcp: true,
18
+ drive: {
19
+ id: "powerhouse",
20
+ slug: "powerhouse",
21
+ global: {
22
+ name: "Powerhouse",
23
+ icon: "https://ipfs.io/ipfs/QmcaTDBYn8X2psGaXe7iQ6qd8q6oqHLgxvMX9yXf7f9uP7",
24
+ },
25
+ local: {
26
+ availableOffline: true,
27
+ listeners: [],
28
+ sharingType: "public",
29
+ triggers: [],
30
+ },
31
+ },
18
32
  };
19
33
  //# sourceMappingURL=config.js.map
@@ -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,4BAA4B,C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C;QACzC,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,IAAI,IAAI,CAAC;IACjC,GAAG,EAAE,IAAI;IACT,KAAK,EAAE;QACL,EAAE,EAAE,YAAY;QAChB,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE;YACN,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,qEAAqE;SAC5E;QACD,KAAK,EAAE;YACL,gBAAgB,EAAE,IAAI;YACtB,SAAS,EAAE,EAAE;YACb,WAAW,EAAE,QAAQ;YACrB,QAAQ,EAAE,EAAE;SACb;KACF;CACF,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { type IConnectCrypto, type JsonWebKeyPairStorage, type JwkKeyPair } from "@renown/sdk";
2
+ /**
3
+ * Key storage that supports:
4
+ * 1. PH_RENOWN_PRIVATE_KEY environment variable (JSON-encoded JwkKeyPair)
5
+ * 2. Custom file path passed via options
6
+ * 3. Falls back to file storage at .keypair.json in current working directory
7
+ */
8
+ export declare class SwitchboardKeyStorage implements JsonWebKeyPairStorage {
9
+ #private;
10
+ constructor(filePath?: string);
11
+ loadKeyPair(): Promise<JwkKeyPair | undefined>;
12
+ saveKeyPair(keyPair: JwkKeyPair): Promise<void>;
13
+ }
14
+ export interface ConnectCryptoOptions {
15
+ /** Path to the keypair file. Defaults to .keypair.json in cwd */
16
+ keypairPath?: string;
17
+ /** If true, won't generate a new keypair if none exists */
18
+ requireExisting?: boolean;
19
+ }
20
+ /**
21
+ * Initialize ConnectCrypto for the switchboard.
22
+ * This allows the switchboard to authenticate with remote services
23
+ * using the same identity established during `ph login`.
24
+ */
25
+ export declare function initConnectCrypto(options?: ConnectCryptoOptions): Promise<IConnectCrypto | null>;
26
+ /**
27
+ * Get the current ConnectCrypto instance.
28
+ * Returns null if not initialized.
29
+ */
30
+ export declare function getConnectCrypto(): IConnectCrypto | null;
31
+ /**
32
+ * Get the DID of the current ConnectCrypto instance.
33
+ * Returns null if not initialized.
34
+ */
35
+ export declare function getConnectDid(): Promise<string | null>;
36
+ /**
37
+ * Get a bearer token for authenticating with remote services.
38
+ * Returns null if ConnectCrypto is not initialized.
39
+ */
40
+ export declare function getBearerToken(driveUrl: string, address?: string, refresh?: boolean): Promise<string | null>;
41
+ //# sourceMappingURL=connect-crypto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-crypto.d.ts","sourceRoot":"","sources":["../../src/connect-crypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EAChB,MAAM,aAAa,CAAC;AAUrB;;;;;GAKG;AACH,qBAAa,qBAAsB,YAAW,qBAAqB;;gBAGrD,QAAQ,CAAC,EAAE,MAAM;IAUvB,WAAW,IAAI,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAuB9C,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAgCtD;AAKD,MAAM,WAAW,oBAAoB;IACnC,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA0BhC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,cAAc,GAAG,IAAI,CAExD;AAED;;;GAGG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAK5D;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,UAAQ,GACd,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKxB"}
@@ -0,0 +1,127 @@
1
+ import { ConnectCrypto, } from "@renown/sdk";
2
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
+ import { dirname, join } from "node:path";
4
+ import { childLogger } from "document-drive";
5
+ const logger = childLogger(["switchboard", "connect-crypto"]);
6
+ const ENV_KEY_NAME = "PH_RENOWN_PRIVATE_KEY";
7
+ const DEFAULT_KEYPAIR_PATH = join(process.cwd(), ".keypair.json");
8
+ /**
9
+ * Key storage that supports:
10
+ * 1. PH_RENOWN_PRIVATE_KEY environment variable (JSON-encoded JwkKeyPair)
11
+ * 2. Custom file path passed via options
12
+ * 3. Falls back to file storage at .keypair.json in current working directory
13
+ */
14
+ export class SwitchboardKeyStorage {
15
+ #filePath;
16
+ constructor(filePath) {
17
+ this.#filePath = filePath || DEFAULT_KEYPAIR_PATH;
18
+ // Ensure directory exists
19
+ const dir = dirname(this.#filePath);
20
+ if (!existsSync(dir)) {
21
+ mkdirSync(dir, { recursive: true });
22
+ }
23
+ }
24
+ async loadKeyPair() {
25
+ // First check environment variable
26
+ const envKey = process.env[ENV_KEY_NAME];
27
+ if (envKey) {
28
+ try {
29
+ const keyPair = JSON.parse(envKey);
30
+ // Validate it has the required structure
31
+ if (keyPair.publicKey && keyPair.privateKey) {
32
+ logger.debug("Loaded keypair from environment variable");
33
+ return keyPair;
34
+ }
35
+ logger.warn(`${ENV_KEY_NAME} is set but doesn't contain valid publicKey and privateKey`);
36
+ }
37
+ catch (e) {
38
+ logger.warn(`Failed to parse ${ENV_KEY_NAME} as JSON:`, e);
39
+ }
40
+ }
41
+ // Fall back to file storage
42
+ return this.#loadFromFile();
43
+ }
44
+ async saveKeyPair(keyPair) {
45
+ // Don't save if using env var
46
+ if (process.env[ENV_KEY_NAME]) {
47
+ return;
48
+ }
49
+ // Save to file
50
+ this.#saveToFile(keyPair);
51
+ }
52
+ #loadFromFile() {
53
+ try {
54
+ if (!existsSync(this.#filePath)) {
55
+ return undefined;
56
+ }
57
+ const data = readFileSync(this.#filePath, "utf-8");
58
+ const parsed = JSON.parse(data);
59
+ const keyPair = parsed.keyPair;
60
+ if (keyPair) {
61
+ logger.debug(`Loaded keypair from ${this.#filePath}`);
62
+ }
63
+ return keyPair;
64
+ }
65
+ catch {
66
+ return undefined;
67
+ }
68
+ }
69
+ #saveToFile(keyPair) {
70
+ const data = { keyPair };
71
+ writeFileSync(this.#filePath, JSON.stringify(data, null, 2), "utf-8");
72
+ logger.debug(`Saved keypair to ${this.#filePath}`);
73
+ }
74
+ }
75
+ // Singleton instance of ConnectCrypto for the switchboard
76
+ let connectCryptoInstance = null;
77
+ /**
78
+ * Initialize ConnectCrypto for the switchboard.
79
+ * This allows the switchboard to authenticate with remote services
80
+ * using the same identity established during `ph login`.
81
+ */
82
+ export async function initConnectCrypto(options = {}) {
83
+ const { keypairPath, requireExisting = false } = options;
84
+ const keyStorage = new SwitchboardKeyStorage(keypairPath);
85
+ // Check if we have an existing keypair
86
+ const existingKeyPair = await keyStorage.loadKeyPair();
87
+ if (!existingKeyPair && requireExisting) {
88
+ logger.warn("No existing keypair found and requireExisting is true. " +
89
+ 'Run "ph login" to create one.');
90
+ return null;
91
+ }
92
+ if (!existingKeyPair) {
93
+ logger.info("No existing keypair found. A new one will be generated.");
94
+ }
95
+ connectCryptoInstance = new ConnectCrypto(keyStorage);
96
+ const did = await connectCryptoInstance.did();
97
+ logger.info(`Switchboard identity initialized: ${did}`);
98
+ return connectCryptoInstance;
99
+ }
100
+ /**
101
+ * Get the current ConnectCrypto instance.
102
+ * Returns null if not initialized.
103
+ */
104
+ export function getConnectCrypto() {
105
+ return connectCryptoInstance;
106
+ }
107
+ /**
108
+ * Get the DID of the current ConnectCrypto instance.
109
+ * Returns null if not initialized.
110
+ */
111
+ export async function getConnectDid() {
112
+ if (!connectCryptoInstance) {
113
+ return null;
114
+ }
115
+ return connectCryptoInstance.did();
116
+ }
117
+ /**
118
+ * Get a bearer token for authenticating with remote services.
119
+ * Returns null if ConnectCrypto is not initialized.
120
+ */
121
+ export async function getBearerToken(driveUrl, address, refresh = false) {
122
+ if (!connectCryptoInstance) {
123
+ return null;
124
+ }
125
+ return connectCryptoInstance.getBearerToken(driveUrl, address, refresh);
126
+ }
127
+ //# sourceMappingURL=connect-crypto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-crypto.js","sourceRoot":"","sources":["../../src/connect-crypto.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,GAId,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAE9D,MAAM,YAAY,GAAG,uBAAuB,CAAC;AAC7C,MAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,eAAe,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,OAAO,qBAAqB;IAChC,SAAS,CAAS;IAElB,YAAY,QAAiB;QAC3B,IAAI,CAAC,SAAS,GAAG,QAAQ,IAAI,oBAAoB,CAAC;QAElD,0BAA0B;QAC1B,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,WAAW;QACf,mCAAmC;QACnC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACzC,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAe,CAAC;gBACjD,yCAAyC;gBACzC,IAAI,OAAO,CA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AO,qBAAqB,CAAC,GAAG,EAAE,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAgB,EAChB,OAAgB,EAChB,OAAO,GAAG,KAAK;IAEf,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,qBAAqB,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAC1E,CAAC"}
@@ -1,4 +1,2 @@
1
1
  export declare function initFeatureFlags(): Promise<import("@openfeature/server-sdk").Client>;
2
- export declare function isReactorv2Enabled(): Promise<boolean>;
3
- export declare function isDualActionCreateEnabled(): Promise<boolean>;
4
2
  //# sourceMappingURL=feature-flags.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../src/feature-flags.ts"],"names":[],"mappings":"AAGA,wBAAsB,gBAAgB,sDAOrC;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC,CAG3D;AAED,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,OAAO,CAAC,CAMlE"}
1
+ {"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../src/feature-flags.ts"],"names":[],"mappings":"AAGA,wBAAsB,gBAAgB,sDAOrC"}
@@ -6,12 +6,4 @@ export async function initFeatureFlags() {
6
6
  await OpenFeature.setProviderAndWait(provider);
7
7
  return OpenFeature.getClient();
8
8
  }
9
- export async function isReactorv2Enabled() {
10
- const client = OpenFeature.getClient();
11
- return await client.getBooleanValue("FEATURE_REACTORV2_ENABLED", false);
12
- }
13
- export async function isDualActionCreateEnabled() {
14
- const client = OpenFeature.getClient();
15
- return await client.getBooleanValue("FEATURE_DUAL_ACTION_CREATE_ENABLED", false);
16
- }
17
9
  //# sourceMappingURL=feature-flags.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature-flags.js","sourceRoot":"","sources":["../../src/feature-flags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,uDAAuD;IACvD,MAAM,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;IAEtC,MAAM,WAAW,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAE/C,OAAO,WAAW,CAAC,SAAS,EAAE,CAAC;AACjC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS,EAAE,CAAC;IACvC,OAAO,MAAM,MAAM,CAAC,eAAe,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB;IAC7C,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS,EAAE,CAAC;IACvC,OAAO,MAAM,MAAM,CAAC,eAAe,CACjC,oCAAoC,EACpC,KAAK,CACN,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"feature-flags.js","sourceRoot":"","sources":["../../src/feature-flags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,uDAAuD;IACvD,MAAM,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;IAEtC,MAAM,WAAW,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAE/C,OAAO,WAAW,CAAC,SAAS,EAAE,CAAC;AACjC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import type { StartServerOptions, SwitchboardReactor } from "./types.js";
3
3
  export declare const startSwitchboard: (options?: StartServerOptions) => Promise<SwitchboardReactor>;
4
+ export { getBearerToken, getConnectCrypto, getConnectDid, } from "./connect-crypto.js";
4
5
  export * from "./types.js";
5
6
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";AAqCA,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAsOzE,eAAO,MAAM,gBAAgB,GAC3B,UAAS,kBAAuB,KAC/B,OAAO,CAAC,kBAAkB,CAgC5B,CAAC;AAEF,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";AA0CA,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAqRzE,eAAO,MAAM,gBAAgB,GAC3B,UAAS,kBAAuB,KAC/B,OAAO,CAAC,kBAAkB,CA+D5B,CAAC;AAEF,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,cAAc,YAAY,CAAC"}