@dxos/functions 0.8.4-main.67995b8 → 0.8.4-main.a4bbb77

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.
Files changed (139) hide show
  1. package/dist/lib/browser/bundler/index.mjs +56 -38
  2. package/dist/lib/browser/bundler/index.mjs.map +3 -3
  3. package/dist/lib/browser/chunk-C2Z7LCJ2.mjs +649 -0
  4. package/dist/lib/browser/chunk-C2Z7LCJ2.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  6. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
  7. package/dist/lib/browser/edge/index.mjs +22 -8
  8. package/dist/lib/browser/edge/index.mjs.map +3 -3
  9. package/dist/lib/browser/index.mjs +992 -127
  10. package/dist/lib/browser/index.mjs.map +4 -4
  11. package/dist/lib/browser/meta.json +1 -1
  12. package/dist/lib/browser/testing/index.mjs +76 -6
  13. package/dist/lib/browser/testing/index.mjs.map +3 -3
  14. package/dist/lib/node-esm/bundler/index.mjs +55 -38
  15. package/dist/lib/node-esm/bundler/index.mjs.map +3 -3
  16. package/dist/lib/node-esm/chunk-AH3AZM2U.mjs +651 -0
  17. package/dist/lib/node-esm/chunk-AH3AZM2U.mjs.map +7 -0
  18. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  19. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  20. package/dist/lib/node-esm/edge/index.mjs +21 -8
  21. package/dist/lib/node-esm/edge/index.mjs.map +3 -3
  22. package/dist/lib/node-esm/index.mjs +992 -127
  23. package/dist/lib/node-esm/index.mjs.map +4 -4
  24. package/dist/lib/node-esm/meta.json +1 -1
  25. package/dist/lib/node-esm/testing/index.mjs +76 -6
  26. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  27. package/dist/types/src/bundler/bundler.d.ts +11 -12
  28. package/dist/types/src/bundler/bundler.d.ts.map +1 -1
  29. package/dist/types/src/edge/functions.d.ts +3 -2
  30. package/dist/types/src/edge/functions.d.ts.map +1 -1
  31. package/dist/types/src/errors.d.ts +89 -20
  32. package/dist/types/src/errors.d.ts.map +1 -1
  33. package/dist/types/src/examples/fib.d.ts +7 -0
  34. package/dist/types/src/examples/fib.d.ts.map +1 -0
  35. package/dist/types/src/examples/index.d.ts +4 -0
  36. package/dist/types/src/examples/index.d.ts.map +1 -0
  37. package/dist/types/src/examples/reply.d.ts +3 -0
  38. package/dist/types/src/examples/reply.d.ts.map +1 -0
  39. package/dist/types/src/examples/sleep.d.ts +5 -0
  40. package/dist/types/src/examples/sleep.d.ts.map +1 -0
  41. package/dist/types/src/executor/executor.d.ts +7 -1
  42. package/dist/types/src/executor/executor.d.ts.map +1 -1
  43. package/dist/types/src/handler.d.ts +52 -8
  44. package/dist/types/src/handler.d.ts.map +1 -1
  45. package/dist/types/src/index.d.ts +3 -1
  46. package/dist/types/src/index.d.ts.map +1 -1
  47. package/dist/types/src/schema.d.ts +6 -1
  48. package/dist/types/src/schema.d.ts.map +1 -1
  49. package/dist/types/src/services/credentials.d.ts +15 -3
  50. package/dist/types/src/services/credentials.d.ts.map +1 -1
  51. package/dist/types/src/services/database.d.ts +39 -6
  52. package/dist/types/src/services/database.d.ts.map +1 -1
  53. package/dist/types/src/services/event-logger.d.ts +1 -1
  54. package/dist/types/src/services/event-logger.d.ts.map +1 -1
  55. package/dist/types/src/services/function-invocation-service.d.ts +26 -0
  56. package/dist/types/src/services/function-invocation-service.d.ts.map +1 -0
  57. package/dist/types/src/services/function-invocation-service.test.d.ts +2 -0
  58. package/dist/types/src/services/function-invocation-service.test.d.ts.map +1 -0
  59. package/dist/types/src/services/index.d.ts +4 -3
  60. package/dist/types/src/services/index.d.ts.map +1 -1
  61. package/dist/types/src/services/local-function-execution.d.ts +23 -2
  62. package/dist/types/src/services/local-function-execution.d.ts.map +1 -1
  63. package/dist/types/src/services/queues.d.ts +19 -5
  64. package/dist/types/src/services/queues.d.ts.map +1 -1
  65. package/dist/types/src/services/remote-function-execution-service.d.ts +9 -4
  66. package/dist/types/src/services/remote-function-execution-service.d.ts.map +1 -1
  67. package/dist/types/src/services/service-container.d.ts +1 -1
  68. package/dist/types/src/services/service-container.d.ts.map +1 -1
  69. package/dist/types/src/services/service-registry.d.ts.map +1 -1
  70. package/dist/types/src/services/tracing.d.ts +34 -3
  71. package/dist/types/src/services/tracing.d.ts.map +1 -1
  72. package/dist/types/src/testing/layer.d.ts +9 -2
  73. package/dist/types/src/testing/layer.d.ts.map +1 -1
  74. package/dist/types/src/testing/logger.d.ts.map +1 -1
  75. package/dist/types/src/testing/persist-database.test.d.ts +2 -0
  76. package/dist/types/src/testing/persist-database.test.d.ts.map +1 -0
  77. package/dist/types/src/testing/services.d.ts +1 -1
  78. package/dist/types/src/testing/services.d.ts.map +1 -1
  79. package/dist/types/src/trace.d.ts +20 -22
  80. package/dist/types/src/trace.d.ts.map +1 -1
  81. package/dist/types/src/triggers/index.d.ts +4 -0
  82. package/dist/types/src/triggers/index.d.ts.map +1 -0
  83. package/dist/types/src/triggers/input-builder.d.ts +3 -0
  84. package/dist/types/src/triggers/input-builder.d.ts.map +1 -0
  85. package/dist/types/src/triggers/invocation-tracer.d.ts +35 -0
  86. package/dist/types/src/triggers/invocation-tracer.d.ts.map +1 -0
  87. package/dist/types/src/triggers/trigger-dispatcher.d.ts +74 -0
  88. package/dist/types/src/triggers/trigger-dispatcher.d.ts.map +1 -0
  89. package/dist/types/src/triggers/trigger-dispatcher.test.d.ts +2 -0
  90. package/dist/types/src/triggers/trigger-dispatcher.test.d.ts.map +1 -0
  91. package/dist/types/src/triggers/trigger-state-store.d.ts +27 -0
  92. package/dist/types/src/triggers/trigger-state-store.d.ts.map +1 -0
  93. package/dist/types/src/types.d.ts +60 -250
  94. package/dist/types/src/types.d.ts.map +1 -1
  95. package/dist/types/src/url.d.ts +10 -6
  96. package/dist/types/src/url.d.ts.map +1 -1
  97. package/dist/types/tsconfig.tsbuildinfo +1 -1
  98. package/package.json +43 -43
  99. package/src/bundler/bundler.test.ts +8 -9
  100. package/src/bundler/bundler.ts +32 -33
  101. package/src/edge/functions.ts +8 -5
  102. package/src/errors.ts +13 -5
  103. package/src/examples/fib.ts +31 -0
  104. package/src/examples/index.ts +7 -0
  105. package/src/examples/reply.ts +19 -0
  106. package/src/examples/sleep.ts +23 -0
  107. package/src/executor/executor.ts +12 -9
  108. package/src/handler.ts +120 -18
  109. package/src/index.ts +3 -3
  110. package/src/schema.ts +11 -0
  111. package/src/services/credentials.ts +80 -5
  112. package/src/services/database.ts +115 -18
  113. package/src/services/event-logger.ts +2 -2
  114. package/src/services/function-invocation-service.test.ts +79 -0
  115. package/src/services/function-invocation-service.ts +82 -0
  116. package/src/services/index.ts +4 -3
  117. package/src/services/local-function-execution.ts +97 -17
  118. package/src/services/queues.ts +34 -10
  119. package/src/services/remote-function-execution-service.ts +38 -43
  120. package/src/services/service-container.ts +4 -3
  121. package/src/services/service-registry.ts +1 -1
  122. package/src/services/tracing.ts +106 -9
  123. package/src/testing/layer.ts +84 -3
  124. package/src/testing/logger.ts +1 -1
  125. package/src/testing/persist-database.test.ts +87 -0
  126. package/src/testing/services.ts +3 -2
  127. package/src/trace.ts +17 -19
  128. package/src/triggers/index.ts +7 -0
  129. package/src/triggers/input-builder.ts +35 -0
  130. package/src/triggers/invocation-tracer.ts +99 -0
  131. package/src/triggers/trigger-dispatcher.test.ts +651 -0
  132. package/src/triggers/trigger-dispatcher.ts +522 -0
  133. package/src/triggers/trigger-state-store.ts +60 -0
  134. package/src/types.ts +39 -36
  135. package/src/url.ts +13 -10
  136. package/dist/lib/browser/chunk-6PTFLPCO.mjs +0 -462
  137. package/dist/lib/browser/chunk-6PTFLPCO.mjs.map +0 -7
  138. package/dist/lib/node-esm/chunk-NYJ2TSXO.mjs +0 -464
  139. package/dist/lib/node-esm/chunk-NYJ2TSXO.mjs.map +0 -7
