@dxos/functions 0.9.1-main.c7dcc2e112 → 0.9.1-staging.ee54ba693a
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/neutral/index.mjs +10 -11
- package/dist/lib/neutral/index.mjs.map +3 -3
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/types/src/protocol/protocol.d.ts.map +1 -1
- package/dist/types/src/sdk.d.ts +2 -2
- package/dist/types/src/sdk.d.ts.map +1 -1
- package/dist/types/src/services/credentials.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -17
- package/src/protocol/protocol.ts +5 -7
- package/src/sdk.ts +1 -2
- package/src/services/credentials.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/functions",
|
|
3
|
-
"version": "0.9.1-
|
|
3
|
+
"version": "0.9.1-staging.ee54ba693a",
|
|
4
4
|
"description": "Functions API.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -28,22 +28,22 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@effect-atom/atom": "^0.5.3",
|
|
30
30
|
"@effect/ai-anthropic": "0.26.0",
|
|
31
|
-
"@effect/platform": "0.96.
|
|
32
|
-
"effect": "3.21.
|
|
33
|
-
"@dxos/ai": "0.9.1-
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/echo
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/keys": "0.9.1-
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/log": "0.9.1-
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
31
|
+
"@effect/platform": "0.96.2",
|
|
32
|
+
"effect": "3.21.4",
|
|
33
|
+
"@dxos/ai": "0.9.1-staging.ee54ba693a",
|
|
34
|
+
"@dxos/context": "0.9.1-staging.ee54ba693a",
|
|
35
|
+
"@dxos/compute": "0.9.1-staging.ee54ba693a",
|
|
36
|
+
"@dxos/echo": "0.9.1-staging.ee54ba693a",
|
|
37
|
+
"@dxos/echo-client": "0.9.1-staging.ee54ba693a",
|
|
38
|
+
"@dxos/effect": "0.9.1-staging.ee54ba693a",
|
|
39
|
+
"@dxos/errors": "0.9.1-staging.ee54ba693a",
|
|
40
|
+
"@dxos/keys": "0.9.1-staging.ee54ba693a",
|
|
41
|
+
"@dxos/node-std": "0.9.1-staging.ee54ba693a",
|
|
42
|
+
"@dxos/log": "0.9.1-staging.ee54ba693a",
|
|
43
|
+
"@dxos/protocols": "0.9.1-staging.ee54ba693a",
|
|
44
|
+
"@dxos/schema": "0.9.1-staging.ee54ba693a",
|
|
45
|
+
"@dxos/types": "0.9.1-staging.ee54ba693a",
|
|
46
|
+
"@dxos/invariant": "0.9.1-staging.ee54ba693a"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
package/src/protocol/protocol.ts
CHANGED
|
@@ -19,8 +19,8 @@ import {
|
|
|
19
19
|
Trace,
|
|
20
20
|
} from '@dxos/compute';
|
|
21
21
|
import { LifecycleState, Resource } from '@dxos/context';
|
|
22
|
-
import { Database,
|
|
23
|
-
import {
|
|
22
|
+
import { Database, JsonSchema, Ref, Registry, type Type } from '@dxos/echo';
|
|
23
|
+
import { type DatabaseImpl, EchoClient, makeRegistry } from '@dxos/echo-client';
|
|
24
24
|
import { refFromEncodedReference } from '@dxos/echo/internal';
|
|
25
25
|
import { EffectEx } from '@dxos/effect';
|
|
26
26
|
import { assertState, failedInvariant, invariant } from '@dxos/invariant';
|
|
@@ -29,7 +29,7 @@ import { log } from '@dxos/log';
|
|
|
29
29
|
import { EdgeFunctionEnv, ErrorCodec, type FunctionProtocol, type TraceProtocol } from '@dxos/protocols';
|
|
30
30
|
|
|
31
31
|
import { type FunctionServices } from '../sdk';
|
|
32
|
-
import { configuredCredentialsLayer, credentialsLayerFromDatabase
|
|
32
|
+
import { FunctionInvocationService, configuredCredentialsLayer, credentialsLayerFromDatabase } from '../services';
|
|
33
33
|
import { FunctionsAiHttpClient } from './functions-ai-http-client';
|
|
34
34
|
|
|
35
35
|
export interface FunctionWrappingOptions {
|
|
@@ -68,7 +68,7 @@ export const wrapFunctionHandler = (
|
|
|
68
68
|
},
|
|
69
69
|
handler: async ({ data, context }) => {
|
|
70
70
|
if (
|
|
71
|
-
|
|
71
|
+
serviceTags.includes(Database.Service.key) &&
|
|
72
72
|
(!context.services.dataService || !context.services.queryService)
|
|
73
73
|
) {
|
|
74
74
|
throw new FunctionError({
|
|
@@ -192,7 +192,6 @@ class FunctionContext extends Resource {
|
|
|
192
192
|
assertState(this._lifecycleState === LifecycleState.OPEN, 'FunctionContext is not open');
|
|
193
193
|
|
|
194
194
|
const dbLayer = this.db ? Database.layer(this.db) : Database.notAvailable;
|
|
195
|
-
const feedLayer = this.db ? createFeedServiceLayer(this.db) : Feed.notAvailable;
|
|
196
195
|
const credentials = dbLayer
|
|
197
196
|
? credentialsLayerFromDatabase({ caching: true }).pipe(Layer.provide(dbLayer))
|
|
198
197
|
: configuredCredentialsLayer([]);
|
|
@@ -225,7 +224,6 @@ class FunctionContext extends Resource {
|
|
|
225
224
|
|
|
226
225
|
return Layer.mergeAll(
|
|
227
226
|
dbLayer,
|
|
228
|
-
feedLayer,
|
|
229
227
|
credentials,
|
|
230
228
|
operationServiceLayer,
|
|
231
229
|
aiLayer,
|
|
@@ -291,7 +289,7 @@ const makeOperationServiceLayer = (
|
|
|
291
289
|
const result = await functionsService.invoke(op.meta.deployedId, input, {
|
|
292
290
|
spaceId: options?.spaceId,
|
|
293
291
|
// Forward the conversation DXN so the remote runtime can rebuild conversation-scoped
|
|
294
|
-
// services (e.g. `
|
|
292
|
+
// services (e.g. `HarnessService`) needed by operations like `GetContext`.
|
|
295
293
|
conversation: options?.conversation,
|
|
296
294
|
});
|
|
297
295
|
if (result._kind === 'success') {
|
package/src/sdk.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { type AiService } from '@dxos/ai';
|
|
6
6
|
import { type Credential, type Operation, type Trace } from '@dxos/compute';
|
|
7
|
-
import { type Database
|
|
7
|
+
import { type Database } from '@dxos/echo';
|
|
8
8
|
|
|
9
9
|
import { type FunctionInvocationService } from './services';
|
|
10
10
|
|
|
@@ -21,7 +21,6 @@ export type FunctionServices =
|
|
|
21
21
|
| AiService.AiService
|
|
22
22
|
| Credential.CredentialsService
|
|
23
23
|
| Database.Service
|
|
24
|
-
| Feed.FeedService
|
|
25
24
|
| Trace.TraceService
|
|
26
25
|
// TODO(dmaretskyi): `FunctionInvocationService` is being phased out in favour of `Operation.Service`;
|
|
27
26
|
// it's kept in the union until `functions-runtime/local-function-execution.ts` migrates.
|