@dxos/functions 0.8.3 → 0.8.4-main.1da679c

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 (161) hide show
  1. package/dist/lib/browser/bundler/index.mjs +73 -44
  2. package/dist/lib/browser/bundler/index.mjs.map +3 -3
  3. package/dist/lib/browser/chunk-D2XO7XXY.mjs +611 -0
  4. package/dist/lib/browser/chunk-D2XO7XXY.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 +24 -10
  8. package/dist/lib/browser/edge/index.mjs.map +3 -3
  9. package/dist/lib/browser/index.mjs +981 -137
  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 +110 -9
  13. package/dist/lib/browser/testing/index.mjs.map +4 -4
  14. package/dist/lib/node-esm/bundler/index.mjs +72 -44
  15. package/dist/lib/node-esm/bundler/index.mjs.map +3 -3
  16. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  17. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  18. package/dist/lib/node-esm/chunk-Z4CJ62WS.mjs +613 -0
  19. package/dist/lib/node-esm/chunk-Z4CJ62WS.mjs.map +7 -0
  20. package/dist/lib/node-esm/edge/index.mjs +23 -10
  21. package/dist/lib/node-esm/edge/index.mjs.map +3 -3
  22. package/dist/lib/node-esm/index.mjs +981 -137
  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 +110 -9
  26. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  27. package/dist/types/src/bundler/bundler.d.ts +12 -14
  28. package/dist/types/src/bundler/bundler.d.ts.map +1 -1
  29. package/dist/types/src/edge/functions.d.ts +4 -3
  30. package/dist/types/src/edge/functions.d.ts.map +1 -1
  31. package/dist/types/src/errors.d.ts +137 -0
  32. package/dist/types/src/errors.d.ts.map +1 -0
  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 +4 -1
  42. package/dist/types/src/executor/executor.d.ts.map +1 -1
  43. package/dist/types/src/handler.d.ts +46 -16
  44. package/dist/types/src/handler.d.ts.map +1 -1
  45. package/dist/types/src/index.d.ts +3 -0
  46. package/dist/types/src/index.d.ts.map +1 -1
  47. package/dist/types/src/schema.d.ts +8 -3
  48. package/dist/types/src/schema.d.ts.map +1 -1
  49. package/dist/types/src/services/credentials.d.ts +18 -4
  50. package/dist/types/src/services/credentials.d.ts.map +1 -1
  51. package/dist/types/src/services/database.d.ts +55 -3
  52. package/dist/types/src/services/database.d.ts.map +1 -1
  53. package/dist/types/src/services/event-logger.d.ts +65 -30
  54. package/dist/types/src/services/event-logger.d.ts.map +1 -1
  55. package/dist/types/src/services/index.d.ts +2 -2
  56. package/dist/types/src/services/index.d.ts.map +1 -1
  57. package/dist/types/src/services/local-function-execution.d.ts +25 -0
  58. package/dist/types/src/services/local-function-execution.d.ts.map +1 -0
  59. package/dist/types/src/services/queues.d.ts +33 -6
  60. package/dist/types/src/services/queues.d.ts.map +1 -1
  61. package/dist/types/src/services/remote-function-execution-service.d.ts +15 -0
  62. package/dist/types/src/services/remote-function-execution-service.d.ts.map +1 -0
  63. package/dist/types/src/services/service-container.d.ts +29 -17
  64. package/dist/types/src/services/service-container.d.ts.map +1 -1
  65. package/dist/types/src/services/service-registry.d.ts +29 -0
  66. package/dist/types/src/services/service-registry.d.ts.map +1 -0
  67. package/dist/types/src/services/service-registry.test.d.ts +2 -0
  68. package/dist/types/src/services/service-registry.test.d.ts.map +1 -0
  69. package/dist/types/src/services/tracing.d.ts +46 -4
  70. package/dist/types/src/services/tracing.d.ts.map +1 -1
  71. package/dist/types/src/testing/index.d.ts +1 -0
  72. package/dist/types/src/testing/index.d.ts.map +1 -1
  73. package/dist/types/src/testing/layer.d.ts +15 -0
  74. package/dist/types/src/testing/layer.d.ts.map +1 -0
  75. package/dist/types/src/testing/logger.d.ts +3 -3
  76. package/dist/types/src/testing/logger.d.ts.map +1 -1
  77. package/dist/types/src/testing/persist-database.test.d.ts +2 -0
  78. package/dist/types/src/testing/persist-database.test.d.ts.map +1 -0
  79. package/dist/types/src/testing/services.d.ts +55 -9
  80. package/dist/types/src/testing/services.d.ts.map +1 -1
  81. package/dist/types/src/trace.d.ts +20 -22
  82. package/dist/types/src/trace.d.ts.map +1 -1
  83. package/dist/types/src/translations.d.ts +9 -9
  84. package/dist/types/src/translations.d.ts.map +1 -1
  85. package/dist/types/src/triggers/index.d.ts +4 -0
  86. package/dist/types/src/triggers/index.d.ts.map +1 -0
  87. package/dist/types/src/triggers/input-builder.d.ts +3 -0
  88. package/dist/types/src/triggers/input-builder.d.ts.map +1 -0
  89. package/dist/types/src/triggers/invocation-tracer.d.ts +35 -0
  90. package/dist/types/src/triggers/invocation-tracer.d.ts.map +1 -0
  91. package/dist/types/src/triggers/trigger-dispatcher.d.ts +75 -0
  92. package/dist/types/src/triggers/trigger-dispatcher.d.ts.map +1 -0
  93. package/dist/types/src/triggers/trigger-dispatcher.test.d.ts +2 -0
  94. package/dist/types/src/triggers/trigger-dispatcher.test.d.ts.map +1 -0
  95. package/dist/types/src/triggers/trigger-state-store.d.ts +27 -0
  96. package/dist/types/src/triggers/trigger-state-store.d.ts.map +1 -0
  97. package/dist/types/src/types.d.ts +55 -245
  98. package/dist/types/src/types.d.ts.map +1 -1
  99. package/dist/types/src/url.d.ts +10 -6
  100. package/dist/types/src/url.d.ts.map +1 -1
  101. package/dist/types/tsconfig.tsbuildinfo +1 -1
  102. package/package.json +35 -25
  103. package/src/bundler/bundler.test.ts +9 -10
  104. package/src/bundler/bundler.ts +56 -35
  105. package/src/edge/functions.ts +9 -6
  106. package/src/errors.ts +21 -0
  107. package/src/examples/fib.ts +30 -0
  108. package/src/examples/index.ts +7 -0
  109. package/src/examples/reply.ts +18 -0
  110. package/src/examples/sleep.ts +22 -0
  111. package/src/executor/executor.ts +22 -15
  112. package/src/handler.ts +117 -27
  113. package/src/index.ts +3 -2
  114. package/src/schema.ts +11 -0
  115. package/src/services/credentials.ts +87 -5
  116. package/src/services/database.ts +146 -3
  117. package/src/services/event-logger.ts +68 -37
  118. package/src/services/index.ts +2 -2
  119. package/src/services/local-function-execution.ts +127 -0
  120. package/src/services/queues.ts +56 -11
  121. package/src/services/remote-function-execution-service.ts +46 -0
  122. package/src/services/service-container.ts +47 -42
  123. package/src/services/service-registry.test.ts +42 -0
  124. package/src/services/service-registry.ts +59 -0
  125. package/src/services/tracing.ts +118 -5
  126. package/src/testing/index.ts +1 -0
  127. package/src/testing/layer.ts +111 -0
  128. package/src/testing/logger.ts +4 -4
  129. package/src/testing/persist-database.test.ts +87 -0
  130. package/src/testing/services.ts +97 -14
  131. package/src/trace.ts +17 -19
  132. package/src/translations.ts +4 -4
  133. package/src/triggers/index.ts +7 -0
  134. package/src/triggers/input-builder.ts +35 -0
  135. package/src/triggers/invocation-tracer.ts +99 -0
  136. package/src/triggers/trigger-dispatcher.test.ts +652 -0
  137. package/src/triggers/trigger-dispatcher.ts +516 -0
  138. package/src/triggers/trigger-state-store.ts +60 -0
  139. package/src/types.ts +39 -36
  140. package/src/url.ts +13 -10
  141. package/dist/lib/browser/chunk-WEFZUEL2.mjs +0 -300
  142. package/dist/lib/browser/chunk-WEFZUEL2.mjs.map +0 -7
  143. package/dist/lib/node/bundler/index.cjs +0 -260
  144. package/dist/lib/node/bundler/index.cjs.map +0 -7
  145. package/dist/lib/node/chunk-IJAE7FZK.cjs +0 -320
  146. package/dist/lib/node/chunk-IJAE7FZK.cjs.map +0 -7
  147. package/dist/lib/node/edge/index.cjs +0 -94
  148. package/dist/lib/node/edge/index.cjs.map +0 -7
  149. package/dist/lib/node/index.cjs +0 -522
  150. package/dist/lib/node/index.cjs.map +0 -7
  151. package/dist/lib/node/meta.json +0 -1
  152. package/dist/lib/node/testing/index.cjs +0 -43
  153. package/dist/lib/node/testing/index.cjs.map +0 -7
  154. package/dist/lib/node-esm/chunk-LIYPMWNQ.mjs +0 -302
  155. package/dist/lib/node-esm/chunk-LIYPMWNQ.mjs.map +0 -7
  156. package/dist/types/src/services/ai.d.ts +0 -12
  157. package/dist/types/src/services/ai.d.ts.map +0 -1
  158. package/dist/types/src/services/function-call-service.d.ts +0 -16
  159. package/dist/types/src/services/function-call-service.d.ts.map +0 -1
  160. package/src/services/ai.ts +0 -32
  161. package/src/services/function-call-service.ts +0 -64
