@dxos/functions 0.9.0 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/functions",
3
- "version": "0.9.0",
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.1",
32
- "effect": "3.21.3",
33
- "@dxos/ai": "0.9.0",
34
- "@dxos/compute": "0.9.0",
35
- "@dxos/echo": "0.9.0",
36
- "@dxos/context": "0.9.0",
37
- "@dxos/echo-client": "0.9.0",
38
- "@dxos/invariant": "0.9.0",
39
- "@dxos/errors": "0.9.0",
40
- "@dxos/effect": "0.9.0",
41
- "@dxos/keys": "0.9.0",
42
- "@dxos/log": "0.9.0",
43
- "@dxos/protocols": "0.9.0",
44
- "@dxos/schema": "0.9.0",
45
- "@dxos/node-std": "0.9.0",
46
- "@dxos/types": "0.9.0"
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"
@@ -19,14 +19,8 @@ import {
19
19
  Trace,
20
20
  } from '@dxos/compute';
21
21
  import { LifecycleState, Resource } from '@dxos/context';
22
- import { Database, Feed, JsonSchema, Ref, Registry, type Type } from '@dxos/echo';
23
- import {
24
- createFeedServiceLayer,
25
- EchoClient,
26
- type DatabaseImpl,
27
- makeRegistry,
28
- type QueueFactory,
29
- } from '@dxos/echo-client';
22
+ import { Database, JsonSchema, Ref, Registry, type Type } from '@dxos/echo';
23
+ import { type DatabaseImpl, EchoClient, makeRegistry } from '@dxos/echo-client';
30
24
  import { refFromEncodedReference } from '@dxos/echo/internal';
31
25
  import { EffectEx } from '@dxos/effect';
32
26
  import { assertState, failedInvariant, invariant } from '@dxos/invariant';
@@ -35,7 +29,7 @@ import { log } from '@dxos/log';
35
29
  import { EdgeFunctionEnv, ErrorCodec, type FunctionProtocol, type TraceProtocol } from '@dxos/protocols';
36
30
 
37
31
  import { type FunctionServices } from '../sdk';
38
- import { configuredCredentialsLayer, credentialsLayerFromDatabase, FunctionInvocationService } from '../services';
32
+ import { FunctionInvocationService, configuredCredentialsLayer, credentialsLayerFromDatabase } from '../services';
39
33
  import { FunctionsAiHttpClient } from './functions-ai-http-client';
40
34
 
41
35
  export interface FunctionWrappingOptions {
@@ -74,7 +68,7 @@ export const wrapFunctionHandler = (
74
68
  },
75
69
  handler: async ({ data, context }) => {
76
70
  if (
77
- (serviceTags.includes(Database.Service.key) || serviceTags.includes(Feed.FeedService.key)) &&
71
+ serviceTags.includes(Database.Service.key) &&
78
72
  (!context.services.dataService || !context.services.queryService)
79
73
  ) {
80
74
  throw new FunctionError({
@@ -158,7 +152,6 @@ class FunctionContext extends Resource {
158
152
  readonly context: FunctionProtocol.Context;
159
153
  readonly client: EchoClient | undefined;
160
154
  db: DatabaseImpl | undefined;
161
- queues: QueueFactory | undefined;
162
155
  readonly opts: FunctionWrappingOptions;
163
156
 
164
157
  constructor(context: FunctionProtocol.Context, opts: FunctionWrappingOptions) {
@@ -188,8 +181,6 @@ class FunctionContext extends Resource {
188
181
 
189
182
  await this.db?.setSpaceRoot(this.context.spaceRootUrl ?? failedInvariant('spaceRootUrl missing in context'));
190
183
  await this.db?.open();
191
- this.queues =
192
- this.client && this.context.spaceId ? this.client.constructQueueFactory(this.context.spaceId) : undefined;
193
184
  }
194
185
 
195
186
  override async _close() {
@@ -201,7 +192,6 @@ class FunctionContext extends Resource {
201
192
  assertState(this._lifecycleState === LifecycleState.OPEN, 'FunctionContext is not open');
202
193
 
203
194
  const dbLayer = this.db ? Database.layer(this.db) : Database.notAvailable;
204
- const feedLayer = this.queues ? createFeedServiceLayer(this.queues) : Feed.notAvailable;
205
195
  const credentials = dbLayer
206
196
  ? credentialsLayerFromDatabase({ caching: true }).pipe(Layer.provide(dbLayer))
207
197
  : configuredCredentialsLayer([]);
@@ -234,7 +224,6 @@ class FunctionContext extends Resource {
234
224
 
235
225
  return Layer.mergeAll(
236
226
  dbLayer,
237
- feedLayer,
238
227
  credentials,
239
228
  operationServiceLayer,
240
229
  aiLayer,
@@ -300,7 +289,7 @@ const makeOperationServiceLayer = (
300
289
  const result = await functionsService.invoke(op.meta.deployedId, input, {
301
290
  spaceId: options?.spaceId,
302
291
  // Forward the conversation DXN so the remote runtime can rebuild conversation-scoped
303
- // services (e.g. `AiContext.Service`) needed by operations like `GetContext`.
292
+ // services (e.g. `HarnessService`) needed by operations like `GetContext`.
304
293
  conversation: options?.conversation,
305
294
  });
306
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, type Feed } from '@dxos/echo';
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.
@@ -89,6 +89,7 @@ export const credentialsLayerFromDatabase = ({ caching = false }: { caching?: bo
89
89
  .map((accessToken) => ({
90
90
  service: accessToken.source,
91
91
  apiKey: accessToken.token,
92
+ account: accessToken.account,
92
93
  }));
93
94
 
94
95
  if (caching) {