@dxos/functions 0.8.4-main.b97322e → 0.8.4-main.c1de068
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/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -33
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -33
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/testing/services.d.ts +4 -15
- package/dist/types/src/testing/services.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -23
- package/src/testing/services.ts +6 -60
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/functions",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.c1de068",
|
|
4
4
|
"description": "Functions API and runtime.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -58,32 +58,32 @@
|
|
|
58
58
|
"i18next": "^24.2.1",
|
|
59
59
|
"iso-did": "^1.6.0",
|
|
60
60
|
"ws": "^8.14.2",
|
|
61
|
-
"@dxos/ai": "0.8.4-main.
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/echo": "0.8.4-main.
|
|
68
|
-
"@dxos/echo-pipeline": "0.8.4-main.
|
|
69
|
-
"@dxos/echo-protocol": "0.8.4-main.
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
74
|
-
"@dxos/invariant": "0.8.4-main.
|
|
75
|
-
"@dxos/keys": "0.8.4-main.
|
|
76
|
-
"@dxos/live-object": "0.8.4-main.
|
|
77
|
-
"@dxos/log": "0.8.4-main.
|
|
78
|
-
"@dxos/node-std": "0.8.4-main.
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/
|
|
81
|
-
"@dxos/util": "0.8.4-main.
|
|
61
|
+
"@dxos/ai": "0.8.4-main.c1de068",
|
|
62
|
+
"@dxos/client": "0.8.4-main.c1de068",
|
|
63
|
+
"@dxos/async": "0.8.4-main.c1de068",
|
|
64
|
+
"@dxos/context": "0.8.4-main.c1de068",
|
|
65
|
+
"@dxos/echo": "0.8.4-main.c1de068",
|
|
66
|
+
"@dxos/crypto": "0.8.4-main.c1de068",
|
|
67
|
+
"@dxos/echo-db": "0.8.4-main.c1de068",
|
|
68
|
+
"@dxos/echo-pipeline": "0.8.4-main.c1de068",
|
|
69
|
+
"@dxos/echo-protocol": "0.8.4-main.c1de068",
|
|
70
|
+
"@dxos/edge-client": "0.8.4-main.c1de068",
|
|
71
|
+
"@dxos/echo-schema": "0.8.4-main.c1de068",
|
|
72
|
+
"@dxos/errors": "0.8.4-main.c1de068",
|
|
73
|
+
"@dxos/effect": "0.8.4-main.c1de068",
|
|
74
|
+
"@dxos/invariant": "0.8.4-main.c1de068",
|
|
75
|
+
"@dxos/keys": "0.8.4-main.c1de068",
|
|
76
|
+
"@dxos/live-object": "0.8.4-main.c1de068",
|
|
77
|
+
"@dxos/log": "0.8.4-main.c1de068",
|
|
78
|
+
"@dxos/node-std": "0.8.4-main.c1de068",
|
|
79
|
+
"@dxos/schema": "0.8.4-main.c1de068",
|
|
80
|
+
"@dxos/protocols": "0.8.4-main.c1de068",
|
|
81
|
+
"@dxos/util": "0.8.4-main.c1de068"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@types/express": "^4.17.17",
|
|
85
85
|
"@types/ws": "^7.4.0",
|
|
86
|
-
"@dxos/agent": "0.8.4-main.
|
|
86
|
+
"@dxos/agent": "0.8.4-main.c1de068"
|
|
87
87
|
},
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
package/src/testing/services.ts
CHANGED
|
@@ -4,13 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Context } from 'effect';
|
|
6
6
|
|
|
7
|
-
import { AiService, type AiServiceClient, type AiServiceEdgeClientOptions, EdgeAiServiceClient } from '@dxos/ai';
|
|
8
|
-
import { AI_SERVICE_ENDPOINT, createTestAiServiceClient } from '@dxos/ai/testing';
|
|
9
7
|
import type { Space } from '@dxos/client/echo';
|
|
10
8
|
import type { EchoDatabase, QueueFactory } from '@dxos/echo-db';
|
|
11
9
|
import { assertArgument } from '@dxos/invariant';
|
|
12
10
|
|
|
13
|
-
import { consoleLogger, noopLogger } from './logger';
|
|
14
11
|
import {
|
|
15
12
|
ConfiguredCredentialsService,
|
|
16
13
|
type CredentialsService,
|
|
@@ -21,6 +18,7 @@ import {
|
|
|
21
18
|
type ServiceCredential,
|
|
22
19
|
type TracingService,
|
|
23
20
|
} from '../services';
|
|
21
|
+
import { consoleLogger, noopLogger } from './logger';
|
|
24
22
|
|
|
25
23
|
// TODO(burdon): Factor out.
|
|
26
24
|
export type OneOf<T> = {
|
|
@@ -33,23 +31,7 @@ export type TestServiceOptions = {
|
|
|
33
31
|
/**
|
|
34
32
|
* AI service configuration.
|
|
35
33
|
*/
|
|
36
|
-
ai?:
|
|
37
|
-
/**
|
|
38
|
-
* Custom AI service client.
|
|
39
|
-
*/
|
|
40
|
-
client?: AiServiceClient;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Edge AI service at specified endpoint.
|
|
44
|
-
*/
|
|
45
|
-
endpoint?: AiServiceEdgeClientOptions['endpoint'];
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Predefined AI service configuration.
|
|
49
|
-
*/
|
|
50
|
-
// TODO(burdon): 'dev' and 'edge' are redundant with providing an endpoint.
|
|
51
|
-
provider?: AiServiceProvider;
|
|
52
|
-
}>;
|
|
34
|
+
ai?: any;
|
|
53
35
|
|
|
54
36
|
/**
|
|
55
37
|
* Credentials service configuration.
|
|
@@ -95,6 +77,9 @@ export type TestServiceOptions = {
|
|
|
95
77
|
};
|
|
96
78
|
};
|
|
97
79
|
|
|
80
|
+
/**
|
|
81
|
+
* @deprecated
|
|
82
|
+
*/
|
|
98
83
|
export const createTestServices = ({
|
|
99
84
|
ai,
|
|
100
85
|
credentials,
|
|
@@ -107,7 +92,7 @@ export const createTestServices = ({
|
|
|
107
92
|
assertArgument(!(!!space && (!!db || !!queues)), 'space can be provided only if db and queues are not');
|
|
108
93
|
|
|
109
94
|
return new ServiceContainer().setServices({
|
|
110
|
-
ai: createAiService(ai),
|
|
95
|
+
// ai: createAiService(ai),
|
|
111
96
|
credentials: createCredentialsService(credentials),
|
|
112
97
|
database: space || db ? DatabaseService.make(space?.db || db!) : undefined,
|
|
113
98
|
eventLogger: (logging?.logger ?? logging?.enabled) ? consoleLogger : noopLogger,
|
|
@@ -116,45 +101,6 @@ export const createTestServices = ({
|
|
|
116
101
|
});
|
|
117
102
|
};
|
|
118
103
|
|
|
119
|
-
// TODO(burdon): Enable model configuration.
|
|
120
|
-
const createAiService = (ai: TestServiceOptions['ai']): Context.Tag.Service<AiService> | undefined => {
|
|
121
|
-
if (ai?.client != null) {
|
|
122
|
-
return AiService.make(ai.client);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (ai?.endpoint != null) {
|
|
126
|
-
return AiService.make(new EdgeAiServiceClient({ endpoint: ai.endpoint }));
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
switch (ai?.provider) {
|
|
130
|
-
case 'dev':
|
|
131
|
-
return AiService.make(
|
|
132
|
-
new EdgeAiServiceClient({
|
|
133
|
-
endpoint: AI_SERVICE_ENDPOINT.LOCAL,
|
|
134
|
-
defaultGenerationOptions: {
|
|
135
|
-
model: '@anthropic/claude-3-5-sonnet-20241022',
|
|
136
|
-
},
|
|
137
|
-
}),
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
case 'edge':
|
|
141
|
-
return AiService.make(
|
|
142
|
-
new EdgeAiServiceClient({
|
|
143
|
-
endpoint: AI_SERVICE_ENDPOINT.REMOTE,
|
|
144
|
-
defaultGenerationOptions: {
|
|
145
|
-
model: '@anthropic/claude-3-5-sonnet-20241022',
|
|
146
|
-
},
|
|
147
|
-
}),
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
case 'ollama':
|
|
151
|
-
return AiService.make(createTestAiServiceClient());
|
|
152
|
-
|
|
153
|
-
case 'lmstudio':
|
|
154
|
-
throw new Error('LMStudio is not supported');
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
|
|
158
104
|
const createCredentialsService = (
|
|
159
105
|
credentials: TestServiceOptions['credentials'] | undefined,
|
|
160
106
|
): Context.Tag.Service<CredentialsService> | undefined => {
|