@@ -8,7 +8,7 @@ export declare const ScriptType: Type.obj<Schema.Struct<{
8
8
  name: Schema.optional<typeof Schema.String>;
9
9
  description: Schema.optional<typeof Schema.String>;
10
10
  changed: Schema.optional<typeof Schema.Boolean>;
11
- source: import("@dxos/echo-schema").Ref$<Type.OfKind<Type.Kind.Object> & {
11
+ source: import("@dxos/echo-schema").Ref$<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
12
12
  content: string;
13
13
  }>;
14
14
  }>>;
@@ -18,14 +18,19 @@ export interface ScriptType extends Schema.Schema.Type<typeof ScriptType> {
18
18
  * Function deployment.
19
19
  */
20
20
  export declare const FunctionType: Type.obj<Schema.Struct<{
21
+ /**
22
+ * Global registry ID.
23
+ * NOTE: The `key` property refers to the original registry entry.
24
+ */
25
+ key: Schema.optional<typeof Schema.String>;
21
26
  name: typeof Schema.NonEmptyString;
22
27
  version: typeof Schema.String;
23
28
  description: Schema.optional<typeof Schema.String>;
24
- source: Schema.optional<import("@dxos/echo-schema").Ref$<Type.OfKind<Type.Kind.Object> & {
29
+ source: Schema.optional<import("@dxos/echo-schema").Ref$<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
25
30
  name?: string | undefined;
26
31
  description?: string | undefined;
27
32
  changed?: boolean | undefined;
28
- source: Ref<Type.OfKind<Type.Kind.Object> & {
33
+ source: Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
29
34
  content: string;
30
35
  }>;
31
36
  }>>;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAmC,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGzE;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;GAatB,CAAC;AAEF,MAAM,WAAW,UAAW,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC;CAAG;AAE5E;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;GAsBxB,CAAC;AACF,MAAM,WAAW,YAAa,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC;CAAG"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAmC,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGzE;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;GAatB,CAAC;AAEF,MAAM,WAAW,UAAW,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC;CAAG;AAE5E;;GAEG;AACH,eAAO,MAAM,YAAY;IACvB;;;OAGG;;;;;;;;;;;;;;;;GA6BJ,CAAC;AACF,MAAM,WAAW,YAAa,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC;CAAG"}
@@ -1,12 +1,14 @@
1
- import { Context } 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
- type ServiceCredential = {
7
+ export type ServiceCredential = {
6
8
  service: string;
7
9
  apiKey?: string;
8
10
  };
9
- declare const CredentialsService_base: Context.TagClass<CredentialsService, "CredentialsService", {
11
+ declare const CredentialsService_base: Context.TagClass<CredentialsService, "@dxos/functions/CredentialsService", {
10
12
  /**
11
13
  * Query all.
12
14
  */
@@ -18,6 +20,14 @@ declare const CredentialsService_base: Context.TagClass<CredentialsService, "Cre
18
20
  getCredential: (query: CredentialQuery) => Promise<ServiceCredential>;
19
21
  }>;
20
22
  export declare class CredentialsService extends CredentialsService_base {
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>;
21
31
  }
22
32
  export declare class ConfiguredCredentialsService implements Context.Tag.Service<CredentialsService> {
23
33
  private readonly credentials;
@@ -26,5 +36,9 @@ export declare class ConfiguredCredentialsService implements Context.Tag.Service
26
36
  queryCredentials(query: CredentialQuery): Promise<ServiceCredential[]>;
27
37
  getCredential(query: CredentialQuery): Promise<ServiceCredential>;
28
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>;
29
43
  export {};
30
44
  //# sourceMappingURL=credentials.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../../src/services/credentials.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,KAAK,eAAe,GAAG;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAIF,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAGhB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;;IAKE;;OAEG;sBACe,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAE1E;;;OAGG;mBACY,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,iBAAiB,CAAC;;AAZzE,qBAAa,kBAAmB,SAAQ,uBAcrC;CAAG;AAEN,qBAAa,4BAA6B,YAAW,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC;IAC9E,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,GAAE,iBAAiB,EAAO;IAElE,cAAc,CAAC,WAAW,EAAE,iBAAiB,EAAE,GAAG,4BAA4B;IAKxE,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAItE,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAOxE"}
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../../src/services/credentials.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE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Q,CAAC,WAAW;gBAAX,WAAW,GAAE,iBAAiB,EAAO;IAElE,cAAc,CAAC,WAAW,EAAE,iBAAiB,EAAE,GAAG,4BAA4B;IAKxE,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAItE,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAOxE;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,eAAe,EAAE,OAAO,QAAQ,GAAG,OAAO,4GAOhF,CAAC"}
@@ -1,11 +1,63 @@
1
- import { Context, Layer } from 'effect';
2
- import type { EchoDatabase } from '@dxos/echo-db';
3
- declare const DatabaseService_base: Context.TagClass<DatabaseService, "DatabaseService", {
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';
6
+ import type { DXN } from '@dxos/keys';
7
+ declare const DatabaseService_base: Context.TagClass<DatabaseService, "@dxos/functions/DatabaseService", {
4
8
  readonly db: EchoDatabase;
5
9
  }>;
6
10
  export declare class DatabaseService extends DatabaseService_base {
7
11
  static notAvailable: Layer.Layer<DatabaseService, never, never>;
8
12
  static make: (db: EchoDatabase) => Context.Tag.Service<DatabaseService>;
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>;
45
+ /**
46
+ * Creates a `QueryResult` object that can be subscribed to.
47
+ */
48
+ static query: {
49
+ <Q extends Query.Any>(query: Q): Effect.Effect<QueryResult<Live<Query.Type<Q>>>, never, DatabaseService>;
50
+ <F extends Filter.Any>(filter: F): Effect.Effect<QueryResult<Live<Filter.Type<F>>>, never, DatabaseService>;
51
+ };
52
+ /**
53
+ * Executes the query once and returns the results.
54
+ */
55
+ static runQuery: {
56
+ <Q extends Query.Any>(query: Q): Effect.Effect<OneShotQueryResult<Live<Query.Type<Q>>>, never, DatabaseService>;
57
+ <F extends Filter.Any>(filter: F): Effect.Effect<OneShotQueryResult<Live<Filter.Type<F>>>, never, DatabaseService>;
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>;
9
61
  }
10
62
  export {};
11
63
  //# sourceMappingURL=database.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../../src/services/database.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;;iBAKjC,YAAY;;AAH7B,qBAAa,eAAgB,SAAQ,oBAKlC;IACD,MAAM,CAAC,YAAY,6CAIhB;IAEH,MAAM,CAAC,IAAI,GAAI,IAAI,YAAY,KAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAMpE;CACH"}
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../../src/services/database.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErE,OAAO,EACL,KAAK,MAAM,EACX,KAAK,IAAI,EACT,GAAG,EACH,mBAAmB,EACnB,KAAK,KAAK,EACV,KAAK,GAAG,EACR,KAAK,QAAQ,EACb,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACtH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;;iBAKrB,YAAY;;AAH7B,qBAAa,eAAgB,SAAQ,oBAKlC;IACD,MAAM,CAAC,YAAY,6CAIhB;IAEH,MAAM,CAAC,IAAI,GAAI,IAAI,YAAY,KAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAMpE;IA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AAC,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,37 +1,72 @@
1
- import { Effect, Context } from 'effect';
1
+ import { Context, Effect, Layer, Schema } from 'effect';
2
+ import { Type } from '@dxos/echo';
2
3
  import { LogLevel } from '@dxos/log';
3
- export type ComputeEvent = {
4
- type: 'begin-compute';
5
- nodeId: string;
6
- inputs: Record<string, any>;
7
- } | {
8
- type: 'end-compute';
9
- nodeId: string;
10
- outputs: Record<string, any>;
11
- } | {
12
- type: 'compute-input';
13
- nodeId: string;
14
- property: string;
15
- value: any;
16
- } | {
17
- type: 'compute-output';
18
- nodeId: string;
19
- property: string;
20
- value: any;
21
- } | {
22
- type: 'custom';
23
- nodeId: string;
24
- event: any;
25
- };
26
- declare const EventLogger_base: Context.TagClass<EventLogger, "EventLogger", {
27
- readonly log: (event: ComputeEvent) => void;
4
+ import { TracingService } from './tracing';
5
+ export declare const ComputeEventPayload: Schema.Union<[Schema.Struct<{
6
+ type: Schema.Literal<["begin-compute"]>;
7
+ nodeId: typeof Schema.String;
8
+ inputs: Schema.Record$<typeof Schema.String, typeof Schema.Any>;
9
+ }>, Schema.Struct<{
10
+ type: Schema.Literal<["end-compute"]>;
11
+ nodeId: typeof Schema.String;
12
+ outputs: Schema.Record$<typeof Schema.String, typeof Schema.Any>;
13
+ }>, Schema.Struct<{
14
+ type: Schema.Literal<["compute-input"]>;
15
+ nodeId: typeof Schema.String;
16
+ property: typeof Schema.String;
17
+ value: typeof Schema.Any;
18
+ }>, Schema.Struct<{
19
+ type: Schema.Literal<["compute-output"]>;
20
+ nodeId: typeof Schema.String;
21
+ property: typeof Schema.String;
22
+ value: typeof Schema.Any;
23
+ }>, Schema.Struct<{
24
+ type: Schema.Literal<["custom"]>;
25
+ nodeId: typeof Schema.String;
26
+ event: typeof Schema.Any;
27
+ }>]>;
28
+ export type ComputeEventPayload = Schema.Schema.Type<typeof ComputeEventPayload>;
29
+ export declare const ComputeEvent: Type.obj<Schema.Struct<{
30
+ payload: Schema.Union<[Schema.Struct<{
31
+ type: Schema.Literal<["begin-compute"]>;
32
+ nodeId: typeof Schema.String;
33
+ inputs: Schema.Record$<typeof Schema.String, typeof Schema.Any>;
34
+ }>, Schema.Struct<{
35
+ type: Schema.Literal<["end-compute"]>;
36
+ nodeId: typeof Schema.String;
37
+ outputs: Schema.Record$<typeof Schema.String, typeof Schema.Any>;
38
+ }>, Schema.Struct<{
39
+ type: Schema.Literal<["compute-input"]>;
40
+ nodeId: typeof Schema.String;
41
+ property: typeof Schema.String;
42
+ value: typeof Schema.Any;
43
+ }>, Schema.Struct<{
44
+ type: Schema.Literal<["compute-output"]>;
45
+ nodeId: typeof Schema.String;
46
+ property: typeof Schema.String;
47
+ value: typeof Schema.Any;
48
+ }>, Schema.Struct<{
49
+ type: Schema.Literal<["custom"]>;
50
+ nodeId: typeof Schema.String;
51
+ event: typeof Schema.Any;
52
+ }>]>;
53
+ }>>;
54
+ declare const ComputeEventLogger_base: Context.TagClass<ComputeEventLogger, "@dxos/functions/ComputeEventLogger", {
55
+ readonly log: (event: ComputeEventPayload) => void;
28
56
  readonly nodeId: string | undefined;
29
57
  }>;
30
- export declare class EventLogger extends EventLogger_base {
31
- static noop: Context.Tag.Service<EventLogger>;
58
+ /**
59
+ * Logs event for the compute workflows.
60
+ */
61
+ export declare class ComputeEventLogger extends ComputeEventLogger_base {
62
+ static noop: Context.Tag.Service<ComputeEventLogger>;
63
+ /**
64
+ * Implements ComputeEventLogger using TracingService.
65
+ */
66
+ static layerFromTracing: Layer.Layer<ComputeEventLogger, never, TracingService>;
32
67
  }
33
- export declare const logCustomEvent: (data: any) => Effect.Effect<void, never, EventLogger>;
68
+ export declare const logCustomEvent: (data: any) => Effect.Effect<void, never, ComputeEventLogger>;
34
69
  export declare const createDefectLogger: <A, E, R>() => ((self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>);
35
- export declare const createEventLogger: (level: LogLevel, message?: string) => Context.Tag.Service<EventLogger>;
70
+ export declare const createEventLogger: (level: LogLevel, message?: string) => Context.Tag.Service<ComputeEventLogger>;
36
71
  export {};
37
72
  //# sourceMappingURL=event-logger.d.ts.map
@@ -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,QAAQ,CAAC;AAGzC,OAAO,EAAO,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,MAAM,YAAY,GACpB;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7B,GACD;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B,GACD;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC;CACZ,GACD;IACE,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC;CACZ,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAA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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"}
@@ -1,9 +1,9 @@
1
- export * from './ai';
2
1
  export * from './database';
3
2
  export * from './queues';
4
3
  export * from './service-container';
5
4
  export * from './credentials';
6
5
  export * from './tracing';
7
6
  export * from './event-logger';
8
- export * from './function-call-service';
7
+ export * from './remote-function-execution-service';
8
+ export * from './local-function-execution';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/index.ts"],"names":[],"mappings":"AAIA,cAAc,MAAM,CAAC;AACrB,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,yBAAyB,CAAC"}
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"}
@@ -0,0 +1,25 @@
1
+ import { Context, Effect, Layer } from 'effect';
2
+ import { FunctionNotFoundError } from '../errors';
3
+ import type { FunctionDefinition } from '../handler';
4
+ import type { Services } from './service-container';
5
+ declare const LocalFunctionExecutionService_base: Context.TagClass<LocalFunctionExecutionService, "@dxos/functions/LocalFunctionExecutionService", {
6
+ invokeFunction(functionDef: FunctionDefinition<any, any>, input: unknown): Effect.Effect<unknown, never, Services>;
7
+ }>;
8
+ export declare class LocalFunctionExecutionService extends LocalFunctionExecutionService_base {
9
+ /**
10
+ * @deprecated Use layerLive instead.
11
+ */
12
+ static layer: Layer.Layer<LocalFunctionExecutionService, never, never>;
13
+ static layerLive: Layer.Layer<LocalFunctionExecutionService, never, FunctionImplementationResolver>;
14
+ static invokeFunction: <F extends FunctionDefinition.Any>(functionDef: F, input: FunctionDefinition.Input<F>) => Effect.Effect<FunctionDefinition.Output<F>, never, Services | LocalFunctionExecutionService>;
15
+ }
16
+ declare const FunctionImplementationResolver_base: Context.TagClass<FunctionImplementationResolver, "@dxos/functions/FunctionImplementationResolver", {
17
+ resolveFunctionImplementation(functionDef: FunctionDefinition<any, any>): Effect.Effect<FunctionDefinition<any, any>, FunctionNotFoundError>;
18
+ }>;
19
+ export declare class FunctionImplementationResolver extends FunctionImplementationResolver_base {
20
+ static layerTest: ({ functions }: {
21
+ functions: FunctionDefinition<any, any>[];
22
+ }) => Layer.Layer<FunctionImplementationResolver, never, never>;
23
+ }
24
+ export {};
25
+ //# sourceMappingURL=local-function-execution.d.ts.map
@@ -0,0 +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;AAKxD,OAAO,EAAiB,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAmB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;;gCAOpB,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,SAAS,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC;;AALtH,qBAAa,6BAA8B,SAAQ,kCAOhD;IACD;;OAEG;IACH,MAAM,CAAC,KAAK,2DAET;IAEH,MAAM,CAAC,SAAS,oFAYd;IAEF,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,SAAS,kBAAkB,CAAC,GAAG,EACtD,WAAW,EAAE,CAAC,EACd,KAAK,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,KAC/B,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,GAAG,6BAA6B,CAAC,CACH;CAC/F;;+CAgEkB,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,GACxC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,qBAAqB,CAAC;;AALzE,qBAAa,8BAA+B,SAAQ,mCAOjD;IACD,MAAM,CAAC,SAAS,GAAI,eAAe;QAAE,SAAS,EAAE,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAA;KAAE,+DAS3E;CACN"}
@@ -1,18 +1,45 @@
1
- import { Context, Layer } from 'effect';
2
- import type { Queue, QueueFactory } from '@dxos/echo-db';
3
- declare const QueueService_base: Context.TagClass<QueueService, "QueueService", {
1
+ import { Context, Effect, Layer } from 'effect';
2
+ import type { Obj, Relation } from '@dxos/echo';
3
+ import type { Queue, QueueAPI, QueueFactory } from '@dxos/echo-db';
4
+ import type { DXN, QueueSubspaceTag } from '@dxos/keys';
5
+ declare const QueueService_base: Context.TagClass<QueueService, "@dxos/functions/QueueService", {
4
6
  /**
5
7
  * API to access the queues.
6
8
  */
7
- readonly queues: QueueFactory;
9
+ readonly queues: QueueAPI;
8
10
  /**
9
11
  * The queue that is used to store the context of the current research.
12
+ * @deprecated Use `ContextQueueService` instead.
10
13
  */
11
- readonly contextQueue: Queue | undefined;
14
+ readonly queue: Queue | undefined;
12
15
  }>;
16
+ /**
17
+ * Gives access to all queues.
18
+ */
13
19
  export declare class QueueService extends QueueService_base {
14
20
  static notAvailable: Layer.Layer<QueueService, never, never>;
15
- static make: (queues: QueueFactory, contextQueue: Queue | undefined) => Context.Tag.Service<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>;
34
+ }
35
+ declare const ContextQueueService_base: Context.TagClass<ContextQueueService, "@dxos/functions/ContextQueueService", {
36
+ readonly queue: Queue;
37
+ }>;
38
+ /**
39
+ * Gives access to a specific queue passed as a context.
40
+ */
41
+ export declare class ContextQueueService extends ContextQueueService_base {
42
+ static layer: (queue: Queue) => Layer.Layer<ContextQueueService, never, never>;
16
43
  }
17
44
  export {};
18
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,YAAY,EAAE,MAAM,eAAe,CAAC;;IAKrD;;OAEG;qBACc,YAAY;IAE7B;;OAEG;2BAEoB,KAAK,GAAG,SAAS;;AAZ5C,qBAAa,YAAa,SAAQ,iBAc/B;IACD,MAAM,CAAC,YAAY,0CAKhB;IAEH,MAAM,CAAC,IAAI,GAAI,QAAQ,YAAY,EAAE,cAAc,KAAK,GAAG,SAAS,KAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAKtG;CACH"}
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,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;;IAQpD;;OAEG;qBACc,QAAQ;IAEzB;;;OAGG;oBACa,KAAK,GAAG,SAAS;;AAfrC;;GAEG;AACH,qBAAa,YAAa,SAAQ,iBAc/B;IACD,MAAM,CAAC,YAAY,0CAUhB;IAEH,MAAM,CAAC,IAAI,GAAI,QAAQ,YAAY,EAAE,QAAQ,KAAK,KAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAKpF;IAEF,MAAM,CAAC,KAAK,GAAI,QAAQ,YAAY,EAAE,QAAQ,KAAK,KAAG,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CACf;IAEhE;;OAEG;IACH,MAAM,CAAC,QAAQ,GAAI,CAAC,SAAS,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,EAC1E,KAAK,GAAG,KACP,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAAsE;IAErH;;OAEG;IACH,MAAM,CAAC,WAAW,GAAI,CAAC,SAAS,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,UAAU;QACzF,WAAW,CAAC,EAAE,gBAAgB,CAAC;KAChC,KAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAC2B;IAE3E,MAAM,CAAC,MAAM,GAAI,CAAC,SAAS,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,EACxE,OAAO,KAAK,CAAC,CAAC,CAAC,EACf,SAAS,CAAC,EAAE,KACX,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAgD;CACvE;;oBAQmB,KAAK;;AANzB;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,wBAKtC;IACD,MAAM,CAAC,KAAK,GAAI,OAAO,KAAK,oDAAmD;CAChF"}
@@ -0,0 +1,15 @@
1
+ import { Context, Layer } from 'effect';
2
+ import type { SpaceId } from '@dxos/keys';
3
+ declare const RemoteFunctionExecutionService_base: Context.TagClass<RemoteFunctionExecutionService, "@dxos/functions/RemoteFunctionExecutionService", {
4
+ callFunction(deployedFunctionId: string, input: any, spaceId?: SpaceId): Promise<any>;
5
+ }>;
6
+ /**
7
+ * Allows calling into other functions.
8
+ */
9
+ export declare class RemoteFunctionExecutionService extends RemoteFunctionExecutionService_base {
10
+ static fromClient(baseUrl: string, spaceId: SpaceId): Context.Tag.Service<RemoteFunctionExecutionService>;
11
+ static mock: () => Context.Tag.Service<RemoteFunctionExecutionService>;
12
+ static mockLayer: Layer.Layer<RemoteFunctionExecutionService, never, never>;
13
+ }
14
+ export {};
15
+ //# sourceMappingURL=remote-function-execution-service.d.ts.map
@@ -0,0 +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;;qCAUL,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,34 +1,45 @@
1
- import { Layer, type Context } from 'effect';
2
- import { AiService } from './ai';
1
+ import { type Context, Layer } from 'effect';
2
+ import { AiService } from '@dxos/ai';
3
3
  import { CredentialsService } from './credentials';
4
4
  import { DatabaseService } from './database';
5
- import { EventLogger } from './event-logger';
6
- import { FunctionCallService } from './function-call-service';
5
+ import { ComputeEventLogger } from './event-logger';
7
6
  import { QueueService } from './queues';
7
+ import { RemoteFunctionExecutionService } from './remote-function-execution-service';
8
8
  import { TracingService } from './tracing';
9
9
  /**
10
- * List of all service tags and their names.
10
+ * List of all services.
11
11
  */
12
- export interface ServiceTagRecord {
13
- ai: AiService;
14
- credentials: CredentialsService;
15
- database: DatabaseService;
16
- eventLogger: EventLogger;
17
- functionCallService: FunctionCallService;
18
- tracing: TracingService;
19
- queues: QueueService;
20
- }
12
+ declare const SERVICES: {
13
+ readonly ai: typeof AiService.AiService;
14
+ readonly credentials: typeof CredentialsService;
15
+ readonly database: typeof DatabaseService;
16
+ readonly eventLogger: typeof ComputeEventLogger;
17
+ readonly functionCallService: typeof RemoteFunctionExecutionService;
18
+ readonly queues: typeof QueueService;
19
+ readonly tracing: typeof TracingService;
20
+ };
21
21
  /**
22
- * List of all services and their runtime types.
22
+ * Mapping of service names to their tags.
23
+ */
24
+ export type ServiceTagRecord = {
25
+ [K in keyof typeof SERVICES]: (typeof SERVICES)[K] extends {
26
+ new (_: never): infer T;
27
+ } ? T : never;
28
+ };
29
+ /**
30
+ * Mapping of service names to their runtime types.
23
31
  */
24
32
  export type ServiceRecord = {
25
33
  [K in keyof ServiceTagRecord]: Context.Tag.Service<ServiceTagRecord[K]>;
26
34
  };
27
35
  /**
28
- * Union of all services.
36
+ * Union of all services tags.
29
37
  */
30
38
  export type Services = ServiceTagRecord[keyof ServiceTagRecord];
31
39
  export declare const SERVICE_TAGS: Context.Tag<any, any>[];
40
+ /**
41
+ * @deprecated
42
+ */
32
43
  export declare class ServiceContainer {
33
44
  private _services;
34
45
  /**
@@ -37,8 +48,9 @@ export declare class ServiceContainer {
37
48
  * @returns The container instance.
38
49
  */
39
50
  setServices(services: Partial<ServiceRecord>): this;
40
- getService<T extends Context.Tag<any, any>>(tag: T): Context.Tag.Service<T>;
51
+ getService<Id, T>(tag: Context.Tag<Id, T>): T;
41
52
  clone(): ServiceContainer;
42
53
  createLayer(): Layer.Layer<Services>;
43
54
  }
55
+ export {};
44
56
  //# sourceMappingURL=service-container.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-container.d.ts","sourceRoot":"","sources":["../../../../src/services/service-container.ts"],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AAMhE,eAAO,MAAM,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAA4B,CAAC;AAM7E;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAAmD;IAEpE;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI;IAKnD,UAAU,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC;IAU7C,KAAK,IAAI,gBAAgB;IAKzB,WAAW,IAAI,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC;CAsBrC"}
@@ -0,0 +1,29 @@
1
+ import { Context, Effect, type Option } from 'effect';
2
+ import { ServiceNotAvailableError } from '../errors';
3
+ export declare namespace ServiceRegistry {
4
+ interface Service {
5
+ resolve: <T extends Context.Tag<any, any>>(tag: T) => Option.Option<Context.Tag.Service<T>>;
6
+ }
7
+ }
8
+ declare const ServiceRegistry_base: Context.TagClass<ServiceRegistry, "@dxos/functions/ServiceRegistry", ServiceRegistry.Service>;
9
+ export declare class ServiceRegistry extends ServiceRegistry_base {
10
+ /**
11
+ * Resolves the service from the registry.
12
+ * @param tag Service tag to resolve.
13
+ * @throws {@link ServiceNotAvailableError} if the service is not found.
14
+ * @returns Effect that resolve to the service.
15
+ */
16
+ static resolve: <T extends Context.Tag<any, any>>(tag: T) => Effect.Effect<T, ServiceNotAvailableError, ServiceRegistry>;
17
+ static provide: {
18
+ <Tags extends [Context.Tag<any, any>, ...Context.Tag<any, any>[]]>(...tags: Tags): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E | ServiceNotAvailableError, Exclude<R, {
19
+ [K in keyof Tags]: Context.Tag.Identifier<Tags[K]>;
20
+ }[number]> | ServiceRegistry>;
21
+ };
22
+ static provideOrDie: {
23
+ <Tags extends [Context.Tag<any, any>, ...Context.Tag<any, any>[]]>(...tags: Tags): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, {
24
+ [K in keyof Tags]: Context.Tag.Identifier<Tags[K]>;
25
+ }[number]> | ServiceRegistry>;
26
+ };
27
+ }
28
+ export {};
29
+ //# sourceMappingURL=service-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-registry.d.ts","sourceRoot":"","sources":["../../../../src/services/service-registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAQ,MAAM,QAAQ,CAAC;AAE5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,yBAAiB,eAAe,CAAC;IAC/B,UAAiB,OAAO;QACtB,OAAO,EAAE,CAAC,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;KAC7F;CACF;;AAED,qBAAa,eAAgB,SAAQ,oBAGlC;IACD;;;;;OAKG;IACH,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAC9C,GAAG,EAAE,CAAC,KACH,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,wBAAwB,EAAE,eAAe,CAAC,CAI5D;IAEJ,MAAM,CAAC,OAAO,EAAE;QACd,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,GAAG,wBAAwB,EAC5B,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,CAAoH;IAErH,MAAM,CAAC,YAAY,EAAE;QACnB,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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=service-registry.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-registry.test.d.ts","sourceRoot":"","sources":["../../../../src/services/service-registry.test.ts"],"names":[],"mappings":""}
@@ -1,15 +1,57 @@
1
- import { Context } from 'effect';
2
- import type { AnyEchoObject } from '@dxos/echo-schema';
3
- declare const TracingService_base: Context.TagClass<TracingService, "TracingService", {
1
+ import { Context, Effect, Layer } from 'effect';
2
+ import { AgentStatus } from '@dxos/ai';
3
+ import { Obj } from '@dxos/echo';
4
+ import type { Queue } from '@dxos/echo-db';
5
+ import type { ObjectId } from '@dxos/echo-schema';
6
+ import { DataType } from '@dxos/schema';
7
+ declare const TracingService_base: Context.TagClass<TracingService, "@dxos/functions/TracingService", {
8
+ /**
9
+ * Gets the parent message ID.
10
+ */
11
+ getTraceContext: () => TracingService.TraceContext;
4
12
  /**
5
13
  * Write an event to the tracing queue.
6
14
  * @param event - The event to write. Must be an a typed object.
7
15
  */
8
- write(event: AnyEchoObject): void;
16
+ write: (event: Obj.Any) => void;
9
17
  }>;
18
+ /**
19
+ * Provides a way for compute primitives (functions, workflows, tools)
20
+ * to emit an execution trace as a series of structured ECHO objects.
21
+ */
10
22
  export declare class TracingService extends TracingService_base {
11
23
  static noop: Context.Tag.Service<TracingService>;
24
+ static layerNoop: Layer.Layer<TracingService, never, never>;
12
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>;
33
+ /**
34
+ * Emit the current human-readable execution status.
35
+ */
36
+ static emitStatus: (data: Obj.MakeProps<typeof AgentStatus>) => Effect.Effect<void, never, TracingService>;
37
+ static emitConverationMessage: (data: Obj.MakeProps<typeof DataType.Message>) => Effect.Effect<void, never, TracingService>;
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
+ }
13
51
  }
52
+ /**
53
+ * Goes into {@link DataType.Message['properties']}
54
+ */
55
+ export declare const MESSAGE_PROPERTY_TOOL_CALL_ID: "toolCallId";
14
56
  export {};
15
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,QAAQ,CAAC;AAEjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;;IAKnD;;;OAGG;iBACU,aAAa,GAAG,IAAI;;AAPrC,qBAAa,cAAe,SAAQ,mBASjC;IACD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAuB;IAEvE,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAKjD;CACH"}
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,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;;IASpC;;OAEG;qBACc,MAAM,cAAc,CAAC,YAAY;IAElD;;;OAGG;WACI,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,KAAK,IAAI;;AAhBnC;;;GAGG;AACH,qBAAa,cAAe,SAAQ,mBAcjC;IACD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAoD;IAE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