@powerhousedao/switchboard 5.1.0-dev.2 → 5.1.0-dev.20
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 +150 -0
- package/Dockerfile +8 -1
- package/dist/src/config.d.ts +2 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +14 -0
- package/dist/src/config.js.map +1 -1
- package/dist/src/connect-crypto.d.ts +41 -0
- package/dist/src/connect-crypto.d.ts.map +1 -0
- package/dist/src/connect-crypto.js +127 -0
- package/dist/src/connect-crypto.js.map +1 -0
- package/dist/src/feature-flags.d.ts +0 -2
- package/dist/src/feature-flags.d.ts.map +1 -1
- package/dist/src/feature-flags.js +0 -8
- package/dist/src/feature-flags.js.map +1 -1
- package/dist/src/server.d.ts +1 -0
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +51 -16
- package/dist/src/server.js.map +1 -1
- package/dist/src/types.d.ts +18 -3
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils.d.ts +4 -2
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +31 -5
- package/dist/src/utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -6
- package/tsconfig.json +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,153 @@
|
|
|
1
|
+
## 5.1.0-dev.20 (2025-12-12)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **reactor-browsers:** added onErrors callback to dispatch method ([4824a0a10](https://github.com/powerhouse-inc/powerhouse/commit/4824a0a10))
|
|
6
|
+
|
|
7
|
+
### ❤️ Thank You
|
|
8
|
+
|
|
9
|
+
- acaldas @acaldas
|
|
10
|
+
|
|
11
|
+
## 5.1.0-dev.19 (2025-12-12)
|
|
12
|
+
|
|
13
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
14
|
+
|
|
15
|
+
## 5.1.0-dev.18 (2025-12-11)
|
|
16
|
+
|
|
17
|
+
### 🚀 Features
|
|
18
|
+
|
|
19
|
+
- **codegen:** add versioned document model generation ([#2130](https://github.com/powerhouse-inc/powerhouse/pull/2130))
|
|
20
|
+
|
|
21
|
+
### ❤️ Thank You
|
|
22
|
+
|
|
23
|
+
- Ryan Wolhuter @ryanwolhuter
|
|
24
|
+
|
|
25
|
+
## 5.1.0-dev.17 (2025-12-11)
|
|
26
|
+
|
|
27
|
+
### 🩹 Fixes
|
|
28
|
+
|
|
29
|
+
- **ph-cli:** auth with access-token ([df48be6e9](https://github.com/powerhouse-inc/powerhouse/commit/df48be6e9))
|
|
30
|
+
|
|
31
|
+
### ❤️ Thank You
|
|
32
|
+
|
|
33
|
+
- Frank
|
|
34
|
+
|
|
35
|
+
## 5.1.0-dev.16 (2025-12-11)
|
|
36
|
+
|
|
37
|
+
### 🚀 Features
|
|
38
|
+
|
|
39
|
+
- **ph-cli:** added access-token command ([e48181df6](https://github.com/powerhouse-inc/powerhouse/commit/e48181df6))
|
|
40
|
+
- **switchboard:** use identity ([1be03ddb7](https://github.com/powerhouse-inc/powerhouse/commit/1be03ddb7))
|
|
41
|
+
- **codegen:** update zod schema generation library ([#2129](https://github.com/powerhouse-inc/powerhouse/pull/2129))
|
|
42
|
+
- integrate visibility tools for remotes and pglite instance ([#2122](https://github.com/powerhouse-inc/powerhouse/pull/2122))
|
|
43
|
+
|
|
44
|
+
### 🩹 Fixes
|
|
45
|
+
|
|
46
|
+
- backfill tests + create default via new reactor to get create/update ([889d890a3](https://github.com/powerhouse-inc/powerhouse/commit/889d890a3))
|
|
47
|
+
- syncenvelope shape was incorrect ([cc6226be9](https://github.com/powerhouse-inc/powerhouse/commit/cc6226be9))
|
|
48
|
+
|
|
49
|
+
### ❤️ Thank You
|
|
50
|
+
|
|
51
|
+
- Benjamin Jordan (@thegoldenmule)
|
|
52
|
+
- Frank
|
|
53
|
+
- Guillermo Puente Sandoval @gpuente
|
|
54
|
+
- Ryan Wolhuter @ryanwolhuter
|
|
55
|
+
|
|
56
|
+
## 5.1.0-dev.15 (2025-12-09)
|
|
57
|
+
|
|
58
|
+
### 🩹 Fixes
|
|
59
|
+
|
|
60
|
+
- adding powerhouse drive to default options for switchboard when running with pnpm start ([4347307dc](https://github.com/powerhouse-inc/powerhouse/commit/4347307dc))
|
|
61
|
+
|
|
62
|
+
### ❤️ Thank You
|
|
63
|
+
|
|
64
|
+
- Benjamin Jordan (@thegoldenmule)
|
|
65
|
+
|
|
66
|
+
## 5.1.0-dev.14 (2025-12-08)
|
|
67
|
+
|
|
68
|
+
### 🚀 Features
|
|
69
|
+
|
|
70
|
+
- **connect, switchboard:** added healthcheck route ([9a0671113](https://github.com/powerhouse-inc/powerhouse/commit/9a0671113))
|
|
71
|
+
- **academy:** added docker build and publish workflow ([b17562994](https://github.com/powerhouse-inc/powerhouse/commit/b17562994))
|
|
72
|
+
|
|
73
|
+
### ❤️ Thank You
|
|
74
|
+
|
|
75
|
+
- Frank
|
|
76
|
+
|
|
77
|
+
## 5.1.0-dev.13 (2025-12-08)
|
|
78
|
+
|
|
79
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
80
|
+
|
|
81
|
+
## 5.1.0-dev.12 (2025-12-08)
|
|
82
|
+
|
|
83
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
84
|
+
|
|
85
|
+
## 5.1.0-dev.11 (2025-12-08)
|
|
86
|
+
|
|
87
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
88
|
+
|
|
89
|
+
## 5.1.0-dev.10 (2025-12-06)
|
|
90
|
+
|
|
91
|
+
### 🚀 Features
|
|
92
|
+
|
|
93
|
+
- **design-system:** added remotes inspector and channel inspector components ([093896ebf](https://github.com/powerhouse-inc/powerhouse/commit/093896ebf))
|
|
94
|
+
|
|
95
|
+
### ❤️ Thank You
|
|
96
|
+
|
|
97
|
+
- Guillermo Puente @gpuente
|
|
98
|
+
|
|
99
|
+
## 5.1.0-dev.9 (2025-12-05)
|
|
100
|
+
|
|
101
|
+
### 🩹 Fixes
|
|
102
|
+
|
|
103
|
+
- **renown:** small ui fixes and made connectcrypto and renown id available in hooks ([c06e17226](https://github.com/powerhouse-inc/powerhouse/commit/c06e17226))
|
|
104
|
+
|
|
105
|
+
### ❤️ Thank You
|
|
106
|
+
|
|
107
|
+
- Frank
|
|
108
|
+
|
|
109
|
+
## 5.1.0-dev.8 (2025-12-05)
|
|
110
|
+
|
|
111
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
112
|
+
|
|
113
|
+
## 5.1.0-dev.7 (2025-12-04)
|
|
114
|
+
|
|
115
|
+
### 🩹 Fixes
|
|
116
|
+
|
|
117
|
+
- set jsr as registry in dockerfiles ([291027b16](https://github.com/powerhouse-inc/powerhouse/commit/291027b16))
|
|
118
|
+
|
|
119
|
+
### ❤️ Thank You
|
|
120
|
+
|
|
121
|
+
- Frank
|
|
122
|
+
|
|
123
|
+
## 5.1.0-dev.6 (2025-12-04)
|
|
124
|
+
|
|
125
|
+
### 🩹 Fixes
|
|
126
|
+
|
|
127
|
+
- **renown:** build issues ([1893c35a0](https://github.com/powerhouse-inc/powerhouse/commit/1893c35a0))
|
|
128
|
+
|
|
129
|
+
### ❤️ Thank You
|
|
130
|
+
|
|
131
|
+
- Frank
|
|
132
|
+
|
|
133
|
+
## 5.1.0-dev.5 (2025-12-04)
|
|
134
|
+
|
|
135
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
136
|
+
|
|
137
|
+
## 5.1.0-dev.4 (2025-12-03)
|
|
138
|
+
|
|
139
|
+
### 🚀 Features
|
|
140
|
+
|
|
141
|
+
- **codegen,ph-cli:** add tsx code generator ([#2116](https://github.com/powerhouse-inc/powerhouse/pull/2116))
|
|
142
|
+
|
|
143
|
+
### ❤️ Thank You
|
|
144
|
+
|
|
145
|
+
- Ryan Wolhuter @ryanwolhuter
|
|
146
|
+
|
|
147
|
+
## 5.1.0-dev.3 (2025-12-02)
|
|
148
|
+
|
|
149
|
+
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
|
150
|
+
|
|
1
151
|
## 5.1.0-dev.2 (2025-12-02)
|
|
2
152
|
|
|
3
153
|
This was a version bump only for @powerhousedao/switchboard to align it with other projects, there were no code changes.
|
package/Dockerfile
CHANGED
|
@@ -36,6 +36,8 @@ ENV PH_SWITCHBOARD_PORT=$PORT
|
|
|
36
36
|
ARG TAG=latest
|
|
37
37
|
ENV TAG=$TAG
|
|
38
38
|
# RUN apk add --no-cache openssl
|
|
39
|
+
# Configure JSR registry for @jsr scoped packages
|
|
40
|
+
RUN pnpm config set @jsr:registry https://npm.jsr.io
|
|
39
41
|
RUN pnpm add -g ph-cmd@$TAG prisma@5.17.0
|
|
40
42
|
RUN case "$TAG" in \
|
|
41
43
|
*dev*) ph init project --dev --package-manager pnpm ;; \
|
|
@@ -46,7 +48,12 @@ RUN case "$TAG" in \
|
|
|
46
48
|
|
|
47
49
|
WORKDIR /app/project
|
|
48
50
|
|
|
49
|
-
#
|
|
51
|
+
# Install curl for health checks
|
|
52
|
+
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
|
50
53
|
|
|
54
|
+
EXPOSE $PORT
|
|
55
|
+
|
|
56
|
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=30s --retries=3 \
|
|
57
|
+
CMD curl -f http://localhost:${PORT}/health || exit 1
|
|
51
58
|
|
|
52
59
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
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":"
|
|
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"}
|
package/dist/src/config.js
CHANGED
|
@@ -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
|
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,4BAA4B,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,4BAA4B,CAAC;AAEvD,MAAM,QAAQ,GAAG,SAAS,EAAE,CAAC;AAC7B,MAAM,EAAE,WAAW,EAAE,GAAG,QAAQ,CAAC;AASjC,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;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,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AAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;IACzE,CAAC;IAED,qBAAqB,GAAG,IAAI,aAAa,CAAC,UAAU,CAAC,CAAC;IAEtD,MAAM,GAAG,GAAG,MAAM,qBAAqB,CAAC,GAAG,EAAE,CAAC;IAC9C,MAAM,CAAC,IAAI,CAAC,qCAAqC,GAAG,EAAE,CAAC,CAAC;IAExD,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,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
|
|
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
|
|
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"}
|
package/dist/src/server.d.ts
CHANGED
|
@@ -2,4 +2,5 @@
|
|
|
2
2
|
import type { StartServerOptions, SwitchboardReactor } from "./types.js";
|
|
3
3
|
export declare const startSwitchboard: (options?: StartServerOptions) => Promise<SwitchboardReactor>;
|
|
4
4
|
export * from "./types.js";
|
|
5
|
+
export { getConnectCrypto, getConnectDid, getBearerToken, } from "./connect-crypto.js";
|
|
5
6
|
//# sourceMappingURL=server.d.ts.map
|
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":";AA0CA,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAiQzE,eAAO,MAAM,gBAAgB,GAC3B,UAAS,kBAAuB,KAC/B,OAAO,CAAC,kBAAkB,CAuC5B,CAAC;AAEF,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,cAAc,GACf,MAAM,qBAAqB,CAAC"}
|
package/dist/src/server.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { PGlite } from "@electric-sql/pglite";
|
|
3
|
+
import { CompositeChannelFactory, EventBus, ReactorBuilder, ReactorClientBuilder, SyncBuilder, } from "@powerhousedao/reactor";
|
|
3
4
|
import { VitePackageLoader, getUniqueDocumentModels, initializeAndStartAPI, startViteServer, } from "@powerhousedao/reactor-api";
|
|
4
5
|
import * as Sentry from "@sentry/node";
|
|
5
6
|
import { DocumentAlreadyExistsError, InMemoryCache, ReactorBuilder as LegacyReactorBuilder, RedisCache, childLogger, driveDocumentModelModule, } from "document-drive";
|
|
@@ -8,9 +9,13 @@ import { PrismaStorageFactory } from "document-drive/storage/prisma";
|
|
|
8
9
|
import { documentModelDocumentModelModule } from "document-model";
|
|
9
10
|
import dotenv from "dotenv";
|
|
10
11
|
import express from "express";
|
|
12
|
+
import { Kysely, PostgresDialect } from "kysely";
|
|
13
|
+
import { PGliteDialect } from "kysely-pglite-dialect";
|
|
11
14
|
import path from "path";
|
|
15
|
+
import { Pool } from "pg";
|
|
12
16
|
import { initRedis } from "./clients/redis.js";
|
|
13
|
-
import {
|
|
17
|
+
import { initConnectCrypto } from "./connect-crypto.js";
|
|
18
|
+
import { initFeatureFlags } from "./feature-flags.js";
|
|
14
19
|
import { initProfilerFromEnv } from "./profiler.js";
|
|
15
20
|
import { addDefaultDrive, addRemoteDrive, isPostgresUrl } from "./utils.js";
|
|
16
21
|
const logger = childLogger(["switchboard"]);
|
|
@@ -66,7 +71,7 @@ async function initReactorStorage(cache, dbPath = "./.ph/drive-storage") {
|
|
|
66
71
|
storagePath: filesystemPath,
|
|
67
72
|
};
|
|
68
73
|
}
|
|
69
|
-
async function initServer(serverPort, options) {
|
|
74
|
+
async function initServer(serverPort, options, connectCrypto) {
|
|
70
75
|
const { dev, packages = [], remoteDrives = [] } = options;
|
|
71
76
|
const dbPath = options.dbPath ?? process.env.DATABASE_URL;
|
|
72
77
|
// start redis if configured
|
|
@@ -115,13 +120,36 @@ async function initServer(serverPort, options) {
|
|
|
115
120
|
...documentModels,
|
|
116
121
|
]))
|
|
117
122
|
.withLegacyStorage(storage)
|
|
123
|
+
.withSync(new SyncBuilder().withChannelFactory(new CompositeChannelFactory()))
|
|
118
124
|
.withFeatures({
|
|
119
125
|
legacyStorageEnabled: true,
|
|
120
126
|
});
|
|
121
|
-
|
|
127
|
+
if (dbPath && isPostgresUrl(dbPath)) {
|
|
128
|
+
const connectionString = dbPath.includes("amazonaws") && !dbPath.includes("sslmode=no-verify")
|
|
129
|
+
? dbPath + "?sslmode=no-verify"
|
|
130
|
+
: dbPath;
|
|
131
|
+
const pool = new Pool({ connectionString });
|
|
132
|
+
const kysely = new Kysely({
|
|
133
|
+
dialect: new PostgresDialect({ pool }),
|
|
134
|
+
});
|
|
135
|
+
builder.withKysely(kysely);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
const pglitePath = dbPath || "./.ph/reactor-storage";
|
|
139
|
+
const pglite = new PGlite(pglitePath);
|
|
140
|
+
const kysely = new Kysely({
|
|
141
|
+
dialect: new PGliteDialect(pglite),
|
|
142
|
+
});
|
|
143
|
+
builder.withKysely(kysely);
|
|
144
|
+
}
|
|
145
|
+
const module = await new ReactorClientBuilder()
|
|
122
146
|
.withReactorBuilder(builder)
|
|
123
|
-
.
|
|
124
|
-
|
|
147
|
+
.buildModule();
|
|
148
|
+
const syncManager = module.reactorModule?.syncModule?.syncManager;
|
|
149
|
+
if (!syncManager) {
|
|
150
|
+
throw new Error("SyncManager not available from ReactorClientBuilder");
|
|
151
|
+
}
|
|
152
|
+
return { client: module.client, syncManager };
|
|
125
153
|
};
|
|
126
154
|
let defaultDriveUrl = undefined;
|
|
127
155
|
// TODO get path from powerhouse config
|
|
@@ -146,12 +174,11 @@ async function initServer(serverPort, options) {
|
|
|
146
174
|
configFile: options.configFile ??
|
|
147
175
|
path.join(process.cwd(), "powerhouse.config.json"),
|
|
148
176
|
mcp: options.mcp ?? true,
|
|
149
|
-
subgraphs: options.subgraphs,
|
|
150
177
|
});
|
|
151
|
-
const { driveServer } = api;
|
|
178
|
+
const { client, driveServer } = api;
|
|
152
179
|
// Create default drive if provided
|
|
153
180
|
if (options.drive) {
|
|
154
|
-
defaultDriveUrl = await addDefaultDrive(
|
|
181
|
+
defaultDriveUrl = await addDefaultDrive(client, options.drive, serverPort);
|
|
155
182
|
}
|
|
156
183
|
// add vite middleware after express app is initialized if applicable
|
|
157
184
|
if (vite) {
|
|
@@ -188,19 +215,15 @@ async function initServer(serverPort, options) {
|
|
|
188
215
|
defaultDriveUrl,
|
|
189
216
|
api,
|
|
190
217
|
reactor: driveServer,
|
|
218
|
+
connectCrypto,
|
|
191
219
|
};
|
|
192
220
|
}
|
|
193
221
|
export const startSwitchboard = async (options = {}) => {
|
|
194
222
|
const serverPort = options.port ?? DEFAULT_PORT;
|
|
195
223
|
// Initialize feature flags
|
|
196
224
|
await initFeatureFlags();
|
|
197
|
-
const enabled = await isReactorv2Enabled();
|
|
198
|
-
options.subgraphs = {
|
|
199
|
-
isReactorv2Enabled: enabled,
|
|
200
|
-
};
|
|
201
|
-
const dualActionCreateEnabled = await isDualActionCreateEnabled();
|
|
202
225
|
options.reactorOptions = {
|
|
203
|
-
enableDualActionCreate:
|
|
226
|
+
enableDualActionCreate: true,
|
|
204
227
|
};
|
|
205
228
|
if (process.env.PYROSCOPE_SERVER_ADDRESS) {
|
|
206
229
|
try {
|
|
@@ -211,8 +234,19 @@ export const startSwitchboard = async (options = {}) => {
|
|
|
211
234
|
logger.error("Error starting profiler", e);
|
|
212
235
|
}
|
|
213
236
|
}
|
|
237
|
+
// Initialize ConnectCrypto if identity options are provided or keypair exists
|
|
238
|
+
let connectCrypto = null;
|
|
239
|
+
try {
|
|
240
|
+
connectCrypto = await initConnectCrypto(options.identity);
|
|
241
|
+
}
|
|
242
|
+
catch (e) {
|
|
243
|
+
logger.warn("Failed to initialize ConnectCrypto:", e);
|
|
244
|
+
if (options.identity?.requireExisting) {
|
|
245
|
+
throw new Error('Identity required but failed to initialize. Run "ph login" first.');
|
|
246
|
+
}
|
|
247
|
+
}
|
|
214
248
|
try {
|
|
215
|
-
return await initServer(serverPort, options);
|
|
249
|
+
return await initServer(serverPort, options, connectCrypto);
|
|
216
250
|
}
|
|
217
251
|
catch (e) {
|
|
218
252
|
Sentry.captureException(e);
|
|
@@ -221,4 +255,5 @@ export const startSwitchboard = async (options = {}) => {
|
|
|
221
255
|
}
|
|
222
256
|
};
|
|
223
257
|
export * from "./types.js";
|
|
258
|
+
export { getConnectCrypto, getConnectDid, getBearerToken, } from "./connect-crypto.js";
|
|
224
259
|
//# sourceMappingURL=server.js.map
|
package/dist/src/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";AACA,OAAO,EACL,QAAQ,EACR,cAAc,EACd,oBAAoB,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACL,uBAAuB,EAEvB,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,GAChB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AAEvC,OAAO,EACL,0BAA0B,EAC1B,aAAa,EACb,cAAc,IAAI,oBAAoB,EACtC,UAAU,EACV,WAAW,EACX,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,gCAAgC,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MA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