@dxos/functions 0.8.4-main.b97322e → 0.8.4-main.bc674ce

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 (164) hide show
  1. package/dist/lib/browser/index.mjs +1098 -372
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +1098 -372
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/errors.d.ts +91 -38
  8. package/dist/types/src/errors.d.ts.map +1 -1
  9. package/dist/types/src/example/fib.d.ts +7 -0
  10. package/dist/types/src/example/fib.d.ts.map +1 -0
  11. package/dist/types/src/example/forex-effect.d.ts +3 -0
  12. package/dist/types/src/example/forex-effect.d.ts.map +1 -0
  13. package/dist/types/src/example/index.d.ts +12 -0
  14. package/dist/types/src/example/index.d.ts.map +1 -0
  15. package/dist/types/src/example/reply.d.ts +3 -0
  16. package/dist/types/src/example/reply.d.ts.map +1 -0
  17. package/dist/types/src/example/sleep.d.ts +5 -0
  18. package/dist/types/src/example/sleep.d.ts.map +1 -0
  19. package/dist/types/src/index.d.ts +5 -7
  20. package/dist/types/src/index.d.ts.map +1 -1
  21. package/dist/types/src/operation-compatibility.test.d.ts +2 -0
  22. package/dist/types/src/operation-compatibility.test.d.ts.map +1 -0
  23. package/dist/types/src/protocol/functions-ai-http-client.d.ts +12 -0
  24. package/dist/types/src/protocol/functions-ai-http-client.d.ts.map +1 -0
  25. package/dist/types/src/protocol/index.d.ts +2 -0
  26. package/dist/types/src/protocol/index.d.ts.map +1 -0
  27. package/dist/types/src/protocol/protocol.d.ts +7 -0
  28. package/dist/types/src/protocol/protocol.d.ts.map +1 -0
  29. package/dist/types/src/protocol/protocol.test.d.ts +2 -0
  30. package/dist/types/src/protocol/protocol.test.d.ts.map +1 -0
  31. package/dist/types/src/sdk.d.ts +114 -0
  32. package/dist/types/src/sdk.d.ts.map +1 -0
  33. package/dist/types/src/services/credentials.d.ts +22 -3
  34. package/dist/types/src/services/credentials.d.ts.map +1 -1
  35. package/dist/types/src/services/event-logger.d.ts +74 -30
  36. package/dist/types/src/services/event-logger.d.ts.map +1 -1
  37. package/dist/types/src/services/function-invocation-service.d.ts +16 -0
  38. package/dist/types/src/services/function-invocation-service.d.ts.map +1 -0
  39. package/dist/types/src/services/index.d.ts +5 -5
  40. package/dist/types/src/services/index.d.ts.map +1 -1
  41. package/dist/types/src/services/queues.d.ts +23 -6
  42. package/dist/types/src/services/queues.d.ts.map +1 -1
  43. package/dist/types/src/services/tracing.d.ts +70 -7
  44. package/dist/types/src/services/tracing.d.ts.map +1 -1
  45. package/dist/types/src/types/Function.d.ts +52 -0
  46. package/dist/types/src/types/Function.d.ts.map +1 -0
  47. package/dist/types/src/types/Script.d.ts +21 -0
  48. package/dist/types/src/types/Script.d.ts.map +1 -0
  49. package/dist/types/src/types/Trigger.d.ts +121 -0
  50. package/dist/types/src/types/Trigger.d.ts.map +1 -0
  51. package/dist/types/src/types/TriggerEvent.d.ts +74 -0
  52. package/dist/types/src/types/TriggerEvent.d.ts.map +1 -0
  53. package/dist/types/src/types/index.d.ts +6 -0
  54. package/dist/types/src/types/index.d.ts.map +1 -0
  55. package/dist/types/src/types/url.d.ts +13 -0
  56. package/dist/types/src/types/url.d.ts.map +1 -0
  57. package/dist/types/tsconfig.tsbuildinfo +1 -1
  58. package/package.json +26 -68
  59. package/src/errors.ts +13 -5
  60. package/src/example/fib.ts +32 -0
  61. package/src/example/forex-effect.ts +40 -0
  62. package/src/example/index.ts +13 -0
  63. package/src/example/reply.ts +21 -0
  64. package/src/example/sleep.ts +24 -0
  65. package/src/index.ts +5 -9
  66. package/src/operation-compatibility.test.ts +185 -0
  67. package/src/protocol/functions-ai-http-client.ts +67 -0
  68. package/src/{executor → protocol}/index.ts +1 -1
  69. package/src/protocol/protocol.test.ts +59 -0
  70. package/src/protocol/protocol.ts +262 -0
  71. package/src/sdk.ts +289 -0
  72. package/src/services/credentials.ts +101 -3
  73. package/src/services/event-logger.ts +77 -37
  74. package/src/services/function-invocation-service.ts +37 -0
  75. package/src/services/index.ts +5 -5
  76. package/src/services/queues.ts +37 -10
  77. package/src/services/tracing.ts +142 -17
  78. package/src/types/Function.ts +82 -0
  79. package/src/types/Script.ts +34 -0
  80. package/src/types/Trigger.ts +143 -0
  81. package/src/types/TriggerEvent.ts +62 -0
  82. package/src/types/index.ts +9 -0
  83. package/src/types/url.ts +32 -0
  84. package/dist/lib/browser/bundler/index.mjs +0 -247
  85. package/dist/lib/browser/bundler/index.mjs.map +0 -7
  86. package/dist/lib/browser/chunk-3NGCSUEW.mjs +0 -328
  87. package/dist/lib/browser/chunk-3NGCSUEW.mjs.map +0 -7
  88. package/dist/lib/browser/edge/index.mjs +0 -69
  89. package/dist/lib/browser/edge/index.mjs.map +0 -7
  90. package/dist/lib/browser/testing/index.mjs +0 -91
  91. package/dist/lib/browser/testing/index.mjs.map +0 -7
  92. package/dist/lib/node-esm/bundler/index.mjs +0 -249
  93. package/dist/lib/node-esm/bundler/index.mjs.map +0 -7
  94. package/dist/lib/node-esm/chunk-FJ2MU7TL.mjs +0 -330
  95. package/dist/lib/node-esm/chunk-FJ2MU7TL.mjs.map +0 -7
  96. package/dist/lib/node-esm/edge/index.mjs +0 -71
  97. package/dist/lib/node-esm/edge/index.mjs.map +0 -7
  98. package/dist/lib/node-esm/testing/index.mjs +0 -92
  99. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  100. package/dist/types/src/bundler/bundler.d.ts +0 -50
  101. package/dist/types/src/bundler/bundler.d.ts.map +0 -1
  102. package/dist/types/src/bundler/bundler.test.d.ts +0 -2
  103. package/dist/types/src/bundler/bundler.test.d.ts.map +0 -1
  104. package/dist/types/src/bundler/index.d.ts +0 -2
  105. package/dist/types/src/bundler/index.d.ts.map +0 -1
  106. package/dist/types/src/edge/functions.d.ts +0 -16
  107. package/dist/types/src/edge/functions.d.ts.map +0 -1
  108. package/dist/types/src/edge/index.d.ts +0 -2
  109. package/dist/types/src/edge/index.d.ts.map +0 -1
  110. package/dist/types/src/executor/executor.d.ts +0 -8
  111. package/dist/types/src/executor/executor.d.ts.map +0 -1
  112. package/dist/types/src/executor/index.d.ts +0 -2
  113. package/dist/types/src/executor/index.d.ts.map +0 -1
  114. package/dist/types/src/handler.d.ts +0 -62
  115. package/dist/types/src/handler.d.ts.map +0 -1
  116. package/dist/types/src/schema.d.ts +0 -38
  117. package/dist/types/src/schema.d.ts.map +0 -1
  118. package/dist/types/src/services/database.d.ts +0 -29
  119. package/dist/types/src/services/database.d.ts.map +0 -1
  120. package/dist/types/src/services/function-call-service.d.ts +0 -16
  121. package/dist/types/src/services/function-call-service.d.ts.map +0 -1
  122. package/dist/types/src/services/service-container.d.ts +0 -56
  123. package/dist/types/src/services/service-container.d.ts.map +0 -1
  124. package/dist/types/src/services/service-registry.d.ts +0 -29
  125. package/dist/types/src/services/service-registry.d.ts.map +0 -1
  126. package/dist/types/src/services/service-registry.test.d.ts +0 -2
  127. package/dist/types/src/services/service-registry.test.d.ts.map +0 -1
  128. package/dist/types/src/testing/index.d.ts +0 -3
  129. package/dist/types/src/testing/index.d.ts.map +0 -1
  130. package/dist/types/src/testing/layer.d.ts +0 -10
  131. package/dist/types/src/testing/layer.d.ts.map +0 -1
  132. package/dist/types/src/testing/logger.d.ts +0 -5
  133. package/dist/types/src/testing/logger.d.ts.map +0 -1
  134. package/dist/types/src/testing/services.d.ts +0 -70
  135. package/dist/types/src/testing/services.d.ts.map +0 -1
  136. package/dist/types/src/trace.d.ts +0 -124
  137. package/dist/types/src/trace.d.ts.map +0 -1
  138. package/dist/types/src/translations.d.ts +0 -12
  139. package/dist/types/src/translations.d.ts.map +0 -1
  140. package/dist/types/src/types.d.ts +0 -411
  141. package/dist/types/src/types.d.ts.map +0 -1
  142. package/dist/types/src/url.d.ts +0 -17
  143. package/dist/types/src/url.d.ts.map +0 -1
  144. package/src/bundler/bundler.test.ts +0 -59
  145. package/src/bundler/bundler.ts +0 -292
  146. package/src/bundler/index.ts +0 -5
  147. package/src/edge/functions.ts +0 -64
  148. package/src/edge/index.ts +0 -9
  149. package/src/executor/executor.ts +0 -54
  150. package/src/handler.ts +0 -120
  151. package/src/schema.ts +0 -57
  152. package/src/services/database.ts +0 -70
  153. package/src/services/function-call-service.ts +0 -64
  154. package/src/services/service-container.ts +0 -113
  155. package/src/services/service-registry.test.ts +0 -42
  156. package/src/services/service-registry.ts +0 -56
  157. package/src/testing/index.ts +0 -6
  158. package/src/testing/layer.ts +0 -31
  159. package/src/testing/logger.ts +0 -16
  160. package/src/testing/services.ts +0 -168
  161. package/src/trace.ts +0 -180
  162. package/src/translations.ts +0 -20
  163. package/src/types.ts +0 -211
  164. package/src/url.ts +0 -52
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/services/database.ts", "../../../src/services/queues.ts", "../../../src/services/credentials.ts", "../../../src/services/event-logger.ts", "../../../src/services/function-call-service.ts", "../../../src/services/tracing.ts", "../../../src/services/service-container.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Context, Effect, Layer } from 'effect';\n\nimport type { Filter, Live, Obj, Query, Ref, Relation } from '@dxos/echo';\nimport type { EchoDatabase, OneShotQueryResult, QueryResult } from '@dxos/echo-db';\nimport type { DXN } from '@dxos/keys';\n\nexport class DatabaseService extends Context.Tag('DatabaseService')<\n DatabaseService,\n {\n readonly db: EchoDatabase;\n }\n>() {\n static notAvailable = Layer.succeed(DatabaseService, {\n get db(): EchoDatabase {\n throw new Error('Database not available');\n },\n });\n\n static make = (db: EchoDatabase): Context.Tag.Service<DatabaseService> => {\n return {\n get db() {\n return db;\n },\n };\n };\n\n static resolve: (dxn: DXN) => Effect.Effect<Obj.Any | Relation.Any, Error, DatabaseService> = Effect.fn(\n function* (dxn) {\n const { db } = yield* DatabaseService;\n return yield* Effect.tryPromise({\n try: () =>\n db.graph.createRefResolver({ context: { space: db.spaceId } }).resolve(dxn) as Promise<\n Obj.Any | Relation.Any\n >,\n catch: (error) => error as Error,\n });\n },\n );\n\n static loadRef: <T>(ref: Ref.Ref<T>) => Effect.Effect<T, never, never> = Effect.fn(function* (ref) {\n return yield* Effect.promise(() => ref.load());\n });\n\n /**\n * Creates a `QueryResult` object that can be subscribed to.\n */\n static query: {\n <Q extends Query.Any>(query: Q): Effect.Effect<QueryResult<Live<Query.Type<Q>>>, never, DatabaseService>;\n <F extends Filter.Any>(filter: F): Effect.Effect<QueryResult<Live<Filter.Type<F>>>, never, DatabaseService>;\n } = (queryOrFilter: Query.Any | Filter.Any) =>\n DatabaseService.pipe(\n Effect.map(({ db }) => db.query(queryOrFilter as any)),\n Effect.withSpan('DatabaseService.query'),\n );\n\n /**\n * Executes the query once and returns the results.\n */\n static runQuery: {\n <Q extends Query.Any>(query: Q): Effect.Effect<OneShotQueryResult<Live<Query.Type<Q>>>, never, DatabaseService>;\n <F extends Filter.Any>(filter: F): Effect.Effect<OneShotQueryResult<Live<Filter.Type<F>>>, never, DatabaseService>;\n } = (queryOrFilter: Query.Any | Filter.Any) =>\n DatabaseService.query(queryOrFilter as any).pipe(\n Effect.flatMap((queryResult) => Effect.promise(() => queryResult.run())),\n );\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Context, Layer } from 'effect';\n\nimport type { Queue, QueueAPI, QueueFactory } from '@dxos/echo-db';\n\n/**\n * Gives access to all queues.\n */\nexport class QueueService extends Context.Tag('QueueService')<\n QueueService,\n {\n /**\n * API to access the queues.\n */\n readonly queues: QueueAPI;\n\n /**\n * The queue that is used to store the context of the current research.\n * @deprecated Use `ContextQueueService` instead.\n */\n readonly contextQueue: Queue | undefined;\n }\n>() {\n static notAvailable = Layer.succeed(QueueService, {\n queues: {\n get(dxn) {\n throw new Error('Queues not available');\n },\n create() {\n throw new Error('Queues not available');\n },\n },\n contextQueue: undefined,\n });\n\n static make = (queues: QueueFactory, contextQueue?: Queue): Context.Tag.Service<QueueService> => {\n return {\n queues,\n contextQueue,\n };\n };\n}\n\n/**\n * Gives access to a specific queue passed as a context.\n */\nexport class ContextQueueService extends Context.Tag('ContextQueueService')<\n ContextQueueService,\n {\n readonly contextQueue: Queue;\n }\n>() {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Context, Effect } from 'effect';\n\ntype CredentialQuery = {\n service?: string;\n};\n\n// TODO(dmaretskyi): Unify with other apis.\n// packages/sdk/schema/src/common/access-token.ts\nexport type ServiceCredential = {\n service: string;\n\n // TODO(dmaretskyi): Build out.\n apiKey?: string;\n};\n\nexport class CredentialsService extends Context.Tag('CredentialsService')<\n CredentialsService,\n {\n /**\n * Query all.\n */\n queryCredentials: (query: CredentialQuery) => Promise<ServiceCredential[]>;\n\n /**\n * Get a single credential.\n * @throws {Error} If no credential is found.\n */\n getCredential: (query: CredentialQuery) => Promise<ServiceCredential>;\n }\n>() {\n static getCredential = (query: CredentialQuery): Effect.Effect<ServiceCredential, never, CredentialsService> =>\n Effect.gen(function* () {\n const credentials = yield* CredentialsService;\n return yield* Effect.promise(() => credentials.getCredential(query));\n });\n}\n\nexport class ConfiguredCredentialsService implements Context.Tag.Service<CredentialsService> {\n constructor(private readonly credentials: ServiceCredential[] = []) {}\n\n addCredentials(credentials: ServiceCredential[]): ConfiguredCredentialsService {\n this.credentials.push(...credentials);\n return this;\n }\n\n async queryCredentials(query: CredentialQuery): Promise<ServiceCredential[]> {\n return this.credentials.filter((credential) => credential.service === query.service);\n }\n\n async getCredential(query: CredentialQuery): Promise<ServiceCredential> {\n const credential = this.credentials.find((credential) => credential.service === query.service);\n if (!credential) {\n throw new Error(`Credential not found for service: ${query.service}`);\n }\n return credential;\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Effect, Context } from 'effect';\n\nimport { invariant } from '@dxos/invariant';\nimport { log, LogLevel } from '@dxos/log';\n\nexport type ComputeEvent =\n | {\n type: 'begin-compute';\n nodeId: string;\n inputs: Record<string, any>;\n }\n | {\n type: 'end-compute';\n nodeId: string;\n outputs: Record<string, any>;\n }\n | {\n type: 'compute-input';\n nodeId: string;\n property: string;\n value: any;\n }\n | {\n type: 'compute-output';\n nodeId: string;\n property: string;\n value: any;\n }\n | {\n type: 'custom';\n nodeId: string;\n event: any;\n };\n\nexport class EventLogger extends Context.Tag('EventLogger')<\n EventLogger,\n { readonly log: (event: ComputeEvent) => void; readonly nodeId: string | undefined }\n>() {\n static noop: Context.Tag.Service<EventLogger> = {\n log: () => {},\n nodeId: undefined,\n };\n}\n\nexport const logCustomEvent = (data: any) =>\n Effect.gen(function* () {\n const logger = yield* EventLogger;\n if (!logger.nodeId) {\n throw new Error('logCustomEvent must be called within a node compute function');\n }\n logger.log({\n type: 'custom',\n nodeId: logger.nodeId,\n event: data,\n });\n });\n\nexport const createDefectLogger = <A, E, R>(): ((self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>) =>\n Effect.catchAll((error) =>\n Effect.gen(function* () {\n log.error('unhandled effect error', { error });\n throw error;\n }),\n );\n\nexport const createEventLogger = (level: LogLevel, message: string = 'event'): Context.Tag.Service<EventLogger> => {\n const logFunction = (\n {\n [LogLevel.WARN]: log.warn,\n [LogLevel.VERBOSE]: log.verbose,\n [LogLevel.DEBUG]: log.debug,\n [LogLevel.INFO]: log.info,\n [LogLevel.ERROR]: log.error,\n } as any\n )[level];\n invariant(logFunction);\n return {\n log: (event: ComputeEvent) => {\n logFunction(message, event);\n },\n nodeId: undefined,\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Context } from 'effect';\n\nimport type { SpaceId } from '@dxos/keys';\n\n/**\n * Allows calling into other functions.\n */\nexport class FunctionCallService extends Context.Tag('FunctionCallService')<\n FunctionCallService,\n {\n callFunction(deployedFunctionId: string, input: any, spaceId?: SpaceId): Promise<any>;\n }\n>() {\n static fromClient(baseUrl: string, spaceId: SpaceId): Context.Tag.Service<FunctionCallService> {\n return {\n callFunction: async (deployedFunctionId: string, input: any) => {\n const url = getInvocationUrl(deployedFunctionId, baseUrl, { spaceId });\n const result = await fetch(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(input),\n });\n if (result.status >= 300 || result.status < 200) {\n throw new Error('Failed to invoke function', { cause: new Error(`HTTP error: ${await result.text()}`) });\n }\n return await result.json();\n },\n };\n }\n\n static mock = () => {\n return {\n callFunction: async (deployedFunctionId: string, input: any) => {\n return input;\n },\n };\n };\n}\n\n// TODO(dmaretskyi): Reconcile with `getInvocationUrl` in `@dxos/functions/edge`.\nconst getInvocationUrl = (functionUrl: string, edgeUrl: string, options: InvocationOptions = {}) => {\n const baseUrl = new URL('functions/', edgeUrl);\n\n // Leading slashes cause the URL to be treated as an absolute path.\n const relativeUrl = functionUrl.replace(/^\\//, '');\n const url = new URL(`./${relativeUrl}`, baseUrl.toString());\n options.spaceId && url.searchParams.set('spaceId', options.spaceId);\n options.subjectId && url.searchParams.set('subjectId', options.subjectId);\n url.protocol = isSecure(url.protocol) ? 'https' : 'http';\n return url.toString();\n};\n\nconst isSecure = (protocol: string) => {\n return protocol === 'https:' || protocol === 'wss:';\n};\n\ntype InvocationOptions = {\n spaceId?: SpaceId;\n subjectId?: string;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Context, Effect } from 'effect';\n\nimport { AgentStatus } from '@dxos/ai';\nimport { Obj } from '@dxos/echo';\nimport type { AnyEchoObject } from '@dxos/echo-schema';\n\n/**\n * Provides a way for compute primitives (functions, workflows, tools)\n * to emit an execution trace as a series of structured ECHO objects.\n */\nexport class TracingService extends Context.Tag('TracingService')<\n TracingService,\n {\n /**\n * Write an event to the tracing queue.\n * @param event - The event to write. Must be an a typed object.\n */\n write(event: AnyEchoObject): void;\n }\n>() {\n static noop: Context.Tag.Service<TracingService> = { write: () => {} };\n\n static console: Context.Tag.Service<TracingService> = {\n write: (event) => {\n // eslint-disable-next-line no-console\n console.log(event);\n },\n };\n\n /**\n * Emit the current human-readable execution status.\n */\n static emitStatus: (data: Obj.MakeProps<typeof AgentStatus>) => Effect.Effect<unknown, never, void> =\n Effect.fnUntraced(function* (data) {\n const tracing = yield* TracingService;\n tracing.write(Obj.make(AgentStatus, data));\n });\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Context, Layer } from 'effect';\n\nimport { AiService } from '@dxos/ai';\nimport { entries } from '@dxos/util';\n\nimport { ConfiguredCredentialsService, CredentialsService } from './credentials';\nimport { DatabaseService } from './database';\nimport { EventLogger } from './event-logger';\nimport { FunctionCallService } from './function-call-service';\nimport { QueueService } from './queues';\nimport { TracingService } from './tracing';\n\n// TODO(dmaretskyi): Refactor this module to only rely on tags and not the human-assigned names.\n\n/**\n * List of all services.\n */\nconst SERVICES = {\n ai: AiService,\n credentials: CredentialsService,\n database: DatabaseService,\n eventLogger: EventLogger,\n functionCallService: FunctionCallService,\n queues: QueueService,\n tracing: TracingService,\n} as const satisfies Record<string, Context.TagClass<any, string, any>>;\n\n/**\n * Mapping of service names to their tags.\n */\nexport type ServiceTagRecord = {\n [K in keyof typeof SERVICES]: (typeof SERVICES)[K] extends { new (_: never): infer T } ? T : never;\n};\n\n/**\n * Mapping of service names to their runtime types.\n */\nexport type ServiceRecord = {\n [K in keyof ServiceTagRecord]: Context.Tag.Service<ServiceTagRecord[K]>;\n};\n\n/**\n * Union of all services tags.\n */\nexport type Services = ServiceTagRecord[keyof ServiceTagRecord];\n\nconst SERVICE_MAPPING: Record<string, keyof ServiceRecord> = Object.fromEntries(\n entries(SERVICES).map(([name, tag]) => [tag.key, name]),\n);\n\nexport const SERVICE_TAGS: Context.Tag<any, any>[] = Object.values(SERVICES);\n\nconst DEFAULT_SERVICES: Partial<ServiceRecord> = {\n tracing: TracingService.noop,\n};\n\n/**\n * @deprecated\n */\nexport class ServiceContainer {\n private _services: Partial<ServiceRecord> = { ...DEFAULT_SERVICES };\n\n /**\n * Set services.\n * @param services - Services to set.\n * @returns The container instance.\n */\n setServices(services: Partial<ServiceRecord>): this {\n this._services = { ...this._services, ...services };\n return this;\n }\n\n getService<Id, T>(tag: Context.Tag<Id, T>): T {\n const serviceKey = SERVICE_MAPPING[tag.key];\n const service = serviceKey != null ? this._services[serviceKey] : undefined;\n if (!service) {\n throw new Error(`Service not available: ${tag.key}`);\n }\n\n return service as T;\n }\n\n clone(): ServiceContainer {\n return new ServiceContainer().setServices({ ...this._services });\n }\n\n // TODO(dmaretskyi): `getService` is designed to error at runtime if the service is not available, but layer forces us to provide all services and makes stubs for the ones that are not available.\n createLayer(): Layer.Layer<Services> {\n const ai = this._services.ai != null ? Layer.succeed(AiService, this._services.ai) : AiService.notAvailable;\n const credentials = Layer.succeed(\n CredentialsService,\n this._services.credentials ?? new ConfiguredCredentialsService(),\n );\n const database =\n this._services.database != null\n ? Layer.succeed(DatabaseService, this._services.database)\n : DatabaseService.notAvailable;\n const queues =\n this._services.queues != null ? Layer.succeed(QueueService, this._services.queues) : QueueService.notAvailable;\n const tracing = Layer.succeed(TracingService, this._services.tracing ?? TracingService.noop);\n const eventLogger = Layer.succeed(EventLogger, this._services.eventLogger ?? EventLogger.noop);\n const functionCallService = Layer.succeed(\n FunctionCallService,\n this._services.functionCallService ?? FunctionCallService.mock(),\n );\n\n return Layer.mergeAll(ai, credentials, database, queues, tracing, eventLogger, functionCallService);\n }\n}\n"],
5
- "mappings": ";;;AAIA,SAASA,SAASC,QAAQC,aAAa;AAMhC,IAAMC,kBAAN,MAAMA,yBAAwBC,QAAQC,IAAI,iBAAA,EAAA,EAAA;EAM/C;SAAOC,eAAeC,MAAMC,QAAQL,kBAAiB;MACnD,IAAIM,KAAmB;AACrB,cAAM,IAAIC,MAAM,wBAAA;MAClB;IACF,CAAA;;EAEA;SAAOC,OAAO,CAACF,OAAAA;AACb,aAAO;QACL,IAAIA,KAAK;AACP,iBAAOA;QACT;MACF;IACF;;EAEA;SAAOG,UAAuFC,OAAOC,GACnG,WAAWC,KAAG;AACZ,YAAM,EAAEN,GAAE,IAAK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IAAI;AAC3F,UAAMnB,cAAc+B,OAAMC,QAAQ/B,aAAa,KAAKoB,UAAUrB,eAAeC,YAAYkB,IAAI;AAC7F,UAAMjB,sBAAsB6B,OAAMC,QAChC7B,qBACA,KAAKkB,UAAUnB,uBAAuBC,oBAAoBgC,KAAI,CAAA;AAGhE,WAAOJ,OAAMK,SAAS1C,IAAIE,aAAaE,UAAUM,QAAQE,SAASN,aAAaE,mBAAAA;EACjF;AACF;",
6
- "names": ["Context", "Effect", "Layer", "DatabaseService", "Context", "Tag", "notAvailable", "Layer", "succeed", "db", "Error", "make", "resolve", "Effect", "fn", "dxn", "tryPromise", "try", "graph", "createRefResolver", "context", "space", "spaceId", "catch", "error", "loadRef", "ref", "promise", "load", "query", "queryOrFilter", "pipe", "map", "withSpan", "runQuery", "flatMap", "queryResult", "run", "Context", "Layer", "QueueService", "Context", "Tag", "notAvailable", "Layer", "succeed", "queues", "get", "dxn", "Error", "create", "contextQueue", "undefined", "make", "ContextQueueService", "Context", "Effect", "CredentialsService", "Context", "Tag", "getCredential", "query", "Effect", "gen", "credentials", "promise", "ConfiguredCredentialsService", "addCredentials", "push", "queryCredentials", "filter", "credential", "service", "find", "Error", "Effect", "Context", "invariant", "log", "LogLevel", "EventLogger", "Tag", "noop", "nodeId", "undefined", "logCustomEvent", "data", "gen", "logger", "Error", "type", "event", "createDefectLogger", "catchAll", "error", "createEventLogger", "level", "message", "logFunction", "WARN", "warn", "VERBOSE", "verbose", "DEBUG", "debug", "INFO", "info", "ERROR", "Context", "FunctionCallService", "Context", "Tag", "fromClient", "baseUrl", "spaceId", "callFunction", "deployedFunctionId", "input", "url", "getInvocationUrl", "result", "fetch", "method", "headers", "body", "JSON", "stringify", "status", "Error", "cause", "text", "json", "mock", "functionUrl", "edgeUrl", "options", "URL", "relativeUrl", "replace", "toString", "searchParams", "set", "subjectId", "protocol", "isSecure", "Context", "Effect", "AgentStatus", "Obj", "TracingService", "Context", "Tag", "noop", "write", "console", "event", "log", "emitStatus", "Effect", "fnUntraced", "data", "tracing", "Obj", "make", "AgentStatus", "Layer", "AiService", "entries", "SERVICES", "ai", "AiService", "credentials", "CredentialsService", "database", "DatabaseService", "eventLogger", "EventLogger", "functionCallService", "FunctionCallService", "queues", "QueueService", "tracing", "TracingService", "SERVICE_MAPPING", "Object", "fromEntries", "entries", "map", "name", "tag", "key", "SERVICE_TAGS", "values", "DEFAULT_SERVICES", "noop", "ServiceContainer", "_services", "setServices", "services", "getService", "serviceKey", "service", "undefined", "Error", "clone", "createLayer", "Layer", "succeed", "notAvailable", "ConfiguredCredentialsService", "mock", "mergeAll"]
7
- }
@@ -1,71 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
-
3
- // src/edge/functions.ts
4
- import { createEdgeIdentity } from "@dxos/client/edge";
5
- import { EdgeHttpClient } from "@dxos/edge-client";
6
- import { invariant } from "@dxos/invariant";
7
- import { log } from "@dxos/log";
8
- var __dxlog_file = "/__w/dxos/dxos/packages/core/functions/src/edge/functions.ts";
9
- var uploadWorkerFunction = async ({ client, version, source, name, functionId, ownerPublicKey }) => {
10
- const edgeUrl = client.config.values.runtime?.services?.edge?.url;
11
- invariant(edgeUrl, "Edge is not configured.", {
12
- F: __dxlog_file,
13
- L: 33,
14
- S: void 0,
15
- A: [
16
- "edgeUrl",
17
- "'Edge is not configured.'"
18
- ]
19
- });
20
- const edgeClient = new EdgeHttpClient(edgeUrl);
21
- const edgeIdentity = createEdgeIdentity(client);
22
- edgeClient.setIdentity(edgeIdentity);
23
- const response = await edgeClient.uploadFunction({
24
- functionId
25
- }, {
26
- name,
27
- version,
28
- script: source,
29
- ownerPublicKey: ownerPublicKey.toHex()
30
- });
31
- log.info("Uploaded", {
32
- identityKey: edgeIdentity.identityKey,
33
- functionId,
34
- name,
35
- source: source.length,
36
- response
37
- }, {
38
- F: __dxlog_file,
39
- L: 43,
40
- S: void 0,
41
- C: (f, a) => f(...a)
42
- });
43
- return response;
44
- };
45
- var incrementSemverPatch = (version) => {
46
- const [major, minor, patch] = version.split(".");
47
- const patchNum = Number(patch);
48
- invariant(!Number.isNaN(patchNum), `Unexpected function version format: ${version}`, {
49
- F: __dxlog_file,
50
- L: 57,
51
- S: void 0,
52
- A: [
53
- "!Number.isNaN(patchNum)",
54
- "`Unexpected function version format: ${version}`"
55
- ]
56
- });
57
- return [
58
- major,
59
- minor,
60
- String(patchNum + 1)
61
- ].join(".");
62
- };
63
- var publicKeyToDid = (key) => {
64
- return `did:key:${key.toHex()}`;
65
- };
66
- export {
67
- incrementSemverPatch,
68
- publicKeyToDid,
69
- uploadWorkerFunction
70
- };
71
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/edge/functions.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type DID } from 'iso-did/types';\n\nimport { type Client } from '@dxos/client';\nimport { createEdgeIdentity } from '@dxos/client/edge';\nimport { EdgeHttpClient } from '@dxos/edge-client';\nimport { invariant } from '@dxos/invariant';\nimport { type PublicKey } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { type UploadFunctionResponseBody } from '@dxos/protocols';\n\nexport type UploadWorkerArgs = {\n client: Client;\n source: string;\n version: string;\n name?: string;\n functionId?: string;\n ownerPublicKey: PublicKey;\n};\n\nexport const uploadWorkerFunction = async ({\n client,\n version,\n source,\n name,\n functionId,\n ownerPublicKey,\n}: UploadWorkerArgs): Promise<UploadFunctionResponseBody> => {\n const edgeUrl = client.config.values.runtime?.services?.edge?.url;\n invariant(edgeUrl, 'Edge is not configured.');\n const edgeClient = new EdgeHttpClient(edgeUrl);\n const edgeIdentity = createEdgeIdentity(client);\n edgeClient.setIdentity(edgeIdentity);\n const response = await edgeClient.uploadFunction(\n { functionId },\n { name, version, script: source, ownerPublicKey: ownerPublicKey.toHex() },\n );\n\n // TODO(burdon): Edge service log.\n log.info('Uploaded', {\n identityKey: edgeIdentity.identityKey,\n functionId,\n name,\n source: source.length,\n response,\n });\n\n return response;\n};\n\nexport const incrementSemverPatch = (version: string): string => {\n const [major, minor, patch] = version.split('.');\n const patchNum = Number(patch);\n invariant(!Number.isNaN(patchNum), `Unexpected function version format: ${version}`);\n return [major, minor, String(patchNum + 1)].join('.');\n};\n\n// TODO(burdon): Factor out.\nexport const publicKeyToDid = (key: PublicKey): DID => {\n return `did:key:${key.toHex()}`;\n};\n"],
5
- "mappings": ";;;AAOA,SAASA,0BAA0B;AACnC,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;AAE1B,SAASC,WAAW;;AAYb,IAAMC,uBAAuB,OAAO,EACzCC,QACAC,SACAC,QACAC,MACAC,YACAC,eAAc,MACG;AACjB,QAAMC,UAAUN,OAAOO,OAAOC,OAAOC,SAASC,UAAUC,MAAMC;AAC9Df,YAAUS,SAAS,2BAAA;;;;;;;;;AACnB,QAAMO,aAAa,IAAIjB,eAAeU,OAAAA;AACtC,QAAMQ,eAAenB,mBAAmBK,MAAAA;AACxCa,aAAWE,YAAYD,YAAAA;AACvB,QAAME,WAAW,MAAMH,WAAWI,eAChC;IAAEb;EAAW,GACb;IAAED;IAAMF;IAASiB,QAAQhB;IAAQG,gBAAgBA,eAAec,MAAK;EAAG,CAAA;AAI1ErB,MAAIsB,KAAK,YAAY;IACnBC,aAAaP,aAAaO;IAC1BjB;IACAD;IACAD,QAAQA,OAAOoB;IACfN;EACF,GAAA;;;;;;AAEA,SAAOA;AACT;AAEO,IAAMO,uBAAuB,CAACtB,YAAAA;AACnC,QAAM,CAACuB,OAAOC,OAAOC,KAAAA,IAASzB,QAAQ0B,MAAM,GAAA;AAC5C,QAAMC,WAAWC,OAAOH,KAAAA;AACxB7B,YAAU,CAACgC,OAAOC,MAAMF,QAAAA,GAAW,uCAAuC3B,OAAAA,IAAS;;;;;;;;;AACnF,SAAO;IAACuB;IAAOC;IAAOM,OAAOH,WAAW,CAAA;IAAII,KAAK,GAAA;AACnD;AAGO,IAAMC,iBAAiB,CAACC,QAAAA;AAC7B,SAAO,WAAWA,IAAIf,MAAK,CAAA;AAC7B;",
6
- "names": ["createEdgeIdentity", "EdgeHttpClient", "invariant", "log", "uploadWorkerFunction", "client", "version", "source", "name", "functionId", "ownerPublicKey", "edgeUrl", "config", "values", "runtime", "services", "edge", "url", "edgeClient", "edgeIdentity", "setIdentity", "response", "uploadFunction", "script", "toHex", "info", "identityKey", "length", "incrementSemverPatch", "major", "minor", "patch", "split", "patchNum", "Number", "isNaN", "String", "join", "publicKeyToDid", "key"]
7
- }
@@ -1,92 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- ConfiguredCredentialsService,
4
- DatabaseService,
5
- QueueService,
6
- ServiceContainer,
7
- createEventLogger
8
- } from "../chunk-FJ2MU7TL.mjs";
9
-
10
- // src/testing/services.ts
11
- import { AiService, EdgeAiServiceClient } from "@dxos/ai";
12
- import { AI_SERVICE_ENDPOINT, createTestAiServiceClient } from "@dxos/ai/testing";
13
- import { assertArgument } from "@dxos/invariant";
14
-
15
- // src/testing/logger.ts
16
- import { Effect } from "effect";
17
- import { LogLevel } from "@dxos/log";
18
- var noopLogger = {
19
- log: () => Effect.succeed(void 0),
20
- nodeId: void 0
21
- };
22
- var consoleLogger = createEventLogger(LogLevel.INFO);
23
-
24
- // src/testing/services.ts
25
- var createTestServices = ({ ai, credentials, db, logging, queues, space, tracing } = {}) => {
26
- assertArgument(!(!!space && (!!db || !!queues)), "space can be provided only if db and queues are not");
27
- return new ServiceContainer().setServices({
28
- ai: createAiService(ai),
29
- credentials: createCredentialsService(credentials),
30
- database: space || db ? DatabaseService.make(space?.db || db) : void 0,
31
- eventLogger: logging?.logger ?? logging?.enabled ? consoleLogger : noopLogger,
32
- queues: space || queues ? QueueService.make(space?.queues || queues, void 0) : void 0,
33
- tracing: tracing?.service
34
- });
35
- };
36
- var createAiService = (ai) => {
37
- if (ai?.client != null) {
38
- return AiService.make(ai.client);
39
- }
40
- if (ai?.endpoint != null) {
41
- return AiService.make(new EdgeAiServiceClient({
42
- endpoint: ai.endpoint
43
- }));
44
- }
45
- switch (ai?.provider) {
46
- case "dev":
47
- return AiService.make(new EdgeAiServiceClient({
48
- endpoint: AI_SERVICE_ENDPOINT.LOCAL,
49
- defaultGenerationOptions: {
50
- model: "@anthropic/claude-3-5-sonnet-20241022"
51
- }
52
- }));
53
- case "edge":
54
- return AiService.make(new EdgeAiServiceClient({
55
- endpoint: AI_SERVICE_ENDPOINT.REMOTE,
56
- defaultGenerationOptions: {
57
- model: "@anthropic/claude-3-5-sonnet-20241022"
58
- }
59
- }));
60
- case "ollama":
61
- return AiService.make(createTestAiServiceClient());
62
- case "lmstudio":
63
- throw new Error("LMStudio is not supported");
64
- }
65
- };
66
- var createCredentialsService = (credentials) => {
67
- if (credentials?.services) {
68
- return new ConfiguredCredentialsService(credentials.services);
69
- }
70
- if (credentials?.service) {
71
- return credentials.service;
72
- }
73
- };
74
-
75
- // src/testing/layer.ts
76
- import { Context, Effect as Effect2, Layer } from "effect";
77
- import { EchoTestBuilder } from "@dxos/echo-db/testing";
78
- import { accuireReleaseResource } from "@dxos/effect";
79
- var testBuilder = accuireReleaseResource(() => new EchoTestBuilder());
80
- var TestDatabaseLayer = ({ indexing, types } = {}) => Layer.scopedContext(Effect2.gen(function* () {
81
- const builder = yield* testBuilder;
82
- const { db, queues } = yield* Effect2.promise(() => builder.createDatabase({
83
- indexing,
84
- types
85
- }));
86
- return Context.mergeAll(Context.make(DatabaseService, DatabaseService.make(db)), Context.make(QueueService, QueueService.make(queues, void 0)));
87
- }));
88
- export {
89
- TestDatabaseLayer,
90
- createTestServices
91
- };
92
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/testing/services.ts", "../../../../src/testing/logger.ts", "../../../../src/testing/layer.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Context } from 'effect';\n\nimport { AiService, type AiServiceClient, type AiServiceEdgeClientOptions, EdgeAiServiceClient } from '@dxos/ai';\nimport { AI_SERVICE_ENDPOINT, createTestAiServiceClient } from '@dxos/ai/testing';\nimport type { Space } from '@dxos/client/echo';\nimport type { EchoDatabase, QueueFactory } from '@dxos/echo-db';\nimport { assertArgument } from '@dxos/invariant';\n\nimport { consoleLogger, noopLogger } from './logger';\nimport {\n ConfiguredCredentialsService,\n type CredentialsService,\n DatabaseService,\n type EventLogger,\n QueueService,\n ServiceContainer,\n type ServiceCredential,\n type TracingService,\n} from '../services';\n\n// TODO(burdon): Factor out.\nexport type OneOf<T> = {\n [K in keyof T]: { [P in K]: T[P] } & { [P in Exclude<keyof T, K>]?: never };\n}[keyof T];\n\nexport type AiServiceProvider = 'dev' | 'edge' | 'ollama' | 'lmstudio';\n\nexport type TestServiceOptions = {\n /**\n * AI service configuration.\n */\n ai?: OneOf<{\n /**\n * Custom AI service client.\n */\n client?: AiServiceClient;\n\n /**\n * Edge AI service at specified endpoint.\n */\n endpoint?: AiServiceEdgeClientOptions['endpoint'];\n\n /**\n * Predefined AI service configuration.\n */\n // TODO(burdon): 'dev' and 'edge' are redundant with providing an endpoint.\n provider?: AiServiceProvider;\n }>;\n\n /**\n * Credentials service configuration.\n */\n credentials?: OneOf<{\n /**\n * Predefined credentials list.\n */\n services?: ServiceCredential[];\n\n /**\n * Custom credentials service.\n */\n service?: Context.Tag.Service<CredentialsService>;\n }>;\n\n /**\n * Database configuration.\n */\n db?: EchoDatabase;\n\n /**\n * Gets database and queue services from the space.\n * Exclusive with: `db`, `queues`\n */\n space?: Space;\n\n /**\n * Logging configuration.\n */\n logging?: {\n enabled?: boolean;\n logger?: Context.Tag.Service<EventLogger>;\n };\n\n /**\n * Queue service configuration.\n */\n queues?: QueueFactory;\n\n tracing?: {\n service?: Context.Tag.Service<TracingService>;\n };\n};\n\nexport const createTestServices = ({\n ai,\n credentials,\n db,\n logging,\n queues,\n space,\n tracing,\n}: TestServiceOptions = {}): ServiceContainer => {\n assertArgument(!(!!space && (!!db || !!queues)), 'space can be provided only if db and queues are not');\n\n return new ServiceContainer().setServices({\n ai: createAiService(ai),\n credentials: createCredentialsService(credentials),\n database: space || db ? DatabaseService.make(space?.db || db!) : undefined,\n eventLogger: (logging?.logger ?? logging?.enabled) ? consoleLogger : noopLogger,\n queues: space || queues ? QueueService.make(space?.queues || queues!, undefined) : undefined,\n tracing: tracing?.service,\n });\n};\n\n// TODO(burdon): Enable model configuration.\nconst createAiService = (ai: TestServiceOptions['ai']): Context.Tag.Service<AiService> | undefined => {\n if (ai?.client != null) {\n return AiService.make(ai.client);\n }\n\n if (ai?.endpoint != null) {\n return AiService.make(new EdgeAiServiceClient({ endpoint: ai.endpoint }));\n }\n\n switch (ai?.provider) {\n case 'dev':\n return AiService.make(\n new EdgeAiServiceClient({\n endpoint: AI_SERVICE_ENDPOINT.LOCAL,\n defaultGenerationOptions: {\n model: '@anthropic/claude-3-5-sonnet-20241022',\n },\n }),\n );\n\n case 'edge':\n return AiService.make(\n new EdgeAiServiceClient({\n endpoint: AI_SERVICE_ENDPOINT.REMOTE,\n defaultGenerationOptions: {\n model: '@anthropic/claude-3-5-sonnet-20241022',\n },\n }),\n );\n\n case 'ollama':\n return AiService.make(createTestAiServiceClient());\n\n case 'lmstudio':\n throw new Error('LMStudio is not supported');\n }\n};\n\nconst createCredentialsService = (\n credentials: TestServiceOptions['credentials'] | undefined,\n): Context.Tag.Service<CredentialsService> | undefined => {\n if (credentials?.services) {\n return new ConfiguredCredentialsService(credentials.services);\n }\n\n if (credentials?.service) {\n return credentials.service;\n }\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Effect, type Context } from 'effect';\n\nimport { LogLevel } from '@dxos/log';\n\nimport { type EventLogger, createEventLogger } from '../services';\n\nexport const noopLogger: Context.Tag.Service<EventLogger> = {\n log: () => Effect.succeed(undefined),\n nodeId: undefined,\n};\n\nexport const consoleLogger: Context.Tag.Service<EventLogger> = createEventLogger(LogLevel.INFO);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Context, Effect, Layer } from 'effect';\nimport type { Schema } from 'effect';\n\nimport { EchoTestBuilder } from '@dxos/echo-db/testing';\nimport type { EchoHostIndexingConfig } from '@dxos/echo-pipeline';\nimport { accuireReleaseResource } from '@dxos/effect';\n\nimport { DatabaseService, QueueService } from '../services';\n\nconst testBuilder = accuireReleaseResource(() => new EchoTestBuilder());\n\nexport type TestDatabaseOptions = {\n indexing?: Partial<EchoHostIndexingConfig>;\n types?: Schema.Schema.AnyNoContext[];\n};\n\nexport const TestDatabaseLayer = ({ indexing, types }: TestDatabaseOptions = {}) =>\n Layer.scopedContext(\n Effect.gen(function* () {\n const builder = yield* testBuilder;\n const { db, queues } = yield* Effect.promise(() => builder.createDatabase({ indexing, types }));\n return Context.mergeAll(\n Context.make(DatabaseService, DatabaseService.make(db)),\n Context.make(QueueService, QueueService.make(queues, undefined)),\n );\n }),\n );\n"],
5
- "mappings": ";;;;;;;;;;AAMA,SAASA,WAAkEC,2BAA2B;AACtG,SAASC,qBAAqBC,iCAAiC;AAG/D,SAASC,sBAAsB;;;ACN/B,SAASC,cAA4B;AAErC,SAASC,gBAAgB;AAIlB,IAAMC,aAA+C;EAC1DC,KAAK,MAAMC,OAAOC,QAAQC,MAAAA;EAC1BC,QAAQD;AACV;AAEO,IAAME,gBAAkDC,kBAAkBC,SAASC,IAAI;;;ADkFvF,IAAMC,qBAAqB,CAAC,EACjCC,IACAC,aACAC,IACAC,SACAC,QACAC,OACAC,QAAO,IACe,CAAC,MAAC;AACxBC,iBAAe,EAAE,CAAC,CAACF,UAAU,CAAC,CAACH,MAAM,CAAC,CAACE,UAAU,qDAAA;AAEjD,SAAO,IAAII,iBAAAA,EAAmBC,YAAY;IACxCT,IAAIU,gBAAgBV,EAAAA;IACpBC,aAAaU,yBAAyBV,WAAAA;IACtCW,UAAUP,SAASH,KAAKW,gBAAgBC,KAAKT,OAAOH,MAAMA,EAAAA,IAAOa;IACjEC,aAAcb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UAAU,OAAOV;AACvB,QAAM,EAAEW,IAAIC,OAAM,IAAK,OAAOJ,QAAOK,QAAQ,MAAMH,QAAQI,eAAe;IAAEV;IAAUC;EAAM,CAAA,CAAA;AAC5F,SAAOU,QAAQC,SACbD,QAAQE,KAAKC,iBAAiBA,gBAAgBD,KAAKN,EAAAA,CAAAA,GACnDI,QAAQE,KAAKE,cAAcA,aAAaF,KAAKL,QAAQQ,MAAAA,CAAAA,CAAAA;AAEzD,CAAA,CAAA;",
6
- "names": ["AiService", "EdgeAiServiceClient", "AI_SERVICE_ENDPOINT", "createTestAiServiceClient", "assertArgument", "Effect", "LogLevel", "noopLogger", "log", "Effect", "succeed", "undefined", "nodeId", "consoleLogger", "createEventLogger", "LogLevel", "INFO", "createTestServices", "ai", "credentials", "db", "logging", "queues", "space", "tracing", "assertArgument", "ServiceContainer", "setServices", "createAiService", "createCredentialsService", "database", "DatabaseService", "make", "undefined", "eventLogger", "logger", "enabled", "consoleLogger", "noopLogger", "QueueService", "service", "client", "AiService", "endpoint", "EdgeAiServiceClient", "provider", "AI_SERVICE_ENDPOINT", "LOCAL", "defaultGenerationOptions", "model", "REMOTE", "createTestAiServiceClient", "Error", "services", "ConfiguredCredentialsService", "Context", "Effect", "Layer", "EchoTestBuilder", "accuireReleaseResource", "testBuilder", "accuireReleaseResource", "EchoTestBuilder", "TestDatabaseLayer", "indexing", "types", "Layer", "scopedContext", "Effect", "gen", "builder", "db", "queues", "promise", "createDatabase", "Context", "mergeAll", "make", "DatabaseService", "QueueService", "undefined"]
7
- }
@@ -1,50 +0,0 @@
1
- import { type BuildOptions, type BuildResult } from 'esbuild-wasm';
2
- export type Import = {
3
- moduleUrl: string;
4
- defaultImport: boolean;
5
- namedImports: string[];
6
- };
7
- export type BundleOptions = {
8
- /**
9
- * Path to the source file on the local file system.
10
- * If provided, the path will be used instead of the `source` code.
11
- */
12
- path?: string;
13
- /**
14
- * Source code to bundle.
15
- * Required if `path` is not provided.
16
- */
17
- source?: string;
18
- };
19
- export type BundleResult = {
20
- timestamp: number;
21
- sourceHash?: Buffer;
22
- imports?: Import[];
23
- bundle?: string;
24
- error?: any;
25
- };
26
- export type BundlerOptions = {
27
- platform: BuildOptions['platform'];
28
- sandboxedModules: string[];
29
- remoteModules: Record<string, string>;
30
- };
31
- export declare const initializeBundler: (options: {
32
- wasmUrl: string;
33
- }) => Promise<void>;
34
- /**
35
- * ESBuild bundler.
36
- */
37
- export declare class Bundler {
38
- private readonly _options;
39
- constructor(_options: BundlerOptions);
40
- bundle({ path, source }: BundleOptions): Promise<BundleResult>;
41
- analyzeImports(result: BuildResult): Import[];
42
- analyzeSourceFileImports(code: string): {
43
- defaultImportName: string;
44
- namedImports: string[];
45
- wildcardImportName: string;
46
- moduleIdentifier: string;
47
- quotes: string;
48
- }[];
49
- }
50
- //# sourceMappingURL=bundler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../../../../src/bundler/bundler.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,YAAY,EAAkC,KAAK,WAAW,EAAe,MAAM,cAAc,CAAC;AAOhH,MAAM,MAAM,MAAM,GAAG;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;IACnC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC,CAAC;AAGF,eAAO,MAAM,iBAAiB,GAAU,SAAS;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,kBAInE,CAAC;AAEF;;GAEG;AACH,qBAAa,OAAO;IACN,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,cAAc;IAE/C,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAwFpE,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE;IA2B7C,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG;QACtC,iBAAiB,EAAE,MAAM,CAAC;QAC1B,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,gBAAgB,EAAE,MAAM,CAAC;QACzB,MAAM,EAAE,MAAM,CAAC;KAChB,EAAE;CAaJ"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=bundler.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundler.test.d.ts","sourceRoot":"","sources":["../../../../src/bundler/bundler.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export * from './bundler';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bundler/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
@@ -1,16 +0,0 @@
1
- import { type DID } from 'iso-did/types';
2
- import { type Client } from '@dxos/client';
3
- import { type PublicKey } from '@dxos/keys';
4
- import { type UploadFunctionResponseBody } from '@dxos/protocols';
5
- export type UploadWorkerArgs = {
6
- client: Client;
7
- source: string;
8
- version: string;
9
- name?: string;
10
- functionId?: string;
11
- ownerPublicKey: PublicKey;
12
- };
13
- export declare const uploadWorkerFunction: ({ client, version, source, name, functionId, ownerPublicKey, }: UploadWorkerArgs) => Promise<UploadFunctionResponseBody>;
14
- export declare const incrementSemverPatch: (version: string) => string;
15
- export declare const publicKeyToDid: (key: PublicKey) => DID;
16
- //# sourceMappingURL=functions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../../src/edge/functions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAElE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,SAAS,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAU,gEAOxC,gBAAgB,KAAG,OAAO,CAAC,0BAA0B,CAqBvD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,KAAG,MAKtD,CAAC;AAGF,eAAO,MAAM,cAAc,GAAI,KAAK,SAAS,KAAG,GAE/C,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './functions';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/edge/index.ts"],"names":[],"mappings":"AAQA,cAAc,aAAa,CAAC"}
@@ -1,8 +0,0 @@
1
- import type { FunctionDefinition } from '../handler';
2
- import type { ServiceContainer } from '../services';
3
- export declare class FunctionExecutor {
4
- private readonly _services;
5
- constructor(_services: ServiceContainer);
6
- invoke<F extends FunctionDefinition<any, any>>(fnDef: F, input: F extends FunctionDefinition<infer I, infer _O> ? I : never): Promise<F extends FunctionDefinition<infer _I, infer O> ? O : never>;
7
- }
8
- //# sourceMappingURL=executor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../src/executor/executor.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAmB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAY,MAAM,aAAa,CAAC;AAE9D,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,gBAAgB;IAGlD,MAAM,CAAC,CAAC,SAAS,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,EACjD,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,CAAC,SAAS,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,GACjE,OAAO,CAAC,CAAC,SAAS,kBAAkB,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;CAkCxE"}
@@ -1,2 +0,0 @@
1
- export * from './executor';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/executor/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC"}
@@ -1,62 +0,0 @@
1
- import { Schema, type Context, type Effect } from 'effect';
2
- import { type AiServiceClient } from '@dxos/ai';
3
- import type { EchoDatabase } from '@dxos/echo-db';
4
- import { type HasId } from '@dxos/echo-schema';
5
- import { type SpaceId, type DXN } from '@dxos/keys';
6
- import { type QueryResult } from '@dxos/protocols';
7
- import type { Services } from './services';
8
- /**
9
- * Function handler.
10
- */
11
- export type FunctionHandler<TData = {}, TOutput = any> = (params: {
12
- /**
13
- * Services and context available to the function.
14
- */
15
- context: FunctionContext;
16
- /**
17
- * Data passed as the input to the function.
18
- * Must match the function's input schema.
19
- * This will be the payload from the trigger or other data passed into the function in a workflow.
20
- */
21
- data: TData;
22
- }) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any, Services>;
23
- /**
24
- * Function context.
25
- */
26
- export interface FunctionContext {
27
- /**
28
- * Space from which the function was invoked.
29
- */
30
- space: SpaceAPI | undefined;
31
- ai: AiServiceClient;
32
- /**
33
- * Resolves a service available to the function.
34
- * @throws if the service is not available.
35
- */
36
- getService: <T extends Context.Tag<any, any>>(tag: T) => Context.Tag.Service<T>;
37
- getSpace: (spaceId: SpaceId) => Promise<SpaceAPI>;
38
- }
39
- export interface FunctionContextAi {
40
- run(model: string, inputs: any, options?: any): Promise<any>;
41
- }
42
- export interface QueuesAPI {
43
- queryQueue(queue: DXN, options?: {}): Promise<QueryResult>;
44
- insertIntoQueue(queue: DXN, objects: HasId[]): Promise<void>;
45
- }
46
- /**
47
- * Space interface available to functions.
48
- */
49
- export interface SpaceAPI {
50
- get id(): SpaceId;
51
- get db(): EchoDatabase;
52
- get queues(): QueuesAPI;
53
- }
54
- export type FunctionDefinition<T = {}, O = any> = {
55
- name: string;
56
- description?: string;
57
- inputSchema: Schema.Schema<T, any>;
58
- outputSchema?: Schema.Schema<O, any>;
59
- handler: FunctionHandler<T, O>;
60
- };
61
- export declare const defineFunction: <T, O>({ name, description, inputSchema, outputSchema, handler, }: FunctionDefinition<T, O>) => FunctionDefinition<T, O>;
62
- //# sourceMappingURL=handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/handler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAA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QD,MAAM,WAAW,SAAS;IACxB,UAAU,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3D,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,IAAI,OAAO,CAAC;IAClB,IAAI,EAAE,IAAI,YAAY,CAAC;IAGvB,IAAI,MAAM,IAAI,SAAS,CAAC;CACzB;AAOD,MAAM,MAAM,kBAAkB,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACrC,OAAO,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAChC,CAAC;AAGF,eAAO,MAAM,cAAc,GAAI,CAAC,EAAE,CAAC,EAAE,4DAMlC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAepD,CAAC"}
@@ -1,38 +0,0 @@
1
- import { Schema } from 'effect';
2
- import { Type } from '@dxos/echo';
3
- import { Ref } from '@dxos/echo-schema';
4
- /**
5
- * Source script.
6
- */
7
- export declare const ScriptType: Type.obj<Schema.Struct<{
8
- name: Schema.optional<typeof Schema.String>;
9
- description: Schema.optional<typeof Schema.String>;
10
- changed: Schema.optional<typeof Schema.Boolean>;
11
- source: import("@dxos/echo-schema").Ref$<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
12
- content: string;
13
- }>;
14
- }>>;
15
- export interface ScriptType extends Schema.Schema.Type<typeof ScriptType> {
16
- }
17
- /**
18
- * Function deployment.
19
- */
20
- export declare const FunctionType: Type.obj<Schema.Struct<{
21
- name: typeof Schema.NonEmptyString;
22
- version: typeof Schema.String;
23
- description: Schema.optional<typeof Schema.String>;
24
- source: Schema.optional<import("@dxos/echo-schema").Ref$<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
25
- description?: string | undefined;
26
- name?: string | undefined;
27
- changed?: boolean | undefined;
28
- source: Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
29
- content: string;
30
- }>;
31
- }>>;
32
- inputSchema: Schema.optional<Schema.Schema<Type.JsonSchema, Type.JsonSchema, never>>;
33
- outputSchema: Schema.optional<Schema.Schema<Type.JsonSchema, Type.JsonSchema, never>>;
34
- binding: Schema.optional<typeof Schema.String>;
35
- }>>;
36
- export interface FunctionType extends Schema.Schema.Type<typeof FunctionType> {
37
- }
38
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
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,29 +0,0 @@
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';
4
- import type { DXN } from '@dxos/keys';
5
- declare const DatabaseService_base: Context.TagClass<DatabaseService, "DatabaseService", {
6
- readonly db: EchoDatabase;
7
- }>;
8
- export declare class DatabaseService extends DatabaseService_base {
9
- static notAvailable: Layer.Layer<DatabaseService, never, never>;
10
- static make: (db: EchoDatabase) => Context.Tag.Service<DatabaseService>;
11
- static resolve: (dxn: DXN) => Effect.Effect<Obj.Any | Relation.Any, Error, DatabaseService>;
12
- static loadRef: <T>(ref: Ref.Ref<T>) => Effect.Effect<T, never, never>;
13
- /**
14
- * Creates a `QueryResult` object that can be subscribed to.
15
- */
16
- static query: {
17
- <Q extends Query.Any>(query: Q): Effect.Effect<QueryResult<Live<Query.Type<Q>>>, never, DatabaseService>;
18
- <F extends Filter.Any>(filter: F): Effect.Effect<QueryResult<Live<Filter.Type<F>>>, never, DatabaseService>;
19
- };
20
- /**
21
- * Executes the query once and returns the results.
22
- */
23
- static runQuery: {
24
- <Q extends Query.Any>(query: Q): Effect.Effect<OneShotQueryResult<Live<Query.Type<Q>>>, never, DatabaseService>;
25
- <F extends Filter.Any>(filter: F): Effect.Effect<OneShotQueryResult<Live<Filter.Type<F>>>, never, DatabaseService>;
26
- };
27
- }
28
- export {};
29
- //# sourceMappingURL=database.d.ts.map
@@ -1 +0,0 @@
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,QAAQ,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACnF,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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;CACL"}
@@ -1,16 +0,0 @@
1
- import { Context } from 'effect';
2
- import type { SpaceId } from '@dxos/keys';
3
- declare const FunctionCallService_base: Context.TagClass<FunctionCallService, "FunctionCallService", {
4
- callFunction(deployedFunctionId: string, input: any, spaceId?: SpaceId): Promise<any>;
5
- }>;
6
- /**
7
- * Allows calling into other functions.
8
- */
9
- export declare class FunctionCallService extends FunctionCallService_base {
10
- static fromClient(baseUrl: string, spaceId: SpaceId): Context.Tag.Service<FunctionCallService>;
11
- static mock: () => {
12
- callFunction: (deployedFunctionId: string, input: any) => Promise<any>;
13
- };
14
- }
15
- export {};
16
- //# sourceMappingURL=function-call-service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"function-call-service.d.ts","sourceRoot":"","sources":["../../../../src/services/function-call-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;;qCAQL,MAAM,SAAS,GAAG,YAAY,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;;AANzF;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,wBAKtC;IACD,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC;IAiB9F,MAAM,CAAC,IAAI;2CAEkC,MAAM,SAAS,GAAG;MAI7D;CACH"}
@@ -1,56 +0,0 @@
1
- import { type Context, Layer } from 'effect';
2
- import { AiService } from '@dxos/ai';
3
- import { CredentialsService } from './credentials';
4
- import { DatabaseService } from './database';
5
- import { EventLogger } from './event-logger';
6
- import { FunctionCallService } from './function-call-service';
7
- import { QueueService } from './queues';
8
- import { TracingService } from './tracing';
9
- /**
10
- * List of all services.
11
- */
12
- declare const SERVICES: {
13
- readonly ai: typeof AiService;
14
- readonly credentials: typeof CredentialsService;
15
- readonly database: typeof DatabaseService;
16
- readonly eventLogger: typeof EventLogger;
17
- readonly functionCallService: typeof FunctionCallService;
18
- readonly queues: typeof QueueService;
19
- readonly tracing: typeof TracingService;
20
- };
21
- /**
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.
31
- */
32
- export type ServiceRecord = {
33
- [K in keyof ServiceTagRecord]: Context.Tag.Service<ServiceTagRecord[K]>;
34
- };
35
- /**
36
- * Union of all services tags.
37
- */
38
- export type Services = ServiceTagRecord[keyof ServiceTagRecord];
39
- export declare const SERVICE_TAGS: Context.Tag<any, any>[];
40
- /**
41
- * @deprecated
42
- */
43
- export declare class ServiceContainer {
44
- private _services;
45
- /**
46
- * Set services.
47
- * @param services - Services to set.
48
- * @returns The container instance.
49
- */
50
- setServices(services: Partial<ServiceRecord>): this;
51
- getService<Id, T>(tag: Context.Tag<Id, T>): T;
52
- clone(): ServiceContainer;
53
- createLayer(): Layer.Layer<Services>;
54
- }
55
- export {};
56
- //# sourceMappingURL=service-container.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service-container.d.ts","sourceRoot":"","sources":["../../../../src/services/service-container.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAg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