@@ -1,5 +1,7 @@
1
- import { Context, Effect, Layer } from 'effect';
2
- type CredentialQuery = {
1
+ import { HttpClient } from '@effect/platform';
2
+ import { type Config, Context, Effect, Layer, Redacted } from 'effect';
3
+ import { DatabaseService } from './database';
4
+ export type CredentialQuery = {
3
5
  service?: string;
4
6
  };
5
7
  export type ServiceCredential = {
@@ -18,8 +20,14 @@ declare const CredentialsService_base: Context.TagClass<CredentialsService, "@dx
18
20
  getCredential: (query: CredentialQuery) => Promise<ServiceCredential>;
19
21
  }>;
20
22
  export declare class CredentialsService extends CredentialsService_base {
21
- static configuredLayer: (credentials: ServiceCredential[]) => Layer.Layer<CredentialsService, never, never>;
22
23
  static getCredential: (query: CredentialQuery) => Effect.Effect<ServiceCredential, never, CredentialsService>;
24
+ static getApiKey: (query: CredentialQuery) => Effect.Effect<Redacted.Redacted<string>, never, CredentialsService>;
25
+ static configuredLayer: (credentials: ServiceCredential[]) => Layer.Layer<CredentialsService, never, never>;
26
+ static layerConfig: (credentials: {
27
+ service: string;
28
+ apiKey: Config.Config<Redacted.Redacted<string>>;
29
+ }[]) => Layer.Layer<CredentialsService, import("effect/ConfigError").ConfigError, never>;
30
+ static layerFromDatabase: () => Layer.Layer<CredentialsService, never, DatabaseService>;
23
31
  }
24
32
  export declare class ConfiguredCredentialsService implements Context.Tag.Service<CredentialsService> {
25
33
  private readonly credentials;
@@ -28,5 +36,9 @@ export declare class ConfiguredCredentialsService implements Context.Tag.Service
28
36
  queryCredentials(query: CredentialQuery): Promise<ServiceCredential[]>;
29
37
  getCredential(query: CredentialQuery): Promise<ServiceCredential>;
30
38
  }
39
+ /**
40
+ * Maps the request to include the API key from the credential.
41
+ */
42
+ export declare const withAuthorization: (query: CredentialQuery, kind?: "Bearer" | "Basic") => <E, R>(self: HttpClient.HttpClient.With<E, R>) => HttpClient.HttpClient.With<E, CredentialsService | R>;
31
43
  export {};
32
44
  //# sourceMappingURL=credentials.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../../src/services/credentials.ts"],"names":[],"mappings":"A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AK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAItE,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAQxE;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,eAAe,EAAE,OAAO,QAAQ,GAAG,OAAO,4GAOhF,CAAC"}
@@ -1,6 +1,8 @@
1
- import { Context, Effect, Layer } from 'effect';
2
- import type { Filter, Live, Obj, Query, Ref, Relation } from '@dxos/echo';
3
- import type { EchoDatabase, OneShotQueryResult, QueryResult } from '@dxos/echo-db';
1
+ import { Context, Effect, Layer, Option, type Schema } from 'effect';
2
+ import { type Filter, type Live, Obj, ObjectNotFoundError, type Query, type Ref, type Relation, type Type } from '@dxos/echo';
3
+ import type { EchoDatabase, FlushOptions, OneShotQueryResult, QueryResult, SchemaRegistryQuery } from '@dxos/echo-db';
4
+ import type { SchemaRegistryPreparedQuery } from '@dxos/echo-db';
5
+ import type { EchoSchema } from '@dxos/echo-schema';
4
6
  import type { DXN } from '@dxos/keys';
5
7
  declare const DatabaseService_base: Context.TagClass<DatabaseService, "@dxos/functions/DatabaseService", {
6
8
  readonly db: EchoDatabase;
@@ -8,9 +10,38 @@ declare const DatabaseService_base: Context.TagClass<DatabaseService, "@dxos/fun
8
10
  export declare class DatabaseService extends DatabaseService_base {
9
11
  static notAvailable: Layer.Layer<DatabaseService, never, never>;
10
12
  static make: (db: EchoDatabase) => Context.Tag.Service<DatabaseService>;
11
- static makeLayer: (db: EchoDatabase) => Layer.Layer<DatabaseService>;
12
- static resolve: (dxn: DXN) => Effect.Effect<Obj.Any | Relation.Any, Error, DatabaseService>;
13
- static loadRef: <T>(ref: Ref.Ref<T>) => Effect.Effect<T, never, never>;
13
+ static layer: (db: EchoDatabase) => Layer.Layer<DatabaseService>;
14
+ /**
15
+ * Resolves an object by its DXN.
16
+ */
17
+ static resolve: {
18
+ (dxn: DXN): Effect.Effect<Obj.Any | Relation.Any, never, DatabaseService>;
19
+ <S extends Type.Obj.Any | Type.Relation.Any>(dxn: DXN, schema: S): Effect.Effect<Schema.Schema.Type<S>, ObjectNotFoundError, DatabaseService>;
20
+ };
21
+ /**
22
+ * Loads an object reference.
23
+ */
24
+ static load: <T>(ref: Ref.Ref<T>) => Effect.Effect<T, ObjectNotFoundError, never>;
25
+ /**
26
+ * Loads an object reference option.
27
+ */
28
+ static loadOption: <T>(ref: Ref.Ref<T>) => Effect.Effect<Option.Option<T>, never, never>;
29
+ /**
30
+ * @link EchoDatabase.add
31
+ */
32
+ static add: <T extends Obj.Any | Relation.Any>(obj: T) => Effect.Effect<T, never, DatabaseService>;
33
+ /**
34
+ * @link EchoDatabase.remove
35
+ */
36
+ static remove: <T extends Obj.Any | Relation.Any>(obj: T) => Effect.Effect<void, never, DatabaseService>;
37
+ /**
38
+ * @link EchoDatabase.flush
39
+ */
40
+ static flush: (opts?: FlushOptions) => Effect.Effect<void, never, DatabaseService>;
41
+ /**
42
+ * @link EchoDatabase.getObjectById
43
+ */
44
+ static getObjectById: <T extends Obj.Any | Relation.Any>(id: string) => Effect.Effect<Live<T> | undefined, never, DatabaseService>;
14
45
  /**
15
46
  * Creates a `QueryResult` object that can be subscribed to.
16
47
  */
@@ -25,6 +56,8 @@ export declare class DatabaseService extends DatabaseService_base {
25
56
  <Q extends Query.Any>(query: Q): Effect.Effect<OneShotQueryResult<Live<Query.Type<Q>>>, never, DatabaseService>;
26
57
  <F extends Filter.Any>(filter: F): Effect.Effect<OneShotQueryResult<Live<Filter.Type<F>>>, never, DatabaseService>;
27
58
  };
59
+ static schemaQuery: <Q extends SchemaRegistryQuery>(query: Q) => Effect.Effect<SchemaRegistryPreparedQuery<EchoSchema>, never, DatabaseService>;
60
+ static runSchemaQuery: <Q extends SchemaRegistryQuery>(query: Q) => Effect.Effect<EchoSchema[], never, DatabaseService>;
28
61
  }
29
62
  export {};
30
63
  //# sourceMappingURL=database.d.ts.map
@@ -1 +1 @@
1
- {"version":3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AAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;QAChH,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;KACpH,CAGG;IAEJ,MAAM,CAAC,WAAW,GAAI,CAAC,SAAS,mBAAmB,EACjD,OAAO,CAAC,KACP,MAAM,CAAC,MAAM,CAAC,2BAA2B,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAI7E;IAEJ,MAAM,CAAC,cAAc,GAAI,CAAC,SAAS,mBAAmB,EACpD,OAAO,CAAC,KACP,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,eAAe,CAAC,CAGlD;CACL"}
@@ -1,4 +1,4 @@
1
- import { Effect, Context, Schema, Layer } from 'effect';
1
+ import { Context, Effect, Layer, Schema } from 'effect';
2
2
  import { Type } from '@dxos/echo';
3
3
  import { LogLevel } from '@dxos/log';
4
4
  import { TracingService } from './tracing';
@@ -1 +1 @@
1
- {"version":3,"file":"event-logger.d.ts","sourceRoot":"","sources":["../../../../src/services/event-logger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAExD,OAAO,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAO,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;IA4B/B,CAAC;AACF,MAAM,MAA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mB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEjF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;GAEsD,CAAC;;kBAO9D,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI;qBAAmB,MAAM,GAAG,SAAS;;AAL3F;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,uBAGrC;IACD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAGlD;IAEF;;OAEG;IACH,MAAM,CAAC,gBAAgB,yDAWrB;CACH;AAED,eAAO,MAAM,cAAc,GAAI,MAAM,GAAG,mDAWpC,CAAC;AAEL,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,OAAK,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAMrG,CAAC;AAEJ,eAAO,MAAM,iBAAiB,GAC5B,OAAO,QAAQ,EACf,UAAS,MAAgB,KACxB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAiBxC,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { Context, Effect, Layer } from 'effect';
2
+ import { AiService } from '@dxos/ai';
3
+ import { type FunctionDefinition } from '../handler';
4
+ import { CredentialsService } from './credentials';
5
+ import { DatabaseService } from './database';
6
+ import { type InvocationServices, LocalFunctionExecutionService } from './local-function-execution';
7
+ import { QueueService } from './queues';
8
+ import { RemoteFunctionExecutionService } from './remote-function-execution-service';
9
+ declare const FunctionInvocationService_base: Context.TagClass<FunctionInvocationService, "@dxos/functions/FunctionInvocationService", {
10
+ invokeFunction<I, O>(functionDef: FunctionDefinition<I, O>, input: I): Effect.Effect<O, never, InvocationServices>;
11
+ }>;
12
+ export declare class FunctionInvocationService extends FunctionInvocationService_base {
13
+ static invokeFunction: <I, O>(functionDef: FunctionDefinition<I, O>, input: I) => Effect.Effect<O, never, InvocationServices | FunctionInvocationService>;
14
+ static layer: Layer.Layer<FunctionInvocationService, never, RemoteFunctionExecutionService | LocalFunctionExecutionService>;
15
+ static layerTest: ({ functions, }?: {
16
+ functions?: FunctionDefinition<any, any>[];
17
+ }) => Layer.Layer<FunctionInvocationService, never, AiService.AiService | CredentialsService | DatabaseService | QueueService>;
18
+ /**
19
+ * @deprecated Use {@link layerTest} instead.
20
+ */
21
+ static layerTestMocked: ({ functions, }: {
22
+ functions: FunctionDefinition<any, any>[];
23
+ }) => Layer.Layer<FunctionInvocationService>;
24
+ }
25
+ export {};
26
+ //# sourceMappingURL=function-invocation-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function-invocation-service.d.ts","sourceRoot":"","sources":["../../../../src/services/function-invocation-service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAEL,KAAK,kBAAkB,EACvB,6BAA6B,EAC9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;;mBAKlE,CAAC,EAAE,CAAC,eAAe,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC;;AAHtH,qBAAa,yBAA0B,SAAQ,8BAK5C;IACD,MAAM,CAAC,cAAc,GAHJ,CAAC,EAAE,CAAC,8HAGoF;IAEzG,MAAM,CAAC,KAAK,gHAoBV;IAGF,MAAM,CAAC,SAAS,GAAI,iBAEjB;QACD,SAAS,CAAC,EAAE,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;KACvC,KAAG,KAAK,CAAC,KAAK,CAClB,yBAAyB,EACzB,KAAK,EACL,SAAS,CAAC,SAAS,GAAG,kBAAkB,GAAG,eAAe,GAAG,YAAY,CAC1E,CAKG;IAIJ;;OAEG;IACH,MAAM,CAAC,eAAe,GAAI,gBAEvB;QACD,SAAS,EAAE,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;KAC3C,KAAG,KAAK,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAMtC;CACL"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=function-invocation-service.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function-invocation-service.test.d.ts","sourceRoot":"","sources":["../../../../src/services/function-invocation-service.test.ts"],"names":[],"mappings":""}
@@ -1,9 +1,10 @@
1
+ export * from './credentials';
1
2
  export * from './database';
3
+ export * from './event-logger';
4
+ export * from './function-invocation-service';
5
+ export * from './local-function-execution';
2
6
  export * from './queues';
3
7
  export * from './service-container';
4
- export * from './credentials';
5
8
  export * from './tracing';
6
- export * from './event-logger';
7
9
  export * from './remote-function-execution-service';
8
- export * from './local-function-execution';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qCAAqC,CAAC;AACpD,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/index.ts"],"names":[],"mappings":"AAIA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,qCAAqC,CAAC"}
@@ -1,11 +1,32 @@
1
1
  import { Context, Effect, Layer } from 'effect';
2
+ import { AiService } from '@dxos/ai';
3
+ import { FunctionNotFoundError } from '../errors';
2
4
  import type { FunctionDefinition } from '../handler';
5
+ import { CredentialsService } from './credentials';
6
+ import { DatabaseService } from './database';
7
+ import { type ComputeEventLogger } from './event-logger';
8
+ import { QueueService } from './queues';
9
+ import { RemoteFunctionExecutionService } from './remote-function-execution-service';
3
10
  import type { Services } from './service-container';
11
+ import { type TracingService } from './tracing';
12
+ /**
13
+ * Services that are provided at the function call site.
14
+ */
15
+ export type InvocationServices = TracingService | ComputeEventLogger;
4
16
  declare const LocalFunctionExecutionService_base: Context.TagClass<LocalFunctionExecutionService, "@dxos/functions/LocalFunctionExecutionService", {
5
- invokeFunction(fnDef: FunctionDefinition<any, any>, input: unknown): Effect.Effect<unknown, never, Services>;
17
+ invokeFunction<I, O>(functionDef: FunctionDefinition<I, O>, input: I): Effect.Effect<O, never, InvocationServices>;
6
18
  }>;
7
19
  export declare class LocalFunctionExecutionService extends LocalFunctionExecutionService_base {
8
- static layer: Layer.Layer<LocalFunctionExecutionService, never, never>;
20
+ static layerLive: Layer.Layer<LocalFunctionExecutionService, never, DatabaseService | CredentialsService | QueueService | RemoteFunctionExecutionService | AiService.AiService | FunctionImplementationResolver>;
21
+ static invokeFunction: <F extends FunctionDefinition.Any>(functionDef: F, input: FunctionDefinition.Input<F>) => Effect.Effect<FunctionDefinition.Output<F>, never, Services | LocalFunctionExecutionService>;
22
+ }
23
+ declare const FunctionImplementationResolver_base: Context.TagClass<FunctionImplementationResolver, "@dxos/functions/FunctionImplementationResolver", {
24
+ resolveFunctionImplementation<I, O>(functionDef: FunctionDefinition<I, O>): Effect.Effect<FunctionDefinition<I, O>, FunctionNotFoundError>;
25
+ }>;
26
+ export declare class FunctionImplementationResolver extends FunctionImplementationResolver_base {
27
+ static layerTest: ({ functions }: {
28
+ functions: FunctionDefinition<any, any>[];
29
+ }) => Layer.Layer<FunctionImplementationResolver, never, never>;
9
30
  }
10
31
  export {};
11
32
  //# sourceMappingURL=local-function-execution.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"local-function-execution.d.ts","sourceRoot":"","sources":["../../../../src/services/local-function-execution.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAU,MAAM,QAAQ,CAAC;AAIxD,OAAO,KAAK,EAAmB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;;0BAQ1B,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,SAAS,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC;;AALhH,qBAAa,6BAA8B,SAAQ,kCAOhD;IACD,MAAM,CAAC,KAAK,2DAET;CACJ"}
1
+ {"version":3,"file":"local-function-execution.d.ts","sourceRoot":"","sources":["../../../../src/services/local-function-execution.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAU,MAAM,QAAQ,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAIrC,OAAO,EAAiB,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAmB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,EAAE,kB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,+DAS3E;CACN"}
@@ -1,5 +1,7 @@
1
- import { Context, Layer } from 'effect';
1
+ import { Context, Effect, Layer } from 'effect';
2
+ import type { Obj, Relation } from '@dxos/echo';
2
3
  import type { Queue, QueueAPI, QueueFactory } from '@dxos/echo-db';
4
+ import type { DXN, QueueSubspaceTag } from '@dxos/keys';
3
5
  declare const QueueService_base: Context.TagClass<QueueService, "@dxos/functions/QueueService", {
4
6
  /**
5
7
  * API to access the queues.
@@ -9,23 +11,35 @@ declare const QueueService_base: Context.TagClass<QueueService, "@dxos/functions
9
11
  * The queue that is used to store the context of the current research.
10
12
  * @deprecated Use `ContextQueueService` instead.
11
13
  */
12
- readonly contextQueue: Queue | undefined;
14
+ readonly queue: Queue | undefined;
13
15
  }>;
14
16
  /**
15
17
  * Gives access to all queues.
16
18
  */
17
19
  export declare class QueueService extends QueueService_base {
18
20
  static notAvailable: Layer.Layer<QueueService, never, never>;
19
- static make: (queues: QueueFactory, contextQueue?: Queue) => Context.Tag.Service<QueueService>;
20
- static makeLayer: (queues: QueueFactory, contextQueue?: Queue) => Layer.Layer<QueueService>;
21
+ static make: (queues: QueueFactory, queue?: Queue) => Context.Tag.Service<QueueService>;
22
+ static layer: (queues: QueueFactory, queue?: Queue) => Layer.Layer<QueueService>;
23
+ /**
24
+ * Gets a queue by its DXN.
25
+ */
26
+ static getQueue: <T extends Obj.Any | Relation.Any = Obj.Any | Relation.Any>(dxn: DXN) => Effect.Effect<Queue<T>, never, QueueService>;
27
+ /**
28
+ * Creates a new queue.
29
+ */
30
+ static createQueue: <T extends Obj.Any | Relation.Any = Obj.Any | Relation.Any>(options?: {
31
+ subspaceTag?: QueueSubspaceTag;
32
+ }) => Effect.Effect<Queue<T>, never, QueueService>;
33
+ static append: <T extends Obj.Any | Relation.Any = Obj.Any | Relation.Any>(queue: Queue<T>, objects: T[]) => Effect.Effect<void>;
21
34
  }
22
35
  declare const ContextQueueService_base: Context.TagClass<ContextQueueService, "@dxos/functions/ContextQueueService", {
23
- readonly contextQueue: Queue;
36
+ readonly queue: Queue;
24
37
  }>;
25
38
  /**
26
39
  * Gives access to a specific queue passed as a context.
27
40
  */
28
41
  export declare class ContextQueueService extends ContextQueueService_base {
42
+ static layer: (queue: Queue) => Layer.Layer<ContextQueueService, never, never>;
29
43
  }
30
44
  export {};
31
45
  //# sourceMappingURL=queues.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"queues.d.ts","sourceRoot":"","sources":["../../../../src/services/queues.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;;IAQ/D;;OAEG;qBACc,QAAQ;IAEzB;;;OAGG;2BACoB,KAAK,GAAG,SAAS;;AAf5C;;GAEG;AACH,qBAAa,YAAa,SAAQ,iBAc/B;IACD,MAAM,CAAC,YAAY,0CAUhB;IAEH,MAAM,CAAC,IAAI,GAAI,QAAQ,YAAY,EAAE,eAAe,KAAK,KAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAK3F;IAEF,MAAM,CAAC,SAAS,GAAI,QAAQ,YAAY,EAAE,eAAe,KAAK,KAAG,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CACnB;CACxE;;2BAQ0B,KAAK;;AANhC;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,wBAKtC;CAAG"}
1
+ {"version":3,"file":"queues.d.ts","sourceRoot":"","sources":["../../../../src/services/queues.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,E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E;;oBAQmB,KAAK;;AANzB;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,wBAKtC;IACD,MAAM,CAAC,KAAK,GAAI,OAAO,KAAK,oDAAmD;CAChF"}
@@ -1,15 +1,20 @@
1
- import { Context, Layer } from 'effect';
1
+ import { Context, Effect, Layer } from 'effect';
2
2
  import type { SpaceId } from '@dxos/keys';
3
3
  declare const RemoteFunctionExecutionService_base: Context.TagClass<RemoteFunctionExecutionService, "@dxos/functions/RemoteFunctionExecutionService", {
4
- callFunction(deployedFunctionId: string, input: any, spaceId?: SpaceId): Promise<any>;
4
+ callFunction<I, O>(deployedFunctionId: string, input: I): Effect.Effect<O>;
5
5
  }>;
6
6
  /**
7
7
  * Allows calling into other functions.
8
8
  */
9
9
  export declare class RemoteFunctionExecutionService extends RemoteFunctionExecutionService_base {
10
- static fromClient(baseUrl: string, spaceId: SpaceId): Context.Tag.Service<RemoteFunctionExecutionService>;
10
+ /**
11
+ * @param baseUrl URL of the EDGE server.
12
+ * @param spaceId - The space ID to invoke the function in. If not provided, the function will be without space context.
13
+ * @returns
14
+ */
15
+ static fromClient(baseUrl: string, spaceId?: SpaceId): Layer.Layer<RemoteFunctionExecutionService>;
11
16
  static mock: () => Context.Tag.Service<RemoteFunctionExecutionService>;
12
- static mockLayer: Layer.Layer<RemoteFunctionExecutionService, never, never>;
17
+ static layerMock: Layer.Layer<RemoteFunctionExecutionService, never, never>;
13
18
  }
14
19
  export {};
15
20
  //# sourceMappingURL=remote-function-execution-service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remote-function-execution-service.d.ts","sourceRoot":"","sources":["../../../../src/services/remote-function-execution-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;;qCAQL,MAAM,SAAS,GAAG,YAAY,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;;AANzF;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,mCAKjD;IACD,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,8BAA8B,CAAC;IAiBzG,MAAM,CAAC,IAAI,QAAO,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAMnE;IAEF,MAAM,CAAC,SAAS,4DAAwF;CACzG"}
1
+ {"version":3,"file":"remote-function-execution-service.d.ts","sourceRoot":"","sources":["../../../../src/services/remote-function-execution-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;;iBAWzB,CAAC,EAAE,CAAC,sBAAsB,MAAM,SAAS,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;;AAN9E;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,mCAKjD;IACD;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,8BAA8B,CAAC;IA2BlG,MAAM,CAAC,IAAI,QAAO,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAKnE;IAEF,MAAM,CAAC,SAAS,4DAAwF;CACzG"}
@@ -10,7 +10,7 @@ import { TracingService } from './tracing';
10
10
  * List of all services.
11
11
  */
12
12
  declare const SERVICES: {
13
- readonly ai: typeof AiService;
13
+ readonly ai: typeof AiService.AiService;
14
14
  readonly credentials: typeof CredentialsService;
15
15
  readonly database: typeof DatabaseService;
16
16
  readonly eventLogger: typeof ComputeEventLogger;
@@ -1 +1 @@
1
- {"version":3,"file":"service-container.d.ts","sourceRoot":"","sources":["../../../../src/services/service-container.ts"],"names":[],"m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,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,EAC/D,GAAG,IAAI,EAAE,IAAI,GACZ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACT,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAChB,CAAC,EACD,CAAC,EACD,OAAO,CAAC,CAAC,EAAE;aAAG,CAAC,IAAI,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAAE,CAAC,MAAM,CAAC,CAAC,GAAG,eAAe,CAC7F,CAAC;KACH,CAGG;CACL"}
@@ -1,13 +1,19 @@
1
1
  import { Context, Effect, Layer } from 'effect';
2
2
  import { AgentStatus } from '@dxos/ai';
3
3
  import { Obj } from '@dxos/echo';
4
- import type { AnyEchoObject } from '@dxos/echo-schema';
4
+ import type { Queue } from '@dxos/echo-db';
5
+ import type { ObjectId } from '@dxos/echo-schema';
6
+ import { DataType } from '@dxos/schema';
5
7
  declare const TracingService_base: Context.TagClass<TracingService, "@dxos/functions/TracingService", {
8
+ /**
9
+ * Gets the parent message ID.
10
+ */
11
+ getTraceContext: () => TracingService.TraceContext;
6
12
  /**
7
13
  * Write an event to the tracing queue.
8
14
  * @param event - The event to write. Must be an a typed object.
9
15
  */
10
- write(event: AnyEchoObject): void;
16
+ write: (event: Obj.Any) => void;
11
17
  }>;
12
18
  /**
13
19
  * Provides a way for compute primitives (functions, workflows, tools)
@@ -17,10 +23,35 @@ export declare class TracingService extends TracingService_base {
17
23
  static noop: Context.Tag.Service<TracingService>;
18
24
  static layerNoop: Layer.Layer<TracingService, never, never>;
19
25
  static console: Context.Tag.Service<TracingService>;
26
+ static layerConsole: Layer.Layer<TracingService, never, never>;
27
+ static layerLogInfo: () => Layer.Layer<TracingService, never, never>;
28
+ /**
29
+ * Creates a TracingService layer that emits events to the parent tracing service.
30
+ */
31
+ static layerSubframe: (mapContext: (currentContext: TracingService.TraceContext) => TracingService.TraceContext) => Layer.Layer<TracingService, never, TracingService>;
32
+ static layerQueue: (queue: Queue) => Layer.Layer<TracingService, never, never>;
20
33
  /**
21
34
  * Emit the current human-readable execution status.
22
35
  */
23
- static emitStatus: (data: Obj.MakeProps<typeof AgentStatus>) => Effect.Effect<unknown, never, void>;
36
+ static emitStatus: (data: Omit<Obj.MakeProps<typeof AgentStatus>, 'created'>) => Effect.Effect<void, never, TracingService>;
37
+ static emitConverationMessage: (data: Obj.MakeProps<typeof DataType.Message>) => Effect.Effect<void, never, TracingService>;
24
38
  }
39
+ export declare namespace TracingService {
40
+ interface TraceContext {
41
+ /**
42
+ * If this thread sprung from a tool call, this is the ID of the message containing the tool call.
43
+ */
44
+ parentMessage?: ObjectId;
45
+ /**
46
+ * If the current thread is a byproduct of a tool call, this is the ID of the tool call.
47
+ */
48
+ toolCallId?: string;
49
+ debugInfo?: unknown;
50
+ }
51
+ }
52
+ /**
53
+ * Goes into {@link DataType.Message['properties']}
54
+ */
55
+ export declare const MESSAGE_PROPERTY_TOOL_CALL_ID: "toolCallId";
25
56
  export {};
26
57
  //# sourceMappingURL=tracing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../../../src/services/tracing.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;;IASnD;;;OAGG;iBACU,aAAa,GAAG,IAAI;;AAXrC;;;GAGG;AACH,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MAAM,CAAC,YAAY,kDAQd;IAEL;;OAEG;IACH,MAAM,CAAC,aAAa,GAAI,YAAY,CAAC,cAAc,EAAE,cAAc,CAAC,YAAY,KAAK,cAAc,CAAC,YAAY,wDAW5G;IAEJ,MAAM,CAAC,UAAU,GAAI,OAAO,KAAK,+CAc7B;IAEJ;;OAEG;IACH,MAAM,CAAC,UAAU,EAAE,CACjB,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,WAAW,CAAC,EAAE,SAAS,CAAC,KACrD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,CAU5C;IAEH,MAAM,CAAC,sBAAsB,EAAE,CAC7B,IAAI,EAAE,GAAG,CAAC,SAAS,CAAC,OAAO,QAAQ,CAAC,OAAO,CAAC,KACzC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,CAY5C;CACJ;AAED,yBAAiB,cAAc,CAAC;IAC9B,UAAiB,YAAY;QAC3B;;WAEG;QACH,aAAa,CAAC,EAAE,QAAQ,CAAC;QAEzB;;WAEG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;QAEpB,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB;CACF;AAED;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAG,YAAqB,CAAC"}
@@ -1,10 +1,17 @@
1
- import { Layer } from 'effect';
2
1
  import type { Schema } from 'effect';
2
+ import { Effect, Layer } from 'effect';
3
3
  import type { EchoHostIndexingConfig } from '@dxos/echo-pipeline';
4
+ import { PublicKey } from '@dxos/keys';
4
5
  import { DatabaseService, QueueService } from '../services';
6
+ export declare const testStoragePath: ({ name }: {
7
+ name?: string;
8
+ }) => string;
5
9
  export type TestDatabaseOptions = {
6
10
  indexing?: Partial<EchoHostIndexingConfig>;
7
11
  types?: Schema.Schema.AnyNoContext[];
12
+ spaceKey?: PublicKey;
13
+ storagePath?: string;
14
+ onInit?: () => Effect.Effect<void, never, DatabaseService | QueueService>;
8
15
  };
9
- export declare const TestDatabaseLayer: ({ indexing, types }?: TestDatabaseOptions) => Layer.Layer<DatabaseService | QueueService, never, never>;
16
+ export declare const TestDatabaseLayer: ({ indexing, types, spaceKey, storagePath, onInit }?: TestDatabaseOptions) => Layer.Layer<DatabaseService | QueueService, never, never>;
10
17
  //# sourceMappingURL=layer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../../../../src/testing/layer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAGlE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI5D,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,sBAAqB,mBAAwB,8DAU5E,CAAC"}
1
+ {"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../../../../src/testing/layer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAW,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAIhD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAKvC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI5D,eAAO,MAAM,eAAe,GAAI,UAAuC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,WAEvF,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;IACrC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,eAAe,GAAG,YAAY,CAAC,CAAC;CAC3E,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,qDAAoD,mBAAwB,8DA+E3G,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/testing/logger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAI9C,OAAO,EAAE,KAAK,kBAAkB,EAAqB,MAAM,aAAa,CAAC;AAEzE,eAAO,MAAM,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAG9D,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAoC,CAAC"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/testing/logger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,QAAQ,CAAC;AAI9C,OAAO,EAAE,KAAK,kBAAkB,EAAqB,MAAM,aAAa,CAAC;AAEzE,eAAO,MAAM,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAG9D,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAoC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=persist-database.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persist-database.test.d.ts","sourceRoot":"","sources":["../../../../src/testing/persist-database.test.ts"],"names":[],"mappings":""}
@@ -1,7 +1,7 @@
1
1
  import { type Context } from 'effect';
2
2
  import type { Space } from '@dxos/client/echo';
3
3
  import type { EchoDatabase, QueueFactory } from '@dxos/echo-db';
4
- import { type CredentialsService, type ComputeEventLogger, ServiceContainer, type ServiceCredential, type TracingService } from '../services';
4
+ import { type ComputeEventLogger, type CredentialsService, ServiceContainer, type ServiceCredential, type TracingService } from '../services';
5
5
  export type OneOf<T> = {
6
6
  [K in keyof T]: {
7
7
  [P in K]: T[P];
@@ -1 +1 @@
1
- {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../src/testing/services.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGhE,OAAO,EAEL,KAAK,kBAAkB,EAEvB,KAAK,kBAAkB,EAEvB,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAIrB,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;KACpB,CAAC,IAAI,MAAM,CAAC,GAAG;SAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAAE,GAAG;SAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK;KAAE;CAC5E,CAAC,MAAM,CAAC,CAAC,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEvE,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,EAA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,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAAE,GAAG;SAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK;KAAE;CAC5E,CAAC,MAAM,CAAC,CAAC,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEvE,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,EAAE,CAAC,EAAE,GAAG,CAAC;IAET;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC;QAClB;;WAEG;QACH,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;QAE/B;;WAEG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;KACnD,CAAC,CAAC;IAEH;;OAEG;IACH,EAAE,CAAC,EAAE,YAAY,CAAC;IAElB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;OAEG;IACH,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,MAAM,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;KAClD,CAAC;IAEF;;OAEG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IAEtB,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;KAC/C,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,4DAQhC,kBAAuB,KAAG,gBAW5B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { Schema } from 'effect';
2
- import { Type, type Ref } from '@dxos/echo';
2
+ import { type Ref, Type } from '@dxos/echo';
3
3
  import { Queue } from '@dxos/echo-db';
4
- import { FunctionTrigger, type FunctionTriggerType } from './types';
4
+ import { FunctionTrigger } from './types';
5
5
  export declare enum InvocationOutcome {
6
6
  SUCCESS = "success",
7
7
  FAILURE = "failure",
@@ -12,7 +12,7 @@ export declare enum InvocationTraceEventType {
12
12
  END = "end"
13
13
  }
14
14
  export declare const TraceEventException: Schema.Struct<{
15
- timestampMs: typeof Schema.Number;
15
+ timestamp: typeof Schema.Number;
16
16
  message: typeof Schema.String;
17
17
  name: typeof Schema.String;
18
18
  stack: Schema.optional<typeof Schema.String>;
@@ -31,7 +31,7 @@ export declare const InvocationTraceStartEvent: Type.obj<Schema.Struct<{
31
31
  /**
32
32
  * Event generation time.
33
33
  */
34
- timestampMs: typeof Schema.Number;
34
+ timestamp: typeof Schema.Number;
35
35
  /**
36
36
  * Data passed to function / workflow as an argument.
37
37
  */
@@ -39,18 +39,18 @@ export declare const InvocationTraceStartEvent: Type.obj<Schema.Struct<{
39
39
  /**
40
40
  * Queue for function/workflow invocation events.
41
41
  */
42
- invocationTraceQueue: Type.ref<Schema.Schema<Queue<import("@dxos/echo/Obj").Any | import("@dxos/echo/Relation").Any>, Queue<import("@dxos/echo/Obj").Any | import("@dxos/echo/Relation").Any>, never>>;
42
+ invocationTraceQueue: Schema.optional<Type.ref<Schema.Schema<Queue<import("@dxos/echo/Obj").Any | import("@dxos/echo/Relation").Any>, Queue<import("@dxos/echo/Obj").Any | import("@dxos/echo/Relation").Any>, never>>>;
43
43
  /**
44
44
  * DXN of the invoked function/workflow.
45
45
  */
46
- invocationTarget: Type.ref<Schema.Schema<Type.Expando, {
46
+ invocationTarget: Schema.optional<Type.ref<Schema.Schema<Type.Expando, {
47
47
  [x: string]: any;
48
48
  id: string;
49
- }, never>>;
49
+ }, never>>>;
50
50
  /**
51
51
  * Present for automatic invocations.
52
52
  */
53
- trigger: Schema.optional<Type.ref<typeof FunctionTrigger>>;
53
+ trigger: Schema.optional<Type.ref<Schema.Schema<FunctionTrigger, import("./types").FunctionTriggerEncoded, never>>>;
54
54
  }>>;
55
55
  export type InvocationTraceStartEvent = Schema.Schema.Type<typeof InvocationTraceStartEvent>;
56
56
  export declare const InvocationTraceEndEvent: Type.obj<Schema.Struct<{
@@ -66,10 +66,10 @@ export declare const InvocationTraceEndEvent: Type.obj<Schema.Struct<{
66
66
  /**
67
67
  * Event generation time.
68
68
  */
69
- timestampMs: typeof Schema.Number;
69
+ timestamp: typeof Schema.Number;
70
70
  outcome: Schema.Enums<typeof InvocationOutcome>;
71
71
  exception: Schema.optional<Schema.Struct<{
72
- timestampMs: typeof Schema.Number;
72
+ timestamp: typeof Schema.Number;
73
73
  message: typeof Schema.String;
74
74
  name: typeof Schema.String;
75
75
  stack: Schema.optional<typeof Schema.String>;
@@ -78,7 +78,7 @@ export declare const InvocationTraceEndEvent: Type.obj<Schema.Struct<{
78
78
  export type InvocationTraceEndEvent = Schema.Schema.Type<typeof InvocationTraceEndEvent>;
79
79
  export type InvocationTraceEvent = InvocationTraceStartEvent | InvocationTraceEndEvent;
80
80
  export declare const TraceEventLog: Schema.Struct<{
81
- timestampMs: typeof Schema.Number;
81
+ timestamp: typeof Schema.Number;
82
82
  level: typeof Schema.String;
83
83
  message: typeof Schema.String;
84
84
  context: Schema.optional<typeof Schema.Object>;
@@ -87,18 +87,16 @@ export declare const TraceEvent: Type.obj<Schema.Struct<{
87
87
  id: import("@dxos/keys").ObjectIdClass;
88
88
  outcome: typeof Schema.String;
89
89
  truncated: typeof Schema.Boolean;
90
- /**
91
- * Time when the event was persisted.
92
- */
93
- ingestionTimestampMs: typeof Schema.Number;
90
+ /** Time when the event was persisted. */
91
+ ingestionTimestamp: typeof Schema.Number;
94
92
  logs: Schema.Array$<Schema.Struct<{
95
- timestampMs: typeof Schema.Number;
93
+ timestamp: typeof Schema.Number;
96
94
  level: typeof Schema.String;
97
95
  message: typeof Schema.String;
98
96
  context: Schema.optional<typeof Schema.Object>;
99
97
  }>>;
100
98
  exceptions: Schema.Array$<Schema.Struct<{
101
- timestampMs: typeof Schema.Number;
99
+ timestamp: typeof Schema.Number;
102
100
  message: typeof Schema.String;
103
101
  name: typeof Schema.String;
104
102
  stack: Schema.optional<typeof Schema.String>;
@@ -111,13 +109,13 @@ export type TraceEvent = Schema.Schema.Type<typeof TraceEvent>;
111
109
  */
112
110
  export type InvocationSpan = {
113
111
  id: string;
114
- timestampMs: number;
112
+ timestamp: number;
113
+ duration: number;
115
114
  outcome: InvocationOutcome;
116
115
  input: object;
117
- durationMs: number;
118
- invocationTraceQueue: Ref.Ref<Queue>;
119
- invocationTarget: Ref.Ref<Type.Expando>;
120
- trigger?: Ref.Ref<FunctionTriggerType>;
116
+ invocationTraceQueue?: Ref.Ref<Queue>;
117
+ invocationTarget?: Ref.Ref<Type.Expando>;
118
+ trigger?: Ref.Ref<FunctionTrigger>;
121
119
  exception?: TraceEventException;
122
120
  };
123
121
  export declare const createInvocationSpans: (items?: InvocationTraceEvent[]) => InvocationSpan[];