@dxos/compute 0.8.4-main.5ad4a44 → 0.8.4-main.66e292d
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-C7KLV2IU.mjs → chunk-ILJV45WQ.mjs} +114 -145
- package/dist/lib/browser/chunk-ILJV45WQ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +10 -19
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{chunk-K37OSZ5O.mjs → chunk-QDJ6J7GT.mjs} +114 -145
- package/dist/lib/node-esm/chunk-QDJ6J7GT.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +10 -19
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/compute-graph.d.ts.map +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-runtime.d.ts +1 -1
- package/dist/types/src/testing/test-runtime.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -20
- package/src/compute-graph-registry.test.ts +26 -10
- package/src/compute-graph.test.ts +29 -10
- package/src/compute-graph.ts +20 -12
- package/src/functions/edge-function.ts +5 -5
- package/src/index.ts +0 -27
- package/src/testing/test-runtime.ts +4 -9
- package/dist/lib/browser/chunk-C7KLV2IU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-K37OSZ5O.mjs.map +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/compute",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.66e292d",
|
|
4
4
|
"description": "Low-level compute API",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -38,29 +38,30 @@
|
|
|
38
38
|
"@preact/signals-core": "^1.12.1",
|
|
39
39
|
"effect": "3.18.3",
|
|
40
40
|
"lodash.defaultsdeep": "^4.6.1",
|
|
41
|
-
"@dxos/ai": "0.8.4-main.
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/functions": "0.8.4-main.
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/plugin-automation": "0.8.4-main.
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
41
|
+
"@dxos/ai": "0.8.4-main.66e292d",
|
|
42
|
+
"@dxos/async": "0.8.4-main.66e292d",
|
|
43
|
+
"@dxos/context": "0.8.4-main.66e292d",
|
|
44
|
+
"@dxos/debug": "0.8.4-main.66e292d",
|
|
45
|
+
"@dxos/functions": "0.8.4-main.66e292d",
|
|
46
|
+
"@dxos/echo": "0.8.4-main.66e292d",
|
|
47
|
+
"@dxos/client": "0.8.4-main.66e292d",
|
|
48
|
+
"@dxos/functions-runtime": "0.8.4-main.66e292d",
|
|
49
|
+
"@dxos/invariant": "0.8.4-main.66e292d",
|
|
50
|
+
"@dxos/keys": "0.8.4-main.66e292d",
|
|
51
|
+
"@dxos/live-object": "0.8.4-main.66e292d",
|
|
52
|
+
"@dxos/log": "0.8.4-main.66e292d",
|
|
53
|
+
"@dxos/plugin-automation": "0.8.4-main.66e292d",
|
|
54
|
+
"@dxos/protocols": "0.8.4-main.66e292d",
|
|
55
|
+
"@dxos/schema": "0.8.4-main.66e292d",
|
|
56
|
+
"@dxos/vendor-hyperformula": "0.8.4-main.66e292d",
|
|
57
|
+
"@dxos/util": "0.8.4-main.66e292d"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
60
|
"@tldraw/indices": "^2.0.0-alpha.14",
|
|
60
61
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
61
|
-
"@dxos/echo": "0.8.4-main.
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
62
|
+
"@dxos/echo": "0.8.4-main.66e292d",
|
|
63
|
+
"@dxos/echo-db": "0.8.4-main.66e292d",
|
|
64
|
+
"@dxos/random": "0.8.4-main.66e292d"
|
|
64
65
|
},
|
|
65
66
|
"peerDependencies": {
|
|
66
67
|
"effect": "^3.13.3"
|
|
@@ -6,8 +6,8 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import { describe, expect, onTestFinished, test } from 'vitest';
|
|
7
7
|
|
|
8
8
|
import { Trigger } from '@dxos/async';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import { Function, FunctionDefinition } from '@dxos/functions';
|
|
11
11
|
|
|
12
12
|
import { ComputeGraphRegistry, defaultPlugins } from './compute-graph-registry';
|
|
13
13
|
import { TestBuilder, createMockedComputeRuntimeProvider } from './testing';
|
|
@@ -23,8 +23,13 @@ describe('ComputeGraphRegistry', () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
test('invokes user function through compute graph', async () => {
|
|
26
|
-
const computeRuntime = createMockedComputeRuntimeProvider({
|
|
27
|
-
|
|
26
|
+
const computeRuntime = createMockedComputeRuntimeProvider({
|
|
27
|
+
functions: [add],
|
|
28
|
+
});
|
|
29
|
+
const testBuilder = new TestBuilder({
|
|
30
|
+
types: [Function.Function],
|
|
31
|
+
computeRuntime,
|
|
32
|
+
});
|
|
28
33
|
await testBuilder.open();
|
|
29
34
|
onTestFinished(async () => {
|
|
30
35
|
await testBuilder.close();
|
|
@@ -33,7 +38,10 @@ describe('ComputeGraphRegistry', () => {
|
|
|
33
38
|
const space = await testBuilder.client.spaces.create();
|
|
34
39
|
|
|
35
40
|
// Register Edge function plugin and runtime in the registry.
|
|
36
|
-
const registry = new ComputeGraphRegistry({
|
|
41
|
+
const registry = new ComputeGraphRegistry({
|
|
42
|
+
plugins: defaultPlugins,
|
|
43
|
+
computeRuntime,
|
|
44
|
+
});
|
|
37
45
|
await registry.open();
|
|
38
46
|
onTestFinished(async () => {
|
|
39
47
|
await registry.close();
|
|
@@ -69,12 +77,17 @@ describe('ComputeGraphRegistry', () => {
|
|
|
69
77
|
|
|
70
78
|
// Sanity check: mapping to fully qualified id works as well.
|
|
71
79
|
const bindingId = graph.mapFunctionBindingToId('ADD(2, 3)');
|
|
72
|
-
expect(bindingId.startsWith(`${
|
|
80
|
+
expect(bindingId.startsWith(`${Obj.getDXN(functionObj).toString()}`)).to.be.true;
|
|
73
81
|
});
|
|
74
82
|
|
|
75
83
|
test('adding a function binding updates autocomplete and enables execution', async () => {
|
|
76
|
-
const computeRuntime = createMockedComputeRuntimeProvider({
|
|
77
|
-
|
|
84
|
+
const computeRuntime = createMockedComputeRuntimeProvider({
|
|
85
|
+
functions: [add],
|
|
86
|
+
});
|
|
87
|
+
const testBuilder = new TestBuilder({
|
|
88
|
+
types: [Function.Function],
|
|
89
|
+
computeRuntime,
|
|
90
|
+
});
|
|
78
91
|
await testBuilder.open();
|
|
79
92
|
onTestFinished(async () => {
|
|
80
93
|
await testBuilder.close();
|
|
@@ -82,7 +95,10 @@ describe('ComputeGraphRegistry', () => {
|
|
|
82
95
|
|
|
83
96
|
const space = await testBuilder.client.spaces.create();
|
|
84
97
|
|
|
85
|
-
const registry = new ComputeGraphRegistry({
|
|
98
|
+
const registry = new ComputeGraphRegistry({
|
|
99
|
+
plugins: defaultPlugins,
|
|
100
|
+
computeRuntime,
|
|
101
|
+
});
|
|
86
102
|
await registry.open();
|
|
87
103
|
onTestFinished(async () => {
|
|
88
104
|
await registry.close();
|
|
@@ -114,7 +130,7 @@ describe('ComputeGraphRegistry', () => {
|
|
|
114
130
|
await functionsUpdated.wait();
|
|
115
131
|
|
|
116
132
|
// Autocomplete should now include the binding.
|
|
117
|
-
const echoFunctions = graph.getFunctions({ standard: false, echo: true }).map((
|
|
133
|
+
const echoFunctions = graph.getFunctions({ standard: false, echo: true }).map((fn) => fn.name);
|
|
118
134
|
expect(echoFunctions).toContain('ADD');
|
|
119
135
|
|
|
120
136
|
// And the binding should execute when used in a formula.
|
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
import { afterEach, beforeEach, describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { Trigger } from '@dxos/async';
|
|
8
|
-
import { fullyQualifiedId } from '@dxos/client/echo';
|
|
9
8
|
import { Obj } from '@dxos/echo';
|
|
10
|
-
import {
|
|
9
|
+
import { Function } from '@dxos/functions';
|
|
11
10
|
import { type CellValue } from '@dxos/vendor-hyperformula';
|
|
12
11
|
import { DetailedCellError } from '@dxos/vendor-hyperformula';
|
|
13
12
|
|
|
@@ -16,7 +15,7 @@ import { TestBuilder } from './testing';
|
|
|
16
15
|
describe('ComputeGraph', () => {
|
|
17
16
|
let testBuilder: TestBuilder;
|
|
18
17
|
beforeEach(async () => {
|
|
19
|
-
testBuilder = new TestBuilder({ types: [
|
|
18
|
+
testBuilder = new TestBuilder({ types: [Function.Function] });
|
|
20
19
|
await testBuilder.open();
|
|
21
20
|
});
|
|
22
21
|
afterEach(async () => {
|
|
@@ -31,13 +30,13 @@ describe('ComputeGraph', () => {
|
|
|
31
30
|
// Create script.
|
|
32
31
|
const trigger = new Trigger();
|
|
33
32
|
graph.update.once(() => trigger.wake());
|
|
34
|
-
const functionObject = space.db.add(
|
|
33
|
+
const functionObject = space.db.add(Function.make({ name: 'test', version: '0.0.1', binding: 'TEST' }));
|
|
35
34
|
await trigger.wait();
|
|
36
35
|
const functions = graph.getFunctions({ echo: true });
|
|
37
36
|
expect(functions).to.toHaveLength(1);
|
|
38
37
|
|
|
39
38
|
const id = graph.mapFunctionBindingToId('TEST()');
|
|
40
|
-
expect(id).to.eq(`${
|
|
39
|
+
expect(id).to.eq(`${Obj.getDXN(functionObject).toString()}()`);
|
|
41
40
|
});
|
|
42
41
|
|
|
43
42
|
test('cross-node references', async () => {
|
|
@@ -52,22 +51,38 @@ describe('ComputeGraph', () => {
|
|
|
52
51
|
{
|
|
53
52
|
node1.graph.hf.setCellContents({ sheet: node1.sheetId, row: 0, col: 0 }, [[100, 200, 300, '=SUM(A1:C1)']]);
|
|
54
53
|
node2.graph.hf.setCellContents({ sheet: node2.sheetId, row: 0, col: 0 }, "='node-1'!D1");
|
|
55
|
-
const value1 = node1.graph.hf.getCellValue({
|
|
56
|
-
|
|
54
|
+
const value1 = node1.graph.hf.getCellValue({
|
|
55
|
+
sheet: node1.sheetId,
|
|
56
|
+
col: 3,
|
|
57
|
+
row: 0,
|
|
58
|
+
});
|
|
59
|
+
const value2 = node2.graph.hf.getCellValue({
|
|
60
|
+
sheet: node2.sheetId,
|
|
61
|
+
col: 0,
|
|
62
|
+
row: 0,
|
|
63
|
+
});
|
|
57
64
|
expect(value1).to.eq(value2);
|
|
58
65
|
}
|
|
59
66
|
|
|
60
67
|
// Get updated event.
|
|
61
68
|
const trigger = new Trigger<CellValue>();
|
|
62
69
|
node2.update.on(({ change }) => {
|
|
63
|
-
const value = node2.graph.hf.getCellValue({
|
|
70
|
+
const value = node2.graph.hf.getCellValue({
|
|
71
|
+
sheet: node2.sheetId,
|
|
72
|
+
col: 0,
|
|
73
|
+
row: 0,
|
|
74
|
+
});
|
|
64
75
|
expect(value).to.eq(change?.newValue);
|
|
65
76
|
trigger.wake(value);
|
|
66
77
|
});
|
|
67
78
|
|
|
68
79
|
{
|
|
69
80
|
node1.graph.hf.setCellContents({ sheet: node1.sheetId, row: 0, col: 0 }, 400);
|
|
70
|
-
const value1 = node1.graph.hf.getCellValue({
|
|
81
|
+
const value1 = node1.graph.hf.getCellValue({
|
|
82
|
+
sheet: node1.sheetId,
|
|
83
|
+
col: 3,
|
|
84
|
+
row: 0,
|
|
85
|
+
});
|
|
71
86
|
const value2 = await trigger.wait();
|
|
72
87
|
expect(value1).to.eq(value2);
|
|
73
88
|
}
|
|
@@ -81,7 +96,11 @@ describe('ComputeGraph', () => {
|
|
|
81
96
|
|
|
82
97
|
const node1 = await graph.getOrCreateNode('node-1').open();
|
|
83
98
|
node1.graph.hf.setCellContents({ sheet: node1.sheetId, row: 0, col: 0 }, "='node-2'!A1");
|
|
84
|
-
const value1 = node1.graph.hf.getCellValue({
|
|
99
|
+
const value1 = node1.graph.hf.getCellValue({
|
|
100
|
+
sheet: node1.sheetId,
|
|
101
|
+
col: 0,
|
|
102
|
+
row: 0,
|
|
103
|
+
});
|
|
85
104
|
expect(value1).to.be.instanceof(DetailedCellError);
|
|
86
105
|
expect((value1 as DetailedCellError).type).to.eq('REF');
|
|
87
106
|
});
|
package/src/compute-graph.ts
CHANGED
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { effect } from '@preact/signals-core';
|
|
5
6
|
import type * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
6
7
|
|
|
7
8
|
import { Event } from '@dxos/async';
|
|
8
|
-
import { Filter, type Space
|
|
9
|
+
import { Filter, type Space } from '@dxos/client/echo';
|
|
9
10
|
import { FQ_ID_LENGTH } from '@dxos/client/echo';
|
|
10
11
|
import { Resource } from '@dxos/context';
|
|
11
|
-
import {
|
|
12
|
-
import { type FunctionInvocationService
|
|
12
|
+
import { Obj } from '@dxos/echo';
|
|
13
|
+
import { Function, type FunctionInvocationService } from '@dxos/functions';
|
|
13
14
|
import { invariant } from '@dxos/invariant';
|
|
14
15
|
import { PublicKey } from '@dxos/keys';
|
|
15
16
|
import { log } from '@dxos/log';
|
|
@@ -60,7 +61,7 @@ export class ComputeGraph extends Resource {
|
|
|
60
61
|
private readonly _nodes = new Map<number, ComputeNode>();
|
|
61
62
|
|
|
62
63
|
// Cached function objects.
|
|
63
|
-
private _remoteFunctions:
|
|
64
|
+
private _remoteFunctions: Function.Function[] = [];
|
|
64
65
|
|
|
65
66
|
public readonly update = new Event<{ type: ComputeGraphEvent }>();
|
|
66
67
|
|
|
@@ -106,7 +107,10 @@ export class ComputeGraph extends Resource {
|
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
getFunctions(
|
|
109
|
-
{ standard, echo }: { standard?: boolean; echo?: boolean } = {
|
|
110
|
+
{ standard, echo }: { standard?: boolean; echo?: boolean } = {
|
|
111
|
+
standard: true,
|
|
112
|
+
echo: true,
|
|
113
|
+
},
|
|
110
114
|
): FunctionDefinition[] {
|
|
111
115
|
return [
|
|
112
116
|
...(standard
|
|
@@ -166,7 +170,7 @@ export class ComputeGraph extends Resource {
|
|
|
166
170
|
|
|
167
171
|
for (const obj of objects) {
|
|
168
172
|
if (obj.name === name) {
|
|
169
|
-
const type = getTypename(obj)!;
|
|
173
|
+
const type = Obj.getTypename(obj)!;
|
|
170
174
|
// NOTE: Names must be single quoted.
|
|
171
175
|
return `'${createSheetName({ type, id: obj.id })}'!`;
|
|
172
176
|
}
|
|
@@ -206,7 +210,7 @@ export class ComputeGraph extends Resource {
|
|
|
206
210
|
|
|
207
211
|
const fn = this._remoteFunctions.find((fn) => fn.binding === binding);
|
|
208
212
|
if (fn) {
|
|
209
|
-
const id =
|
|
213
|
+
const id = Obj.getDXN(fn).toString();
|
|
210
214
|
return `${id}(${args})`;
|
|
211
215
|
} else {
|
|
212
216
|
return match;
|
|
@@ -225,7 +229,7 @@ export class ComputeGraph extends Resource {
|
|
|
225
229
|
return match;
|
|
226
230
|
}
|
|
227
231
|
|
|
228
|
-
const fn = this._remoteFunctions.find((fn) =>
|
|
232
|
+
const fn = this._remoteFunctions.find((fn) => Obj.getDXN(fn).toString() === id);
|
|
229
233
|
if (fn?.binding) {
|
|
230
234
|
return `${fn.binding}(${args})`;
|
|
231
235
|
} else {
|
|
@@ -243,13 +247,17 @@ export class ComputeGraph extends Resource {
|
|
|
243
247
|
protected override async _open(): Promise<void> {
|
|
244
248
|
if (this._space) {
|
|
245
249
|
// Subscribe to remote function definitions.
|
|
246
|
-
const query = this._space.db.query(Filter.type(
|
|
247
|
-
const unsubscribe = query.subscribe(
|
|
248
|
-
|
|
250
|
+
const query = this._space.db.query(Filter.type(Function.Function));
|
|
251
|
+
const unsubscribe = query.subscribe();
|
|
252
|
+
const dispose = effect(() => {
|
|
253
|
+
this._remoteFunctions = query.objects.filter(({ binding }) => binding);
|
|
249
254
|
this.update.emit({ type: 'functionsUpdated' });
|
|
250
255
|
});
|
|
251
256
|
|
|
252
|
-
this._ctx.onDispose(
|
|
257
|
+
this._ctx.onDispose(() => {
|
|
258
|
+
unsubscribe();
|
|
259
|
+
dispose();
|
|
260
|
+
});
|
|
253
261
|
}
|
|
254
262
|
}
|
|
255
263
|
|
|
@@ -7,8 +7,8 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import * as SchemaAST from 'effect/SchemaAST';
|
|
8
8
|
|
|
9
9
|
import { Filter } from '@dxos/client/echo';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { JsonSchema } from '@dxos/echo';
|
|
11
|
+
import { Function, FunctionInvocationService, TracingService } from '@dxos/functions';
|
|
12
12
|
import { FunctionDefinition } from '@dxos/functions';
|
|
13
13
|
import { log } from '@dxos/log';
|
|
14
14
|
import { isNonNullable } from '@dxos/util';
|
|
@@ -38,7 +38,7 @@ export class EdgeFunctionPlugin extends AsyncFunctionPlugin {
|
|
|
38
38
|
|
|
39
39
|
const {
|
|
40
40
|
objects: [fn],
|
|
41
|
-
} = await space.db.query(Filter.type(
|
|
41
|
+
} = await space.db.query(Filter.type(Function.Function, { binding })).run();
|
|
42
42
|
if (!fn) {
|
|
43
43
|
log.info('Function not found', { binding });
|
|
44
44
|
return new CellError(ErrorType.REF, 'Function not found');
|
|
@@ -62,7 +62,7 @@ export class EdgeFunctionPlugin extends AsyncFunctionPlugin {
|
|
|
62
62
|
// If input schema exists, construct an object from args using the schema props order, otherwise pass { args }.
|
|
63
63
|
let input: any;
|
|
64
64
|
if (fn.inputSchema) {
|
|
65
|
-
const schema = toEffectSchema(fn.inputSchema);
|
|
65
|
+
const schema = JsonSchema.toEffectSchema(fn.inputSchema);
|
|
66
66
|
const props = SchemaAST.getPropertySignatures(schema.ast);
|
|
67
67
|
input = {} as any;
|
|
68
68
|
props.forEach(({ name }, index) => {
|
|
@@ -74,7 +74,7 @@ export class EdgeFunctionPlugin extends AsyncFunctionPlugin {
|
|
|
74
74
|
const result = runtime.runPromise(
|
|
75
75
|
Effect.gen(function* () {
|
|
76
76
|
return yield* FunctionInvocationService.invokeFunction(functionDef, input);
|
|
77
|
-
}).pipe(Effect.provide(
|
|
77
|
+
}).pipe(Effect.provide(TracingService.layerNoop)),
|
|
78
78
|
);
|
|
79
79
|
return result as any;
|
|
80
80
|
};
|
package/src/index.ts
CHANGED
|
@@ -2,33 +2,6 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
// TODO(burdon): Separate hyperformula (client compute) from remote/edge functions.
|
|
6
|
-
|
|
7
|
-
// TODO(burdon): Reconcile: types.
|
|
8
|
-
// - dxos/graph
|
|
9
|
-
// - dxos/compute
|
|
10
|
-
// - dxos/functions
|
|
11
|
-
// - dxos/assistant
|
|
12
|
-
// - dxos/plugin-automation
|
|
13
|
-
// - dxos/plugin-script
|
|
14
|
-
// - dxos/plugin-sheet
|
|
15
|
-
|
|
16
|
-
// TODO(burdon): Tech debt.
|
|
17
|
-
// - move hyperformula defs from sheet to compute.
|
|
18
|
-
// - standard from ./types exports for plugins.
|
|
19
|
-
// - dxos/agent
|
|
20
|
-
// - dxos/agent-functions
|
|
21
|
-
// - dxos/mosaic, dxos-card
|
|
22
|
-
|
|
23
|
-
// TODO(burdon): Reconcile UX.
|
|
24
|
-
// - dxos/plugin-explorer
|
|
25
|
-
// - dxos/plugin-canvas
|
|
26
|
-
// - dxos/gem-*
|
|
27
|
-
|
|
28
|
-
// TODO(burdon): Next
|
|
29
|
-
// - dxos/plugin-search
|
|
30
|
-
// - dxos/plugin-threads
|
|
31
|
-
|
|
32
5
|
export * from './compute-graph';
|
|
33
6
|
export * from './compute-graph-registry';
|
|
34
7
|
export * from './compute-node';
|
|
@@ -7,13 +7,8 @@ import * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
|
7
7
|
|
|
8
8
|
import { AiService } from '@dxos/ai';
|
|
9
9
|
import { type SpaceId } from '@dxos/client/echo';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
DatabaseService,
|
|
13
|
-
type FunctionDefinition,
|
|
14
|
-
FunctionInvocationService,
|
|
15
|
-
QueueService,
|
|
16
|
-
} from '@dxos/functions';
|
|
10
|
+
import { CredentialsService, DatabaseService, type FunctionDefinition, QueueService } from '@dxos/functions';
|
|
11
|
+
import { FunctionInvocationServiceLayerTest } from '@dxos/functions-runtime/testing';
|
|
17
12
|
|
|
18
13
|
import { type FunctionsRuntimeProvider } from '../compute-graph-registry';
|
|
19
14
|
|
|
@@ -23,11 +18,11 @@ import { type FunctionsRuntimeProvider } from '../compute-graph-registry';
|
|
|
23
18
|
*/
|
|
24
19
|
export const createMockedComputeRuntimeProvider = ({
|
|
25
20
|
functions,
|
|
26
|
-
}: { functions?: FunctionDefinition
|
|
21
|
+
}: { functions?: FunctionDefinition.Any[] } = {}): FunctionsRuntimeProvider => {
|
|
27
22
|
return {
|
|
28
23
|
getRuntime: (_spaceId: SpaceId) =>
|
|
29
24
|
ManagedRuntime.make(
|
|
30
|
-
|
|
25
|
+
FunctionInvocationServiceLayerTest({ functions }).pipe(
|
|
31
26
|
Layer.provide(AiService.notAvailable),
|
|
32
27
|
Layer.provide(CredentialsService.configuredLayer([])),
|
|
33
28
|
Layer.provide(DatabaseService.notAvailable),
|