@dxos/react-client 0.6.3-staging.9c1c979 → 0.6.3
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/dist/lib/browser/{chunk-EC7YAXPW.mjs → chunk-NLQLAARM.mjs} +71 -8
- package/dist/lib/browser/chunk-NLQLAARM.mjs.map +7 -0
- package/dist/lib/browser/devtools/index.mjs +1 -1
- package/dist/lib/browser/echo/index.mjs +1 -1
- package/dist/lib/browser/halo/index.mjs +1 -1
- package/dist/lib/browser/index.mjs +7 -1
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/mesh/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-QG3DJNSC.cjs → chunk-E3S6YHNJ.cjs} +104 -42
- package/dist/lib/node/chunk-E3S6YHNJ.cjs.map +7 -0
- package/dist/lib/node/devtools/index.cjs +2 -2
- package/dist/lib/node/echo/index.cjs +3 -3
- package/dist/lib/node/halo/index.cjs +5 -5
- package/dist/lib/node/index.cjs +15 -9
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/mesh/index.cjs +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +2 -2
- package/dist/types/src/{services → client}/AgentHostingProvider.d.ts +1 -1
- package/dist/types/src/client/AgentHostingProvider.d.ts.map +1 -0
- package/dist/types/src/client/ClientContext.d.ts +1 -2
- package/dist/types/src/client/ClientContext.d.ts.map +1 -1
- package/dist/types/src/client/index.d.ts +1 -0
- package/dist/types/src/client/index.d.ts.map +1 -1
- package/dist/types/src/client/useClientServices.d.ts +1 -1
- package/dist/types/src/client/useClientServices.d.ts.map +1 -1
- package/dist/types/src/client/useShell.d.ts +1 -1
- package/dist/types/src/client/useShell.d.ts.map +1 -1
- package/package.json +20 -30
- package/project.json +0 -1
- package/src/{services → client}/AgentHostingProvider.tsx +1 -1
- package/src/client/ClientContext.stories.tsx +1 -1
- package/src/client/ClientContext.test.tsx +1 -2
- package/src/client/ClientContext.tsx +7 -2
- package/src/client/index.ts +1 -0
- package/src/client/useClientServices.ts +1 -1
- package/src/client/useConfig.test.tsx +1 -2
- package/src/client/useShell.ts +1 -1
- package/src/echo/useSpaces.test.tsx +1 -2
- package/src/halo/useDevices.test.tsx +1 -2
- package/dist/lib/browser/chunk-EC7YAXPW.mjs.map +0 -7
- package/dist/lib/browser/services/index.mjs +0 -70
- package/dist/lib/browser/services/index.mjs.map +0 -7
- package/dist/lib/node/chunk-QG3DJNSC.cjs.map +0 -7
- package/dist/lib/node/services/index.cjs +0 -102
- package/dist/lib/node/services/index.cjs.map +0 -7
- package/dist/types/src/services/AgentHostingProvider.d.ts.map +0 -1
- package/dist/types/src/services/index.d.ts +0 -3
- package/dist/types/src/services/index.d.ts.map +0 -1
- package/src/services/index.ts +0 -7
|
@@ -26,10 +26,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_E3S6YHNJ_exports = {};
|
|
30
|
+
__export(chunk_E3S6YHNJ_exports, {
|
|
31
|
+
AgentHostingContext: () => AgentHostingContext,
|
|
32
|
+
AgentHostingProvider: () => AgentHostingProvider,
|
|
31
33
|
ClientContext: () => ClientContext,
|
|
32
34
|
ClientProvider: () => ClientProvider,
|
|
35
|
+
useAgentHostingClient: () => useAgentHostingClient,
|
|
33
36
|
useClient: () => useClient,
|
|
34
37
|
useClientServices: () => useClientServices,
|
|
35
38
|
useConfig: () => useConfig,
|
|
@@ -37,19 +40,22 @@ __export(chunk_QG3DJNSC_exports, {
|
|
|
37
40
|
useShellDisplay: () => useShellDisplay,
|
|
38
41
|
useStatus: () => useStatus
|
|
39
42
|
});
|
|
40
|
-
module.exports = __toCommonJS(
|
|
43
|
+
module.exports = __toCommonJS(chunk_E3S6YHNJ_exports);
|
|
41
44
|
var import_react = __toESM(require("react"));
|
|
42
45
|
var import_client = require("@dxos/client");
|
|
43
|
-
var import_debug = require("@dxos/debug");
|
|
44
|
-
var import_react2 = require("@dxos/echo-signals/react");
|
|
45
46
|
var import_log = require("@dxos/log");
|
|
47
|
+
var import_react2 = __toESM(require("react"));
|
|
48
|
+
var import_client2 = require("@dxos/client");
|
|
49
|
+
var import_debug = require("@dxos/debug");
|
|
50
|
+
var import_react3 = require("@dxos/echo-signals/react");
|
|
51
|
+
var import_log2 = require("@dxos/log");
|
|
46
52
|
var import_util = require("@dxos/util");
|
|
47
|
-
var import_react3 = require("react");
|
|
48
|
-
var import_debug2 = require("@dxos/debug");
|
|
49
53
|
var import_react4 = require("react");
|
|
50
|
-
var
|
|
54
|
+
var import_debug2 = require("@dxos/debug");
|
|
51
55
|
var import_react5 = require("react");
|
|
56
|
+
var import_debug3 = require("@dxos/debug");
|
|
52
57
|
var import_react6 = require("react");
|
|
58
|
+
var import_react7 = require("react");
|
|
53
59
|
var import_debug4 = require("@dxos/debug");
|
|
54
60
|
var BANNER = (client) => {
|
|
55
61
|
const commitHash = client.config.get("runtime.app.build.commitHash");
|
|
@@ -74,22 +80,22 @@ var printBanner = (client) => {
|
|
|
74
80
|
console.log(`%c${BANNER(client)}`, "font-family: monospace;");
|
|
75
81
|
};
|
|
76
82
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/react-client/src/client/ClientContext.tsx";
|
|
77
|
-
var ClientContext = /* @__PURE__ */ (0,
|
|
83
|
+
var ClientContext = /* @__PURE__ */ (0, import_react2.createContext)(void 0);
|
|
78
84
|
var useClient = () => {
|
|
79
|
-
const { client } = (0,
|
|
85
|
+
const { client } = (0, import_react2.useContext)(ClientContext) ?? (0, import_debug.raise)(new Error("Missing ClientContext."));
|
|
80
86
|
return client;
|
|
81
87
|
};
|
|
82
88
|
var ClientProvider = ({ children, config: configProvider, services: createServices, client: clientProvider, fallback: Fallback = () => null, registerSignalFactory: register = true, onInitialized, ...options }) => {
|
|
83
|
-
(0,
|
|
84
|
-
register && (0,
|
|
89
|
+
(0, import_react2.useMemo)(() => {
|
|
90
|
+
register && (0, import_react3.registerSignalFactory)();
|
|
85
91
|
}, []);
|
|
86
|
-
const [client, setClient] = (0,
|
|
87
|
-
const [status, setStatus] = (0,
|
|
88
|
-
const [error, setError] = (0,
|
|
92
|
+
const [client, setClient] = (0, import_react2.useState)(clientProvider instanceof import_client2.Client ? clientProvider : void 0);
|
|
93
|
+
const [status, setStatus] = (0, import_react2.useState)(null);
|
|
94
|
+
const [error, setError] = (0, import_react2.useState)();
|
|
89
95
|
if (error) {
|
|
90
96
|
throw error;
|
|
91
97
|
}
|
|
92
|
-
(0,
|
|
98
|
+
(0, import_react2.useEffect)(() => {
|
|
93
99
|
if (!client) {
|
|
94
100
|
return;
|
|
95
101
|
}
|
|
@@ -99,24 +105,24 @@ var ClientProvider = ({ children, config: configProvider, services: createServic
|
|
|
99
105
|
client,
|
|
100
106
|
setStatus
|
|
101
107
|
]);
|
|
102
|
-
(0,
|
|
108
|
+
(0, import_react2.useEffect)(() => {
|
|
103
109
|
const done = async (client2) => {
|
|
104
110
|
await client2.initialize().catch(setError);
|
|
105
|
-
(0,
|
|
111
|
+
(0, import_log2.log)("client ready", void 0, {
|
|
106
112
|
F: __dxlog_file,
|
|
107
|
-
L:
|
|
113
|
+
L: 140,
|
|
108
114
|
S: void 0,
|
|
109
115
|
C: (f, a) => f(...a)
|
|
110
116
|
});
|
|
111
117
|
await onInitialized?.(client2);
|
|
112
|
-
(0,
|
|
118
|
+
(0, import_log2.log)("initialization complete", void 0, {
|
|
113
119
|
F: __dxlog_file,
|
|
114
|
-
L:
|
|
120
|
+
L: 142,
|
|
115
121
|
S: void 0,
|
|
116
122
|
C: (f, a) => f(...a)
|
|
117
123
|
});
|
|
118
124
|
setClient(client2);
|
|
119
|
-
setStatus(client2.status.get() ??
|
|
125
|
+
setStatus(client2.status.get() ?? import_client2.SystemStatus.ACTIVE);
|
|
120
126
|
printBanner(client2);
|
|
121
127
|
};
|
|
122
128
|
const timeout = setTimeout(async () => {
|
|
@@ -125,31 +131,31 @@ var ClientProvider = ({ children, config: configProvider, services: createServic
|
|
|
125
131
|
await done(client2);
|
|
126
132
|
} else {
|
|
127
133
|
const config = await (0, import_util.getAsyncValue)(configProvider);
|
|
128
|
-
(0,
|
|
134
|
+
(0, import_log2.log)("resolved config", {
|
|
129
135
|
config
|
|
130
136
|
}, {
|
|
131
137
|
F: __dxlog_file,
|
|
132
|
-
L:
|
|
138
|
+
L: 156,
|
|
133
139
|
S: void 0,
|
|
134
140
|
C: (f, a) => f(...a)
|
|
135
141
|
});
|
|
136
142
|
const services = await createServices?.(config);
|
|
137
|
-
(0,
|
|
143
|
+
(0, import_log2.log)("created services", {
|
|
138
144
|
services
|
|
139
145
|
}, {
|
|
140
146
|
F: __dxlog_file,
|
|
141
|
-
L:
|
|
147
|
+
L: 158,
|
|
142
148
|
S: void 0,
|
|
143
149
|
C: (f, a) => f(...a)
|
|
144
150
|
});
|
|
145
|
-
const client2 = new
|
|
151
|
+
const client2 = new import_client2.Client({
|
|
146
152
|
config,
|
|
147
153
|
services,
|
|
148
154
|
...options
|
|
149
155
|
});
|
|
150
|
-
(0,
|
|
156
|
+
(0, import_log2.log)("created client", void 0, {
|
|
151
157
|
F: __dxlog_file,
|
|
152
|
-
L:
|
|
158
|
+
L: 160,
|
|
153
159
|
S: void 0,
|
|
154
160
|
C: (f, a) => f(...a)
|
|
155
161
|
});
|
|
@@ -157,16 +163,16 @@ var ClientProvider = ({ children, config: configProvider, services: createServic
|
|
|
157
163
|
}
|
|
158
164
|
});
|
|
159
165
|
return () => {
|
|
160
|
-
(0,
|
|
166
|
+
(0, import_log2.log)("clean up", void 0, {
|
|
161
167
|
F: __dxlog_file,
|
|
162
|
-
L:
|
|
168
|
+
L: 166,
|
|
163
169
|
S: void 0,
|
|
164
170
|
C: (f, a) => f(...a)
|
|
165
171
|
});
|
|
166
172
|
clearTimeout(timeout);
|
|
167
|
-
void client?.destroy().catch((err) =>
|
|
173
|
+
void client?.destroy().catch((err) => import_log2.log.catch(err, void 0, {
|
|
168
174
|
F: __dxlog_file,
|
|
169
|
-
L:
|
|
175
|
+
L: 168,
|
|
170
176
|
S: void 0,
|
|
171
177
|
C: (f, a) => f(...a)
|
|
172
178
|
}));
|
|
@@ -176,13 +182,13 @@ var ClientProvider = ({ children, config: configProvider, services: createServic
|
|
|
176
182
|
configProvider,
|
|
177
183
|
createServices
|
|
178
184
|
]);
|
|
179
|
-
if (!client || status !==
|
|
180
|
-
return /* @__PURE__ */
|
|
185
|
+
if (!client || status !== import_client2.SystemStatus.ACTIVE) {
|
|
186
|
+
return /* @__PURE__ */ import_react2.default.createElement(Fallback, {
|
|
181
187
|
client,
|
|
182
188
|
status
|
|
183
189
|
});
|
|
184
190
|
}
|
|
185
|
-
return /* @__PURE__ */
|
|
191
|
+
return /* @__PURE__ */ import_react2.default.createElement(ClientContext.Provider, {
|
|
186
192
|
value: {
|
|
187
193
|
client,
|
|
188
194
|
status
|
|
@@ -190,11 +196,11 @@ var ClientProvider = ({ children, config: configProvider, services: createServic
|
|
|
190
196
|
}, children);
|
|
191
197
|
};
|
|
192
198
|
var useClientServices = () => {
|
|
193
|
-
const { services } = (0,
|
|
199
|
+
const { services } = (0, import_react4.useContext)(ClientContext) ?? (0, import_debug2.raise)(new Error("Missing ClientContext."));
|
|
194
200
|
return services;
|
|
195
201
|
};
|
|
196
202
|
var useConfig = () => {
|
|
197
|
-
const { client } = (0,
|
|
203
|
+
const { client } = (0, import_react5.useContext)(ClientContext) ?? (0, import_debug3.raise)(new Error("Missing ClientContext."));
|
|
198
204
|
return client.config;
|
|
199
205
|
};
|
|
200
206
|
var useShell = () => {
|
|
@@ -203,20 +209,76 @@ var useShell = () => {
|
|
|
203
209
|
};
|
|
204
210
|
var useShellDisplay = () => {
|
|
205
211
|
const client = useClient();
|
|
206
|
-
const [display, setDisplay] = (0,
|
|
207
|
-
(0,
|
|
212
|
+
const [display, setDisplay] = (0, import_react6.useState)(client.shell.display);
|
|
213
|
+
(0, import_react6.useEffect)(() => client.shell.onDisplayChange(setDisplay), [
|
|
208
214
|
client
|
|
209
215
|
]);
|
|
210
216
|
return display;
|
|
211
217
|
};
|
|
212
218
|
var useStatus = () => {
|
|
213
|
-
const { status } = (0,
|
|
219
|
+
const { status } = (0, import_react7.useContext)(ClientContext) ?? (0, import_debug4.raise)(new Error("Missing ClientContext."));
|
|
214
220
|
return status;
|
|
215
221
|
};
|
|
222
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/react-client/src/client/AgentHostingProvider.tsx";
|
|
223
|
+
var AgentHostingContext = /* @__PURE__ */ (0, import_react.createContext)(null);
|
|
224
|
+
var AgentHostingProvider = (props) => {
|
|
225
|
+
const client = useClient();
|
|
226
|
+
const [agentHostingProviderClient] = (0, import_react.useState)(makeClient(client));
|
|
227
|
+
return /* @__PURE__ */ import_react.default.createElement(AgentHostingContext.Provider, {
|
|
228
|
+
value: agentHostingProviderClient
|
|
229
|
+
}, " ", props.children);
|
|
230
|
+
};
|
|
231
|
+
var useAgentHostingClient = () => {
|
|
232
|
+
return (0, import_react.useContext)(AgentHostingContext);
|
|
233
|
+
};
|
|
234
|
+
var makeClient = ({ config, halo }) => {
|
|
235
|
+
const agentHostingConfig = config.get("runtime.services.agentHosting");
|
|
236
|
+
if (!agentHostingConfig) {
|
|
237
|
+
(0, import_log.log)("no agent hosting configured", void 0, {
|
|
238
|
+
F: __dxlog_file2,
|
|
239
|
+
L: 38,
|
|
240
|
+
S: void 0,
|
|
241
|
+
C: (f, a) => f(...a)
|
|
242
|
+
});
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
245
|
+
let agentHostingProviderClient = null;
|
|
246
|
+
switch (agentHostingConfig.type) {
|
|
247
|
+
case "LOCAL_TESTING": {
|
|
248
|
+
(0, import_log.log)("using FakeAgentHostingProvider", void 0, {
|
|
249
|
+
F: __dxlog_file2,
|
|
250
|
+
L: 46,
|
|
251
|
+
S: void 0,
|
|
252
|
+
C: (f, a) => f(...a)
|
|
253
|
+
});
|
|
254
|
+
return new import_client.FakeAgentHostingProvider();
|
|
255
|
+
}
|
|
256
|
+
case "AGENTHOSTING_API": {
|
|
257
|
+
agentHostingProviderClient = new import_client.AgentManagerClient(config, halo);
|
|
258
|
+
if (agentHostingProviderClient.init()) {
|
|
259
|
+
return agentHostingProviderClient;
|
|
260
|
+
} else {
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
default: {
|
|
265
|
+
import_log.log.error("Unknown agent hosting provider type: " + agentHostingConfig.type, void 0, {
|
|
266
|
+
F: __dxlog_file2,
|
|
267
|
+
L: 61,
|
|
268
|
+
S: void 0,
|
|
269
|
+
C: (f, a) => f(...a)
|
|
270
|
+
});
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
};
|
|
216
275
|
// Annotate the CommonJS export names for ESM import in node:
|
|
217
276
|
0 && (module.exports = {
|
|
277
|
+
AgentHostingContext,
|
|
278
|
+
AgentHostingProvider,
|
|
218
279
|
ClientContext,
|
|
219
280
|
ClientProvider,
|
|
281
|
+
useAgentHostingClient,
|
|
220
282
|
useClient,
|
|
221
283
|
useClientServices,
|
|
222
284
|
useConfig,
|
|
@@ -224,4 +286,4 @@ var useStatus = () => {
|
|
|
224
286
|
useShellDisplay,
|
|
225
287
|
useStatus
|
|
226
288
|
});
|
|
227
|
-
//# sourceMappingURL=chunk-
|
|
289
|
+
//# sourceMappingURL=chunk-E3S6YHNJ.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/client/AgentHostingProvider.tsx", "../../../src/client/ClientContext.tsx", "../../../src/banner.ts", "../../../src/client/useClientServices.ts", "../../../src/client/useConfig.ts", "../../../src/client/useShell.ts", "../../../src/client/useStatus.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { createContext, type PropsWithChildren, useContext, useState } from 'react';\n\nimport { type AgentHostingProviderClient, AgentManagerClient, FakeAgentHostingProvider } from '@dxos/client';\nimport { type Halo } from '@dxos/client/halo';\nimport { type Config } from '@dxos/config';\nimport { log } from '@dxos/log';\n\nimport { useClient } from '../client';\n\n/*\n * Interface for invoking the agent hosting provider client.\n * @experimental\n */\n\nexport type AgentHostingProviderProps = { config: Config; halo: Halo };\n\nexport const AgentHostingContext = createContext<AgentHostingProviderClient | null>(null);\n\nexport const AgentHostingProvider = (props: PropsWithChildren<{}>) => {\n const client = useClient();\n const [agentHostingProviderClient] = useState(makeClient(client));\n return (\n <AgentHostingContext.Provider value={agentHostingProviderClient}> {props.children}</AgentHostingContext.Provider>\n );\n};\n\nexport const useAgentHostingClient = () => {\n return useContext(AgentHostingContext);\n};\n\nconst makeClient = ({ config, halo }: AgentHostingProviderProps) => {\n const agentHostingConfig = config.get('runtime.services.agentHosting');\n if (!agentHostingConfig) {\n log('no agent hosting configured');\n return null;\n }\n\n // TODO(nf): Dynamically discover based on runtime config.\n let agentHostingProviderClient: AgentHostingProviderClient | null = null;\n switch (agentHostingConfig.type) {\n case 'LOCAL_TESTING': {\n log('using FakeAgentHostingProvider');\n return new FakeAgentHostingProvider();\n }\n\n case 'AGENTHOSTING_API': {\n agentHostingProviderClient = new AgentManagerClient(config, halo);\n if (agentHostingProviderClient.init()) {\n return agentHostingProviderClient;\n } else {\n // Not authorized or error initializing\n return null;\n }\n }\n\n default: {\n log.error('Unknown agent hosting provider type: ' + agentHostingConfig.type);\n return null;\n }\n }\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport React, {\n type ReactNode,\n useState,\n type Context,\n createContext,\n useContext,\n useEffect,\n type FunctionComponent,\n useMemo,\n} from 'react';\n\nimport {\n Client,\n SystemStatus,\n type ClientOptions,\n type ClientServices,\n type ClientServicesProvider,\n} from '@dxos/client';\nimport { type Config } from '@dxos/config';\nimport { raise } from '@dxos/debug';\nimport { registerSignalFactory } from '@dxos/echo-signals/react';\nimport { log } from '@dxos/log';\nimport { getAsyncValue, type MaybePromise, type Provider } from '@dxos/util'; // TODO(burdon): Deprecate \"util\"?\n\nimport { printBanner } from '../banner';\n\n// TODO(burdon): Reconcile with ClientOptions.\nexport type ClientContextProps = {\n client: Client;\n\n // Optionally expose services (e.g., for devtools).\n // TODO(burdon): Can't this just be accessed via `client.services`?\n services?: ClientServices;\n\n status?: SystemStatus | null;\n};\n\nexport const ClientContext: Context<ClientContextProps | undefined> = createContext<ClientContextProps | undefined>(\n undefined,\n);\n\n/**\n * Hook returning instance of DXOS client.\n * Requires ClientContext to be set via ClientProvider.\n */\nexport const useClient = () => {\n const { client } = useContext(ClientContext) ?? raise(new Error('Missing ClientContext.'));\n return client;\n};\n\n/**\n * Properties for the ClientProvider.\n */\nexport type ClientProviderProps = Omit<ClientOptions, 'config' | 'services'> & {\n children?: ReactNode;\n\n /**\n * Config object or async provider.\n */\n config?: Config | Provider<Promise<Config>>;\n\n /**\n * Callback to enable the caller to create a custom ClientServicesProvider.\n *\n * Most apps won't need this.\n */\n services?: (config?: Config) => MaybePromise<ClientServicesProvider>;\n\n /**\n * Client object or async provider to enable to caller to do custom initialization.\n *\n * Most apps won't need this.\n */\n // TODO(wittjosiah): Remove async and just use to keeping reference to client?\n // (Prefering `onInitialized` for custom initialization.)\n client?: Client | Provider<Promise<Client>>;\n\n /**\n * ReactNode to display until the client is available.\n */\n // TODO(wittjosiah): Rename to `placeholder`.\n fallback?: FunctionComponent<Partial<ClientContextProps>>;\n\n /**\n * Set to false to stop default signal factory from being registered.\n */\n registerSignalFactory?: boolean;\n\n /**\n * Post initialization hook to enable to caller to do custom initialization.\n *\n * @param Client\n */\n onInitialized?: (client: Client) => MaybePromise<void>;\n};\n\n/**\n * Root component that provides the DXOS client instance to child components.\n * To be used with the `useClient` hook.\n */\nexport const ClientProvider = ({\n children,\n config: configProvider,\n services: createServices,\n client: clientProvider,\n fallback: Fallback = () => null,\n registerSignalFactory: register = true,\n onInitialized,\n ...options\n}: ClientProviderProps) => {\n useMemo(() => {\n // TODO(wittjosiah): Ideally this should be imported asynchronosly because it is optional.\n // Unfortunately, async import seemed to break signals React instrumentation.\n register && registerSignalFactory();\n }, []);\n\n const [client, setClient] = useState(clientProvider instanceof Client ? clientProvider : undefined);\n const [status, setStatus] = useState<SystemStatus | null>(null);\n const [error, setError] = useState();\n if (error) {\n throw error;\n }\n\n useEffect(() => {\n if (!client) {\n return;\n }\n\n const subscription = client.status.subscribe((status) => setStatus(status));\n return () => subscription.unsubscribe();\n }, [client, setStatus]);\n\n useEffect(() => {\n const done = async (client: Client) => {\n await client.initialize().catch(setError);\n log('client ready');\n await onInitialized?.(client);\n log('initialization complete');\n setClient(client);\n setStatus(client.status.get() ?? SystemStatus.ACTIVE);\n printBanner(client);\n };\n\n const timeout = setTimeout(async () => {\n if (clientProvider) {\n // Asynchronously request client.\n const client = await getAsyncValue(clientProvider);\n await done(client);\n } else {\n // Asynchronously construct client (config may be undefined).\n const config = await getAsyncValue(configProvider);\n log('resolved config', { config });\n const services = await createServices?.(config);\n log('created services', { services });\n const client = new Client({ config, services, ...options });\n log('created client');\n await done(client);\n }\n });\n\n return () => {\n log('clean up');\n clearTimeout(timeout);\n void client?.destroy().catch((err) => log.catch(err));\n };\n }, [clientProvider, configProvider, createServices]);\n\n if (!client || status !== SystemStatus.ACTIVE) {\n return <Fallback client={client} status={status} />;\n }\n\n // prettier-ignore\n return (\n <ClientContext.Provider value={{ client, status }}>\n {children}\n </ClientContext.Provider>\n );\n};\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { type Client } from '@dxos/client';\n\n// http://patorjk.com/software/taag/#p=testall&f=Patorjk-HeX&t=DXOS\nconst BANNER = (client: Client) => {\n const commitHash = client.config.get('runtime.app.build.commitHash');\n const hash = commitHash ? ` App Commit ${commitHash} \\n` : '';\n\n return (\n '\\n' +\n '_/\\\\/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\______/\\\\/\\\\/\\\\/\\\\/\\\\_\\n' +\n '_/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\__/\\\\/\\\\_________\\n' +\n '_/\\\\/\\\\____/\\\\/\\\\______/\\\\/\\\\______/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\___\\n' +\n '_/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\__________/\\\\/\\\\_\\n' +\n '_/\\\\/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\/\\\\___\\n' +\n `\\n DXOS Client ${client.version} \\n${hash}`\n );\n};\n\nlet bannerPrinted = false;\n\nexport const printBanner = (client: Client) => {\n if (bannerPrinted) {\n return;\n }\n\n bannerPrinted = true;\n // eslint-disable-next-line no-console\n console.log(`%c${BANNER(client)}`, 'font-family: monospace;');\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport type { ClientServices } from '@dxos/client';\nimport { raise } from '@dxos/debug';\n\nimport { ClientContext } from './ClientContext';\n\nexport const useClientServices = (): ClientServices | undefined => {\n const { services } = useContext(ClientContext) ?? raise(new Error('Missing ClientContext.'));\n return services;\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { ClientContext } from './ClientContext';\n\n/**\n * Hook returning config object used to initialize the DXOS client instance.\n * Requires ClientContext to be set via ClientProvider.\n */\nexport const useConfig = () => {\n const { client } = useContext(ClientContext) ?? raise(new Error('Missing ClientContext.'));\n return client.config;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { type Shell, type ShellDisplay } from '@dxos/client';\n\nimport { useClient } from './ClientContext';\n\n/**\n * Helper hook to access the shell.\n */\nexport const useShell = (): Shell => {\n const client = useClient();\n return client.shell;\n};\n\n/**\n * Hook to access the shell’s display state.\n */\nexport const useShellDisplay = (): ShellDisplay => {\n const client = useClient();\n const [display, setDisplay] = useState(client.shell.display);\n useEffect(() => client.shell.onDisplayChange(setDisplay), [client]);\n return display;\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { type SystemStatus } from '@dxos/client';\nimport { raise } from '@dxos/debug';\n\nimport { ClientContext } from './ClientContext';\n\nexport const useStatus = (): SystemStatus | null | undefined => {\n const { status } = useContext(ClientContext) ?? raise(new Error('Missing ClientContext.'));\n return status;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAmF;AAEnF,oBAA8F;AAG9F,iBAAoB;ACLpB,IAAAA,gBASO;AAEP,IAAAC,iBAMO;AAEP,mBAAsB;AACtB,IAAAD,gBAAsC;AACtC,IAAAE,cAAoB;AACpB,kBAAgE;AEtBhE,IAAAF,gBAA2B;AAG3B,IAAAG,gBAAsB;ACHtB,IAAAH,gBAA2B;AAE3B,IAAAG,gBAAsB;ACFtB,IAAAH,gBAAoC;ACApC,IAAAA,gBAA2B;AAG3B,IAAAG,gBAAsB;AJAtB,IAAMC,SAAS,CAACC,WAAAA;AACd,QAAMC,aAAaD,OAAOE,OAAOC,IAAI,8BAAA;AACrC,QAAMC,OAAOH,aAAa,eAAeA,UAAAA;IAAkB;AAE3D,SACE;;;;;;;eAMkBD,OAAOK,OAAO;EAAMD,IAAAA;AAE1C;AAEA,IAAIE,gBAAgB;AAEb,IAAMC,cAAc,CAACP,WAAAA;AAC1B,MAAIM,eAAe;AACjB;EACF;AAEAA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AmBxE,QAAQoE,IAAAA;AAC5D,UAAIH,2BAA2BQ,KAAI,GAAI;AACrC,eAAOR;MACT,OAAO;AAEL,eAAO;MACT;IACF;IAEA,SAAS;AACP1D,iBAAAA,IAAI0B,MAAM,0CAA0CoC,mBAAmBC,MAAI,QAAA;;;;;;AAC3E,aAAO;IACT;EACF;AACF;",
|
|
6
|
+
"names": ["import_react", "import_client", "import_log", "import_debug", "BANNER", "client", "commitHash", "config", "get", "hash", "version", "bannerPrinted", "printBanner", "console", "log", "ClientContext", "createContext", "undefined", "useClient", "useContext", "raise", "Error", "ClientProvider", "children", "configProvider", "services", "createServices", "clientProvider", "fallback", "Fallback", "registerSignalFactory", "register", "onInitialized", "options", "useMemo", "setClient", "useState", "Client", "status", "setStatus", "error", "setError", "useEffect", "subscription", "subscribe", "unsubscribe", "done", "initialize", "catch", "SystemStatus", "ACTIVE", "timeout", "setTimeout", "getAsyncValue", "clearTimeout", "destroy", "err", "React", "Provider", "value", "useClientServices", "useConfig", "useShell", "shell", "useShellDisplay", "display", "setDisplay", "onDisplayChange", "useStatus", "AgentHostingContext", "AgentHostingProvider", "props", "agentHostingProviderClient", "makeClient", "useAgentHostingClient", "halo", "agentHostingConfig", "type", "FakeAgentHostingProvider", "AgentManagerClient", "init"]
|
|
7
|
+
}
|
|
@@ -23,7 +23,7 @@ __export(devtools_exports, {
|
|
|
23
23
|
useStream: () => useStream
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(devtools_exports);
|
|
26
|
-
var
|
|
26
|
+
var import_chunk_E3S6YHNJ = require("../chunk-E3S6YHNJ.cjs");
|
|
27
27
|
__reExport(devtools_exports, require("@dxos/client/devtools"), module.exports);
|
|
28
28
|
var import_react = require("react");
|
|
29
29
|
var import_debug = require("@dxos/debug");
|
|
@@ -32,7 +32,7 @@ var import_react2 = require("react");
|
|
|
32
32
|
var import_log = require("@dxos/log");
|
|
33
33
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/react-client/src/devtools/useDevtools.ts";
|
|
34
34
|
var useDevtools = () => {
|
|
35
|
-
const { services } = (0, import_react.useContext)(
|
|
35
|
+
const { services } = (0, import_react.useContext)(import_chunk_E3S6YHNJ.ClientContext) ?? (0, import_debug.raise)(new Error("Missing ClientContext."));
|
|
36
36
|
(0, import_invariant.invariant)(services, void 0, {
|
|
37
37
|
F: __dxlog_file,
|
|
38
38
|
L: 15,
|
|
@@ -29,7 +29,7 @@ __export(echo_exports, {
|
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(echo_exports);
|
|
31
31
|
var import_chunk_TQWLADVH = require("../chunk-TQWLADVH.cjs");
|
|
32
|
-
var
|
|
32
|
+
var import_chunk_E3S6YHNJ = require("../chunk-E3S6YHNJ.cjs");
|
|
33
33
|
__reExport(echo_exports, require("@dxos/client/echo"), module.exports);
|
|
34
34
|
var import_async = require("@dxos/async");
|
|
35
35
|
var import_echo = require("@dxos/client/echo");
|
|
@@ -45,7 +45,7 @@ var import_react_async3 = require("@dxos/react-async");
|
|
|
45
45
|
var import_react4 = require("react");
|
|
46
46
|
var import_echo4 = require("@dxos/client/echo");
|
|
47
47
|
var useSpace = (spaceKeyLike) => {
|
|
48
|
-
const client = (0,
|
|
48
|
+
const client = (0, import_chunk_E3S6YHNJ.useClient)();
|
|
49
49
|
const spaces = (0, import_react_async2.useMulticastObservable)(client.spaces);
|
|
50
50
|
const [ready, setReady] = (0, import_react.useState)(false);
|
|
51
51
|
(0, import_react.useEffect)(() => {
|
|
@@ -69,7 +69,7 @@ var useSpace = (spaceKeyLike) => {
|
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
var useSpaces = ({ all = false } = {}) => {
|
|
72
|
-
const client = (0,
|
|
72
|
+
const client = (0, import_chunk_E3S6YHNJ.useClient)();
|
|
73
73
|
const spaces = (0, import_react_async2.useMulticastObservable)(client.spaces);
|
|
74
74
|
return spaces.filter((space) => all || space.state.get() === import_echo2.SpaceState.SPACE_READY);
|
|
75
75
|
};
|
|
@@ -31,7 +31,7 @@ __export(halo_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(halo_exports);
|
|
33
33
|
var import_chunk_TQWLADVH = require("../chunk-TQWLADVH.cjs");
|
|
34
|
-
var
|
|
34
|
+
var import_chunk_E3S6YHNJ = require("../chunk-E3S6YHNJ.cjs");
|
|
35
35
|
var import_halo = require("@dxos/client/halo");
|
|
36
36
|
var import_react_async = require("@dxos/react-async");
|
|
37
37
|
var import_react_async2 = require("@dxos/react-async");
|
|
@@ -40,15 +40,15 @@ var import_react_async3 = require("@dxos/react-async");
|
|
|
40
40
|
var import_react_async4 = require("@dxos/react-async");
|
|
41
41
|
var import_react2 = require("react");
|
|
42
42
|
var useContacts = () => {
|
|
43
|
-
const client = (0,
|
|
43
|
+
const client = (0, import_chunk_E3S6YHNJ.useClient)();
|
|
44
44
|
return (0, import_react_async.useMulticastObservable)(client.halo.contacts);
|
|
45
45
|
};
|
|
46
46
|
var useDevices = () => {
|
|
47
|
-
const client = (0,
|
|
47
|
+
const client = (0, import_chunk_E3S6YHNJ.useClient)();
|
|
48
48
|
return (0, import_react_async2.useMulticastObservable)(client.halo.devices);
|
|
49
49
|
};
|
|
50
50
|
var useHaloInvitations = () => {
|
|
51
|
-
const client = (0,
|
|
51
|
+
const client = (0, import_chunk_E3S6YHNJ.useClient)();
|
|
52
52
|
return (0, import_react_async3.useMulticastObservable)(client.halo.invitations);
|
|
53
53
|
};
|
|
54
54
|
var useHaloInvitation = (invitationId) => {
|
|
@@ -59,7 +59,7 @@ var useHaloInvitation = (invitationId) => {
|
|
|
59
59
|
return (0, import_chunk_TQWLADVH.useInvitationStatus)(invitation);
|
|
60
60
|
};
|
|
61
61
|
var useIdentity = () => {
|
|
62
|
-
const client = (0,
|
|
62
|
+
const client = (0, import_chunk_E3S6YHNJ.useClient)();
|
|
63
63
|
return (0, import_react_async4.useMulticastObservable)(client.halo.identity);
|
|
64
64
|
};
|
|
65
65
|
var KeyStore = class {
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -19,24 +19,30 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
var node_exports = {};
|
|
21
21
|
__export(node_exports, {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
AgentHostingContext: () => import_chunk_E3S6YHNJ.AgentHostingContext,
|
|
23
|
+
AgentHostingProvider: () => import_chunk_E3S6YHNJ.AgentHostingProvider,
|
|
24
|
+
ClientContext: () => import_chunk_E3S6YHNJ.ClientContext,
|
|
25
|
+
ClientProvider: () => import_chunk_E3S6YHNJ.ClientProvider,
|
|
26
|
+
useAgentHostingClient: () => import_chunk_E3S6YHNJ.useAgentHostingClient,
|
|
27
|
+
useClient: () => import_chunk_E3S6YHNJ.useClient,
|
|
28
|
+
useClientServices: () => import_chunk_E3S6YHNJ.useClientServices,
|
|
29
|
+
useConfig: () => import_chunk_E3S6YHNJ.useConfig,
|
|
27
30
|
useMulticastObservable: () => import_react_async.useMulticastObservable,
|
|
28
|
-
useShell: () =>
|
|
29
|
-
useShellDisplay: () =>
|
|
30
|
-
useStatus: () =>
|
|
31
|
+
useShell: () => import_chunk_E3S6YHNJ.useShell,
|
|
32
|
+
useShellDisplay: () => import_chunk_E3S6YHNJ.useShellDisplay,
|
|
33
|
+
useStatus: () => import_chunk_E3S6YHNJ.useStatus
|
|
31
34
|
});
|
|
32
35
|
module.exports = __toCommonJS(node_exports);
|
|
33
|
-
var
|
|
36
|
+
var import_chunk_E3S6YHNJ = require("./chunk-E3S6YHNJ.cjs");
|
|
34
37
|
__reExport(node_exports, require("@dxos/client"), module.exports);
|
|
35
38
|
var import_react_async = require("@dxos/react-async");
|
|
36
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
40
|
0 && (module.exports = {
|
|
41
|
+
AgentHostingContext,
|
|
42
|
+
AgentHostingProvider,
|
|
38
43
|
ClientContext,
|
|
39
44
|
ClientProvider,
|
|
45
|
+
useAgentHostingClient,
|
|
40
46
|
useClient,
|
|
41
47
|
useClientServices,
|
|
42
48
|
useConfig,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["//\n// Copyright 2020 DXOS.org\n//\n\nexport * from '@dxos/client';\nexport { useMulticastObservable } from '@dxos/react-async';\n\nexport * from './client';\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,yBAAc;AACd,yBAAuC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,11 +22,11 @@ __export(mesh_exports, {
|
|
|
22
22
|
useNetworkStatus: () => useNetworkStatus
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(mesh_exports);
|
|
25
|
-
var
|
|
25
|
+
var import_chunk_E3S6YHNJ = require("../chunk-E3S6YHNJ.cjs");
|
|
26
26
|
__reExport(mesh_exports, require("@dxos/client/mesh"), module.exports);
|
|
27
27
|
var import_react_async = require("@dxos/react-async");
|
|
28
28
|
var useNetworkStatus = () => {
|
|
29
|
-
const client = (0,
|
|
29
|
+
const client = (0, import_chunk_E3S6YHNJ.useClient)();
|
|
30
30
|
return (0, import_react_async.useMulticastObservable)(client.mesh.networkStatus);
|
|
31
31
|
};
|
|
32
32
|
// Annotate the CommonJS export names for ESM import in node:
|