@dxos/functions 0.8.4-main.72ec0f3 → 0.8.4-main.7996785055

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 (84) hide show
  1. package/README.md +4 -6
  2. package/dist/lib/neutral/chunk-GEM2K7BA.mjs +56 -0
  3. package/dist/lib/neutral/chunk-GEM2K7BA.mjs.map +7 -0
  4. package/dist/lib/neutral/fib-XBUKWUUS.mjs +22 -0
  5. package/dist/lib/neutral/fib-XBUKWUUS.mjs.map +7 -0
  6. package/dist/lib/neutral/index.mjs +960 -0
  7. package/dist/lib/neutral/index.mjs.map +7 -0
  8. package/dist/lib/neutral/meta.json +1 -0
  9. package/dist/lib/neutral/reply-XBQTXDLZ.mjs +18 -0
  10. package/dist/lib/neutral/reply-XBQTXDLZ.mjs.map +7 -0
  11. package/dist/lib/neutral/sleep-TLQKHAK2.mjs +14 -0
  12. package/dist/lib/neutral/sleep-TLQKHAK2.mjs.map +7 -0
  13. package/dist/types/src/errors.d.ts +24 -32
  14. package/dist/types/src/errors.d.ts.map +1 -1
  15. package/dist/types/src/example/definitions.d.ts +11 -0
  16. package/dist/types/src/example/definitions.d.ts.map +1 -0
  17. package/dist/types/src/example/fib.d.ts +3 -2
  18. package/dist/types/src/example/fib.d.ts.map +1 -1
  19. package/dist/types/src/example/index.d.ts +3 -11
  20. package/dist/types/src/example/index.d.ts.map +1 -1
  21. package/dist/types/src/example/reply.d.ts +2 -1
  22. package/dist/types/src/example/reply.d.ts.map +1 -1
  23. package/dist/types/src/example/sleep.d.ts +3 -2
  24. package/dist/types/src/example/sleep.d.ts.map +1 -1
  25. package/dist/types/src/protocol/functions-ai-http-client.d.ts +12 -0
  26. package/dist/types/src/protocol/functions-ai-http-client.d.ts.map +1 -0
  27. package/dist/types/src/protocol/protocol.d.ts +2 -2
  28. package/dist/types/src/protocol/protocol.d.ts.map +1 -1
  29. package/dist/types/src/sdk.d.ts +2 -79
  30. package/dist/types/src/sdk.d.ts.map +1 -1
  31. package/dist/types/src/services/credentials.d.ts +6 -4
  32. package/dist/types/src/services/credentials.d.ts.map +1 -1
  33. package/dist/types/src/services/event-logger.d.ts +25 -31
  34. package/dist/types/src/services/event-logger.d.ts.map +1 -1
  35. package/dist/types/src/services/function-invocation-service.d.ts +9 -3
  36. package/dist/types/src/services/function-invocation-service.d.ts.map +1 -1
  37. package/dist/types/src/services/index.d.ts +0 -1
  38. package/dist/types/src/services/index.d.ts.map +1 -1
  39. package/dist/types/src/services/queues.d.ts +4 -4
  40. package/dist/types/src/services/queues.d.ts.map +1 -1
  41. package/dist/types/src/services/tracing.d.ts +38 -3
  42. package/dist/types/src/services/tracing.d.ts.map +1 -1
  43. package/dist/types/src/types/Script.d.ts +9 -16
  44. package/dist/types/src/types/Script.d.ts.map +1 -1
  45. package/dist/types/src/types/Trigger.d.ts +57 -76
  46. package/dist/types/src/types/Trigger.d.ts.map +1 -1
  47. package/dist/types/src/types/TriggerEvent.d.ts +44 -13
  48. package/dist/types/src/types/TriggerEvent.d.ts.map +1 -1
  49. package/dist/types/src/types/index.d.ts +0 -1
  50. package/dist/types/src/types/index.d.ts.map +1 -1
  51. package/dist/types/src/types/url.d.ts +6 -5
  52. package/dist/types/src/types/url.d.ts.map +1 -1
  53. package/dist/types/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +23 -17
  55. package/src/errors.ts +4 -4
  56. package/src/example/definitions.ts +48 -0
  57. package/src/example/fib.ts +14 -24
  58. package/src/example/forex-effect.ts +1 -1
  59. package/src/example/index.ts +7 -8
  60. package/src/example/reply.ts +10 -13
  61. package/src/example/sleep.ts +8 -17
  62. package/src/protocol/functions-ai-http-client.ts +67 -0
  63. package/src/protocol/protocol.ts +196 -84
  64. package/src/sdk.ts +4 -194
  65. package/src/services/credentials.ts +31 -15
  66. package/src/services/event-logger.ts +2 -2
  67. package/src/services/function-invocation-service.ts +18 -3
  68. package/src/services/index.ts +0 -2
  69. package/src/services/queues.ts +5 -7
  70. package/src/services/tracing.ts +64 -4
  71. package/src/types/Script.ts +13 -8
  72. package/src/types/Trigger.ts +31 -17
  73. package/src/types/TriggerEvent.ts +29 -29
  74. package/src/types/index.ts +0 -1
  75. package/src/types/url.ts +6 -5
  76. package/dist/lib/browser/index.mjs +0 -927
  77. package/dist/lib/browser/index.mjs.map +0 -7
  78. package/dist/lib/browser/meta.json +0 -1
  79. package/dist/lib/node-esm/index.mjs +0 -928
  80. package/dist/lib/node-esm/index.mjs.map +0 -7
  81. package/dist/lib/node-esm/meta.json +0 -1
  82. package/dist/types/src/types/Function.d.ts +0 -58
  83. package/dist/types/src/types/Function.d.ts.map +0 -1
  84. package/src/types/Function.ts +0 -62
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/errors.ts", "../../../src/example/index.ts", "../../../src/services/credentials.ts", "../../../src/services/event-logger.ts", "../../../src/services/tracing.ts", "../../../src/services/function-invocation-service.ts", "../../../src/services/queues.ts", "../../../src/types/Script.ts", "../../../src/types/Trigger.ts", "../../../src/types/TriggerEvent.ts", "../../../src/types/url.ts", "../../../src/protocol/protocol.ts", "../../../src/protocol/functions-ai-http-client.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { BaseError, type BaseErrorOptions } from '@dxos/errors';\n\nexport class ServiceNotAvailableError extends BaseError.extend('ServiceNotAvailable', 'Service not available') {\n constructor(service: string, options?: Omit<BaseErrorOptions, 'context'>) {\n super({ context: { service }, ...options });\n }\n}\n\nexport class FunctionNotFoundError extends BaseError.extend('FunctionNotFound', 'Function not found') {\n constructor(functionKey: string, options?: Omit<BaseErrorOptions, 'context'>) {\n super({ context: { function: functionKey }, ...options });\n }\n}\n\nexport class FunctionError extends BaseError.extend('FunctionError', 'Function invocation error') {}\n\nexport class TriggerStateNotFoundError extends BaseError.extend('TriggerStateNotFound', 'Trigger state not found') {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { OperationHandlerSet } from '@dxos/operation';\nexport * from './definitions';\n\nexport const ExampleHandlers = OperationHandlerSet.lazy(\n () => import('./fib'),\n () => import('./reply'),\n () => import('./sleep'),\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as HttpClient from '@effect/platform/HttpClient';\nimport * as HttpClientRequest from '@effect/platform/HttpClientRequest';\nimport type * as Config from 'effect/Config';\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Redacted from 'effect/Redacted';\n\nimport { Query } from '@dxos/echo';\nimport { Database } from '@dxos/echo';\nimport { AccessToken } from '@dxos/types';\n\nexport type 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('@dxos/functions/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 static getApiKey = (query: CredentialQuery): Effect.Effect<Redacted.Redacted<string>, never, CredentialsService> =>\n Effect.gen(function* () {\n const credential = yield* CredentialsService.getCredential(query);\n if (!credential.apiKey) {\n throw new Error(`API key not found for service: ${query.service}`);\n }\n return Redacted.make(credential.apiKey);\n });\n\n static configuredLayer = (credentials: ServiceCredential[]) =>\n Layer.succeed(CredentialsService, new ConfiguredCredentialsService(credentials));\n\n static layerConfig = (\n credentials: {\n service: string;\n apiKey: Config.Config<Redacted.Redacted<string>>;\n }[],\n ) =>\n Layer.effect(\n CredentialsService,\n Effect.gen(function* () {\n const serviceCredentials = yield* Effect.forEach(credentials, ({ service, apiKey }) =>\n Effect.gen(function* () {\n return {\n service,\n apiKey: Redacted.value(yield* apiKey),\n };\n }),\n );\n\n return new ConfiguredCredentialsService(serviceCredentials);\n }),\n );\n\n static layerFromDatabase = ({ caching = false }: { caching?: boolean } = {}) =>\n Layer.effect(\n CredentialsService,\n Effect.gen(function* () {\n const dbService = yield* Database.Service;\n const cache = new Map<string, ServiceCredential[]>();\n\n const queryCredentials = async (query: CredentialQuery): Promise<ServiceCredential[]> => {\n const cacheKey = JSON.stringify(query);\n if (caching && cache.has(cacheKey)) {\n return cache.get(cacheKey)!;\n }\n\n const accessTokens = await dbService.db.query(Query.type(AccessToken.AccessToken)).run();\n const credentials = accessTokens\n .filter((accessToken) => accessToken.source === query.service)\n .map((accessToken) => ({\n service: accessToken.source,\n apiKey: accessToken.token,\n }));\n\n if (caching) {\n cache.set(cacheKey, credentials);\n }\n\n return credentials;\n };\n\n return {\n getCredential: async (query) => {\n const credentials = await queryCredentials(query);\n if (credentials.length === 0) {\n throw new Error(`Credential not found for service: ${query.service}`);\n }\n\n return credentials[0];\n },\n queryCredentials: async (query) => {\n return queryCredentials(query);\n },\n };\n }),\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\n return credential;\n }\n}\n\n/**\n * Maps the request to include the given token in the Authorization header.\n */\nexport const withAuthorization = (token: string, kind?: 'Bearer' | 'Basic') =>\n HttpClient.mapRequest((request) => {\n const authorization = kind ? `${kind} ${token}` : token;\n return HttpClientRequest.setHeader(request, 'Authorization', authorization);\n });\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Schema from 'effect/Schema';\n\nimport { Obj, Type } from '@dxos/echo';\nimport { invariant } from '@dxos/invariant';\nimport { LogLevel, log } from '@dxos/log';\n\nimport { TracingService } from './tracing';\n\nexport const ComputeEventPayload = Schema.Union(\n Schema.Struct({\n type: Schema.Literal('begin-compute'),\n nodeId: Schema.String,\n /**\n * Names of the inputs begin computed.\n */\n inputs: Schema.Array(Schema.String),\n }),\n Schema.Struct({\n type: Schema.Literal('end-compute'),\n nodeId: Schema.String,\n /**\n * Names of the outputs computed.\n */\n outputs: Schema.Array(Schema.String),\n }),\n Schema.Struct({\n type: Schema.Literal('compute-input'),\n nodeId: Schema.String,\n property: Schema.String,\n value: Schema.Any,\n }),\n Schema.Struct({\n type: Schema.Literal('compute-output'),\n nodeId: Schema.String,\n property: Schema.String,\n value: Schema.Any,\n }),\n Schema.Struct({\n type: Schema.Literal('custom'),\n nodeId: Schema.String,\n event: Schema.Any,\n }),\n);\nexport type ComputeEventPayload = Schema.Schema.Type<typeof ComputeEventPayload>;\n\nexport const ComputeEvent = Schema.Struct({\n payload: ComputeEventPayload,\n}).pipe(Type.object({ typename: 'org.dxos.type.compute-event', version: '0.1.0' }));\n\n/**\n * Logs event for the compute workflows.\n */\nexport class ComputeEventLogger extends Context.Tag('@dxos/functions/ComputeEventLogger')<\n ComputeEventLogger,\n { readonly log: (event: ComputeEventPayload) => void; readonly nodeId: string | undefined }\n>() {\n static noop: Context.Tag.Service<ComputeEventLogger> = {\n log: () => {},\n nodeId: undefined,\n };\n\n /**\n * Implements ComputeEventLogger using TracingService.\n */\n static layerFromTracing = Layer.effect(\n ComputeEventLogger,\n Effect.gen(function* () {\n const tracing = yield* TracingService;\n return {\n log: (event: ComputeEventPayload) => {\n tracing.write(Obj.make(ComputeEvent, { payload: event }), tracing.getTraceContext());\n },\n nodeId: undefined,\n };\n }),\n );\n}\n\nexport const logCustomEvent = (data: any) =>\n Effect.gen(function* () {\n const logger = yield* ComputeEventLogger;\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 = (\n level: LogLevel,\n message: string = 'event',\n): Context.Tag.Service<ComputeEventLogger> => {\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: ComputeEventPayload) => {\n logFunction(message, event);\n },\n nodeId: undefined,\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nimport { AgentStatus } from '@dxos/ai';\nimport { type DXN, Obj, Ref } from '@dxos/echo';\nimport { ObjectId } from '@dxos/keys';\nimport { Message } from '@dxos/types';\n\nimport type { Trigger } from '../types';\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('@dxos/functions/TracingService')<\n TracingService,\n {\n /**\n * Gets the parent message ID.\n */\n getTraceContext: () => TracingService.TraceContext;\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: Obj.Unknown, traceContext: TracingService.TraceContext) => void;\n\n traceInvocationStart({\n payload,\n target,\n }: {\n payload: TracingService.FunctionInvocationPayload;\n target?: DXN;\n }): Effect.Effect<TracingService.InvocationTraceData>;\n\n traceInvocationEnd({\n trace,\n exception,\n }: {\n trace: TracingService.InvocationTraceData;\n exception?: any;\n }): Effect.Effect<void>;\n }\n>() {\n static noop: Context.Tag.Service<TracingService> = {\n getTraceContext: () => ({}),\n write: () => {},\n traceInvocationStart: () =>\n Effect.sync(() => ({ invocationId: ObjectId.random(), invocationTraceQueue: undefined })),\n traceInvocationEnd: () => Effect.sync(() => {}),\n };\n\n static layerNoop: Layer.Layer<TracingService> = Layer.succeed(TracingService, TracingService.noop);\n\n /**\n * Creates a TracingService layer that emits events to the parent tracing service.\n */\n static layerSubframe = (mapContext: (currentContext: TracingService.TraceContext) => TracingService.TraceContext) =>\n Layer.effect(\n TracingService,\n Effect.gen(function* () {\n const tracing = yield* TracingService;\n const context = mapContext(tracing.getTraceContext());\n return {\n write: (event, context) => tracing.write(event, context),\n getTraceContext: () => context,\n traceInvocationStart: () => Effect.die('Tracing invocation inside another invocation is not supported.'),\n traceInvocationEnd: () => Effect.die('Tracing invocation inside another invocation is not supported.'),\n };\n }),\n );\n\n /**\n * Create sublayer to trace an invocation.\n * @param data\n * @returns\n */\n static layerInvocation = (data: TracingService.InvocationTraceData) =>\n TracingService.layerSubframe((context) => ({\n ...context,\n currentInvocation: data,\n }));\n\n /**\n * Emit the current human-readable execution status.\n */\n static emitStatus: (\n data: Omit<Obj.MakeProps<typeof AgentStatus>, 'created'>,\n ) => Effect.Effect<void, never, TracingService> = Effect.fnUntraced(function* (data) {\n const tracing = yield* TracingService;\n tracing.write(\n Obj.make(AgentStatus, {\n parentMessage: tracing.getTraceContext().parentMessage,\n toolCallId: tracing.getTraceContext().toolCallId,\n created: new Date().toISOString(),\n ...data,\n }),\n tracing.getTraceContext(),\n );\n });\n\n static emitConverationMessage: (\n data: Obj.MakeProps<typeof Message.Message>,\n ) => Effect.Effect<void, never, TracingService> = Effect.fnUntraced(function* (data) {\n const tracing = yield* TracingService;\n tracing.write(\n Obj.make(Message.Message, {\n parentMessage: tracing.getTraceContext().parentMessage,\n ...data,\n properties: {\n [MESSAGE_PROPERTY_TOOL_CALL_ID]: tracing.getTraceContext().toolCallId,\n ...data.properties,\n },\n }),\n tracing.getTraceContext(),\n );\n });\n}\n\nexport namespace TracingService {\n export interface TraceContext {\n currentInvocation?: InvocationTraceData;\n\n /**\n * If this thread sprung from a tool call, this is the ID of the message containing the tool call.\n */\n parentMessage?: ObjectId;\n\n /**\n * If the current thread is a byproduct of a tool call, this is the ID of the tool call.\n */\n toolCallId?: string;\n\n debugInfo?: unknown;\n }\n\n /**\n * Trace data for a function/trigger invocation.\n */\n export interface InvocationTraceData {\n invocationId: ObjectId;\n invocationTraceQueue?: DXN.String;\n }\n\n /**\n * Payload for a function/trigger invocation.\n */\n export interface FunctionInvocationPayload {\n data?: any;\n inputNodeId?: string;\n trigger?: {\n id: string;\n kind: Trigger.Kind;\n };\n chat?: Ref.Ref<Obj.Unknown>;\n }\n}\n\n/**\n * Goes into {@link Message['properties']}\n */\nexport const MESSAGE_PROPERTY_TOOL_CALL_ID = 'toolCallId' as const;\n", "//\n// Copyright 2025 DXOS.org\n//\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nimport type { FunctionNotFoundError } from '../errors';\nimport { type InvocationServices } from '../sdk';\nimport { Operation } from '@dxos/operation';\n\nexport class FunctionInvocationService extends Context.Tag('@dxos/functions/FunctionInvocationService')<\n FunctionInvocationService,\n {\n invokeFunction<I, O>(\n functionDef: Operation.Definition<I, O, any>,\n input: I,\n ): Effect.Effect<O, never, InvocationServices>;\n\n resolveFunction(key: string): Effect.Effect<Operation.Definition.Any, FunctionNotFoundError>;\n }\n>() {\n static layerNotAvailable = Layer.succeed(FunctionInvocationService, {\n invokeFunction: () => Effect.die('FunctionInvocationService is not avaialble.'),\n resolveFunction: () => Effect.die('FunctionInvocationService is not available.'),\n });\n\n static invokeFunction = <I, O>(\n functionDef: Operation.Definition<I, O, any>,\n input: I,\n ): Effect.Effect<O, never, FunctionInvocationService | InvocationServices> =>\n Effect.serviceFunctionEffect(FunctionInvocationService, (service) => service.invokeFunction)(functionDef, input);\n\n static resolveFunction = (\n key: string,\n ): Effect.Effect<Operation.Definition.Any, FunctionNotFoundError, FunctionInvocationService> =>\n Effect.serviceFunctionEffect(FunctionInvocationService, (service) => service.resolveFunction)(key);\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nimport type { Entity } from '@dxos/echo';\nimport type { Queue, QueueAPI, QueueFactory } from '@dxos/echo-db';\nimport type { DXN, QueueSubspaceTag } from '@dxos/keys';\n\n/**\n * Gives access to all queues.\n */\nexport class QueueService extends Context.Tag('@dxos/functions/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 queue: 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 queue: undefined,\n });\n\n static make = (queues: QueueFactory, queue?: Queue): Context.Tag.Service<QueueService> => {\n return {\n queues,\n queue,\n };\n };\n\n static layer = (queues: QueueFactory, queue?: Queue): Layer.Layer<QueueService> =>\n Layer.succeed(QueueService, QueueService.make(queues, queue));\n\n /**\n * Gets a queue by its DXN.\n */\n static getQueue = <T extends Entity.Unknown = Entity.Unknown>(\n dxn: DXN,\n ): Effect.Effect<Queue<T>, never, QueueService> => QueueService.pipe(Effect.map(({ queues }) => queues.get<T>(dxn)));\n\n /**\n * Creates a new queue.\n */\n static createQueue = <T extends Entity.Unknown = Entity.Unknown>(options?: {\n subspaceTag?: QueueSubspaceTag;\n }): Effect.Effect<Queue<T>, never, QueueService> =>\n QueueService.pipe(Effect.map(({ queues }) => queues.create<T>(options)));\n\n static append = <T extends Entity.Unknown = Entity.Unknown>(queue: Queue<T>, objects: T[]): Effect.Effect<void> =>\n Effect.promise(() => queue.append(objects));\n}\n\n/**\n * Gives access to a specific queue passed as a context.\n */\nexport class ContextQueueService extends Context.Tag('@dxos/functions/ContextQueueService')<\n ContextQueueService,\n {\n readonly queue: Queue;\n }\n>() {\n static layer = (queue: Queue) => Layer.succeed(ContextQueueService, { queue });\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, Obj, Ref, Type } from '@dxos/echo';\nimport { FormInputAnnotation } from '@dxos/echo/internal';\nimport { Text } from '@dxos/schema';\n\n/**\n * Source script.\n */\nexport const Script = Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n description: Schema.String.pipe(Schema.optional),\n // TODO(burdon): Change to hash of deployed content.\n // Whether source has changed since last deploy.\n changed: Schema.Boolean.pipe(FormInputAnnotation.set(false), Schema.optional),\n source: Ref.Ref(Text.Text).pipe(FormInputAnnotation.set(false)),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.script',\n version: '0.1.0',\n }),\n Annotation.LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({\n icon: 'ph--code--regular',\n hue: 'sky',\n }),\n);\n\nexport interface Script extends Schema.Schema.Type<typeof Script> {}\n\ntype Props = Omit<Obj.MakeProps<typeof Script>, 'source'> & { source?: string };\n\nexport const make = ({ source = '', ...props }: Props = {}): Script =>\n Obj.make(Script, { ...props, source: Ref.make(Text.make(source)) });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { Annotation, Obj, QueryAST, Ref, Type } from '@dxos/echo';\nimport { OptionsAnnotationId, SystemTypeAnnotation } from '@dxos/echo/internal';\nimport { DXN } from '@dxos/keys';\n\n/**\n * Type discriminator for TriggerType.\n * Every spec has a type field of type TriggerKind that we can use to understand which type we're working with.\n * https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions\n */\nexport const Kinds = ['email', 'queue', 'subscription', 'timer', 'webhook'] as const;\nexport type Kind = (typeof Kinds)[number];\n\nconst kindLiteralAnnotations = { title: 'Kind' };\n\nexport const EmailSpec = Schema.Struct({\n kind: Schema.Literal('email').annotations(kindLiteralAnnotations),\n});\nexport type EmailSpec = Schema.Schema.Type<typeof EmailSpec>;\n\n// TODO(wittjosiah): Remove. Migrate to Subscription triggers once EDGE supports them for feed queries.\nexport const QueueSpec = Schema.Struct({\n kind: Schema.Literal('queue').annotations(kindLiteralAnnotations),\n\n // TODO(dmaretskyi): Change to a reference.\n queue: DXN.Schema,\n});\nexport type QueueSpec = Schema.Schema.Type<typeof QueueSpec>;\n\n/**\n * Subscription.\n */\nexport const SubscriptionSpec = Schema.Struct({\n kind: Schema.Literal('subscription').annotations(kindLiteralAnnotations),\n query: Schema.Struct({\n raw: Schema.optional(Schema.String.annotations({ title: 'Query' })),\n ast: QueryAST.Query,\n }),\n options: Schema.optional(\n Schema.Struct({\n // Watch changes to object (not just creation).\n deep: Schema.optional(Schema.Boolean.annotations({ title: 'Nested' })),\n // Debounce changes (delay in ms).\n delay: Schema.optional(Schema.Number.annotations({ title: 'Delay' })),\n }).annotations({ title: 'Options' }),\n ),\n});\nexport type SubscriptionSpec = Schema.Schema.Type<typeof SubscriptionSpec>;\n\n/**\n * Cron timer.\n */\nexport const TimerSpec = Schema.Struct({\n kind: Schema.Literal('timer').annotations(kindLiteralAnnotations),\n cron: Schema.String.annotations({\n title: 'Cron',\n [SchemaAST.ExamplesAnnotationId]: ['0 0 * * *'],\n }),\n});\nexport type TimerSpec = Schema.Schema.Type<typeof TimerSpec>;\n\n/**\n * Webhook.\n */\nexport const WebhookSpec = Schema.Struct({\n kind: Schema.Literal('webhook').annotations(kindLiteralAnnotations),\n method: Schema.optional(\n Schema.String.annotations({\n title: 'Method',\n [OptionsAnnotationId]: ['GET', 'POST'],\n }),\n ),\n port: Schema.optional(\n Schema.Number.annotations({\n title: 'Port',\n }),\n ),\n});\nexport type WebhookSpec = Schema.Schema.Type<typeof WebhookSpec>;\n\n/**\n * Trigger schema.\n */\nexport const Spec = Schema.Union(EmailSpec, QueueSpec, SubscriptionSpec, TimerSpec, WebhookSpec).annotations({\n title: 'Trigger',\n});\nexport type Spec = Schema.Schema.Type<typeof Spec>;\n\n/**\n * Function trigger.\n * Function is invoked with the `payload` passed as input data.\n * The event that triggers the function is available in the function context.\n */\nconst TriggerSchema = Schema.Struct({\n /**\n * Function or workflow to invoke.\n */\n // TODO(dmaretskyi): Can be a Ref(FunctionType) or Ref(ComputeGraphType).\n function: Schema.optional(Ref.Ref(Obj.Unknown).annotations({ title: 'Function' })),\n\n /**\n * Only used for workflowSchema.\n * Specifies the input node in the circuit.\n * @deprecated Remove and enforce a single input node in all compute graphSchema.\n */\n inputNodeId: Schema.optional(Schema.String.annotations({ title: 'Input Node ID' })),\n\n // TODO(burdon): NO BOOLEAN PROPERTIES (enabld/disabled/paused, etc.)\n // Need lint rule; or agent rule to require PR review for \"boolean\" key word.\n enabled: Schema.optional(Schema.Boolean.annotations({ title: 'Enabled' })),\n\n spec: Schema.optional(Spec),\n\n concurrency: Schema.optional(\n Schema.Number.annotations({\n title: 'Concurrency',\n default: 1,\n description:\n 'Maximum number of concurrent invocations of the trigger. For queue triggers, this will process queue items in parallel.',\n }),\n ),\n\n /**\n * Passed as the input data to the function.\n * Must match the function's input schema.\n *\n * @example\n * {\n * item: '{{event.item}}',\n * instructions: 'Summarize and perform entity-extraction'\n * mailbox: { '/': 'dxn:echo:AAA:ZZZ' }\n * }\n */\n input: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.trigger',\n version: '0.1.0',\n }),\n Annotation.IconAnnotation.set({ icon: 'ph--lightning--regular', hue: 'yellow' }),\n SystemTypeAnnotation.set(true),\n);\n\nexport interface Trigger extends Schema.Schema.Type<typeof TriggerSchema> {}\nexport const Trigger: Type.Obj<Trigger> = TriggerSchema as any;\n\nexport const make = (props: Obj.MakeProps<typeof Trigger>) => Obj.make(Trigger, props);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { DXN, Obj, Ref } from '@dxos/echo';\n\n// TODO(wittjosiah): Review this type.\n// - Should be discriminated union.\n// - Should be more consistent (e.g. subject vs item).\n// - Should re-use schemas if possible.\n\n// TODO(burdon): Reuse trigger schema from @dxos/functions (TriggerType).\nexport const EmailEvent = Schema.Struct({\n from: Schema.String,\n to: Schema.String,\n subject: Schema.String,\n created: Schema.String,\n body: Schema.String,\n});\nexport type EmailEvent = Schema.Schema.Type<typeof EmailEvent>;\n\nexport const QueueEvent = Schema.Struct({\n queue: DXN.Schema,\n item: Schema.Any,\n cursor: Schema.String,\n});\nexport type QueueEvent = Schema.Schema.Type<typeof QueueEvent>;\n\nexport const SubscriptionEvent = Schema.Struct({\n /**\n * Type of the mutation.\n */\n // TODO(dmaretskyi): Specify enum.\n type: Schema.String,\n\n /**\n * Reference to the object that was changed or created.\n */\n subject: Ref.Ref(Obj.Unknown),\n\n /**\n * @deprecated\n */\n changedObjectId: Schema.optional(Schema.String),\n});\nexport type SubscriptionEvent = Schema.Schema.Type<typeof SubscriptionEvent>;\n\nexport const TimerEvent = Schema.Struct({ tick: Schema.Number });\nexport type TimerEvent = Schema.Schema.Type<typeof TimerEvent>;\n\nexport const WebhookEvent = Schema.Struct({\n url: Schema.String,\n method: Schema.Literal('GET', 'POST'),\n headers: Schema.Record({ key: Schema.String, value: Schema.String }),\n bodyText: Schema.String,\n});\nexport type WebhookEvent = Schema.Schema.Type<typeof WebhookEvent>;\n\nexport const TriggerEvent = Schema.Union(EmailEvent, QueueEvent, SubscriptionEvent, TimerEvent, WebhookEvent);\nexport type TriggerEvent = Schema.Schema.Type<typeof TriggerEvent>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Obj } from '@dxos/echo';\n\n// TODO: use URL scheme for source?\nexport const FUNCTIONS_META_KEY = 'org.dxos.service.function';\n\nexport const FUNCTIONS_PRESET_META_KEY = 'org.dxos.service.function-preset';\n\n/**\n * NOTE: functionId is backend ID, not ECHO object id.\n */\nexport const getUserFunctionIdInMetadata = (meta: Obj.ReadonlyMeta) => {\n return meta.keys.find((key) => key.source === FUNCTIONS_META_KEY)?.id;\n};\n\n/**\n * NOTE: functionId is backend ID, not ECHO object id.\n * Must be called inside Obj.changeMeta() since it mutates the meta.\n */\nexport const setUserFunctionIdInMetadata = (meta: Obj.Meta, functionId: string) => {\n const key = meta.keys.find((key) => key.source === FUNCTIONS_META_KEY);\n if (key) {\n if (key.id !== functionId) {\n throw new Error('Metadata mismatch');\n }\n } else {\n meta.keys.push({ source: FUNCTIONS_META_KEY, id: functionId });\n }\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as AnthropicClient from '@effect/ai-anthropic/AnthropicClient';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { AiModelResolver, AiService } from '@dxos/ai';\nimport { AnthropicResolver } from '@dxos/ai/resolvers';\nimport { LifecycleState, Resource } from '@dxos/context';\nimport { Database, Feed, JsonSchema, Ref, type Type } from '@dxos/echo';\nimport { refFromEncodedReference } from '@dxos/echo/internal';\nimport { EchoClient, type EchoDatabaseImpl, type QueueFactory, createFeedServiceLayer } from '@dxos/echo-db';\nimport { runAndForwardErrors } from '@dxos/effect';\nimport { assertState, failedInvariant, invariant } from '@dxos/invariant';\nimport { PublicKey } from '@dxos/keys';\nimport { type FunctionProtocol } from '@dxos/protocols';\n\nimport { FunctionError } from '../errors';\nimport { type FunctionServices } from '../sdk';\nimport { CredentialsService, FunctionInvocationService, QueueService, TracingService } from '../services';\nimport { Operation } from '@dxos/operation';\n\nimport { FunctionsAiHttpClient } from './functions-ai-http-client';\n\n/**\n * Wraps a function handler made with `defineFunction` to a protocol that the functions-runtime expects.\n */\nexport const wrapFunctionHandler = (func: Operation.WithHandler<Operation.Definition.Any>): FunctionProtocol.Func => {\n if (!Operation.isOperationWithHandler(func)) {\n throw new TypeError('Expected operation with handler');\n }\n\n const serviceTags = func.services.map((service) => service.key);\n\n return {\n meta: {\n key: func.meta.key,\n name: func.meta.name,\n description: func.meta.description,\n inputSchema: JsonSchema.toJsonSchema(func.input),\n outputSchema: func.output === undefined ? undefined : JsonSchema.toJsonSchema(func.output),\n services: func.services.map((service) => service.key),\n },\n handler: async ({ data, context }) => {\n if (\n (serviceTags.includes(Database.Service.key) ||\n serviceTags.includes(QueueService.key) ||\n serviceTags.includes(Feed.Service.key)) &&\n (!context.services.dataService || !context.services.queryService)\n ) {\n throw new FunctionError({\n message: 'Services not provided: dataService, queryService',\n });\n }\n\n // eslint-disable-next-line no-useless-catch\n try {\n if (!SchemaAST.isAnyKeyword(func.input.ast)) {\n try {\n Schema.validateSync(func.input)(data);\n } catch (error) {\n throw new FunctionError({ message: 'Invalid input schema', cause: error });\n }\n }\n\n await using funcContext = await new FunctionContext(context).open();\n\n if (func.types.length > 0) {\n invariant(funcContext.db, 'Database is required for functions with types');\n await funcContext.db.graph.schemaRegistry.register(func.types as Type.AnyEntity[]);\n }\n\n const dataWithDecodedRefs =\n funcContext.db && !SchemaAST.isAnyKeyword(func.input.ast)\n ? decodeRefsFromSchema(func.input.ast, data, funcContext.db)\n : data;\n\n let result: any = await func.handler(dataWithDecodedRefs);\n\n if (Effect.isEffect(result)) {\n result = await runAndForwardErrors(\n (result as Effect.Effect<unknown, unknown, FunctionServices>).pipe(\n Effect.orDie,\n Effect.provide(funcContext.createLayer()),\n ),\n );\n }\n\n if (func.output && !SchemaAST.isAnyKeyword(func.output.ast)) {\n Schema.validateSync(func.output)(result);\n }\n\n return result;\n } catch (error) {\n // TODO(dmaretskyi): We might do error wrapping here and add extra context.\n throw error;\n }\n },\n };\n};\n\n/**\n * Container for services and context for a function.\n */\nclass FunctionContext extends Resource {\n readonly context: FunctionProtocol.Context;\n readonly client: EchoClient | undefined;\n db: EchoDatabaseImpl | undefined;\n queues: QueueFactory | undefined;\n\n constructor(context: FunctionProtocol.Context) {\n super();\n this.context = context;\n if (context.services.dataService && context.services.queryService) {\n this.client = new EchoClient().connectToService({\n dataService: context.services.dataService,\n queryService: context.services.queryService,\n queueService: context.services.queueService,\n });\n }\n }\n\n override async _open() {\n await this.client?.open();\n this.db =\n this.client && this.context.spaceId\n ? this.client.constructDatabase({\n spaceId: this.context.spaceId ?? failedInvariant(),\n spaceKey: PublicKey.fromHex(this.context.spaceKey ?? failedInvariant('spaceKey missing in context')),\n reactiveSchemaQuery: false,\n preloadSchemaOnOpen: false,\n })\n : undefined;\n\n await this.db?.setSpaceRoot(this.context.spaceRootUrl ?? failedInvariant('spaceRootUrl missing in context'));\n await this.db?.open();\n this.queues =\n this.client && this.context.spaceId ? this.client.constructQueueFactory(this.context.spaceId) : undefined;\n }\n\n override async _close() {\n await this.db?.close();\n await this.client?.close();\n }\n\n createLayer(): Layer.Layer<FunctionServices> {\n assertState(this._lifecycleState === LifecycleState.OPEN, 'FunctionContext is not open');\n\n const dbLayer = this.db ? Database.layer(this.db) : Database.notAvailable;\n const queuesLayer = this.queues ? QueueService.layer(this.queues) : QueueService.notAvailable;\n const feedLayer = this.queues ? createFeedServiceLayer(this.queues) : Feed.notAvailable;\n const credentials = dbLayer\n ? CredentialsService.layerFromDatabase({ caching: true }).pipe(Layer.provide(dbLayer))\n : CredentialsService.configuredLayer([]);\n const functionInvocationService = MockedFunctionInvocationService;\n const tracing = TracingService.layerNoop;\n\n const aiLayer = this.context.services.functionsAiService\n ? AiModelResolver.AiModelResolver.buildAiService.pipe(\n Layer.provide(\n AnthropicResolver.make().pipe(\n Layer.provide(\n AnthropicClient.layer({\n // Note: It doesn't matter what is base url here, it will be proxied to ai gateway in edge.\n apiUrl: 'http://internal/provider/anthropic',\n }).pipe(Layer.provide(FunctionsAiHttpClient.layer(this.context.services.functionsAiService))),\n ),\n ),\n ),\n )\n : AiService.notAvailable;\n\n return Layer.mergeAll(dbLayer, queuesLayer, feedLayer, credentials, functionInvocationService, aiLayer, tracing);\n }\n}\n\nconst MockedFunctionInvocationService = Layer.succeed(FunctionInvocationService, {\n invokeFunction: () => Effect.die('Calling functions from functions is not implemented yet.'),\n resolveFunction: () => Effect.die('Not implemented.'),\n});\n\nconst decodeRefsFromSchema = (ast: SchemaAST.AST, value: unknown, db: EchoDatabaseImpl): unknown => {\n if (value == null) {\n return value;\n }\n\n const encoded = SchemaAST.encodedBoundAST(ast);\n if (Ref.isRefType(encoded)) {\n if (Ref.isRef(value)) {\n return value;\n }\n\n if (typeof value === 'object' && value !== null && typeof (value as any)['/'] === 'string') {\n const resolver = db.graph.createRefResolver({ context: { space: db.spaceId } });\n return refFromEncodedReference(value as any, resolver);\n }\n\n return value;\n }\n\n switch (encoded._tag) {\n case 'TypeLiteral': {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n return value;\n }\n const result: Record<string, unknown> = { ...(value as any) };\n for (const prop of SchemaAST.getPropertySignatures(encoded)) {\n const key = prop.name.toString();\n if (key in result) {\n result[key] = decodeRefsFromSchema(prop.type, (result as any)[key], db);\n }\n }\n return result;\n }\n\n case 'TupleType': {\n if (!Array.isArray(value)) {\n return value;\n }\n\n // For arrays, effect uses TupleType with empty elements and a single rest element.\n if (encoded.elements.length === 0 && encoded.rest.length === 1) {\n const elementType = encoded.rest[0].type;\n return (value as unknown[]).map((item) => decodeRefsFromSchema(elementType, item, db));\n }\n\n return value;\n }\n\n case 'Union': {\n // Optional values are represented as union with undefined.\n const nonUndefined = encoded.types.filter((t) => !SchemaAST.isUndefinedKeyword(t));\n if (nonUndefined.length === 1) {\n return decodeRefsFromSchema(nonUndefined[0], value, db);\n }\n\n // For other unions we can't safely pick a branch without validating.\n return value;\n }\n\n case 'Suspend': {\n return decodeRefsFromSchema(encoded.f(), value, db);\n }\n\n case 'Refinement': {\n return decodeRefsFromSchema(encoded.from, value, db);\n }\n\n default: {\n return value;\n }\n }\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Headers from '@effect/platform/Headers';\nimport * as HttpClient from '@effect/platform/HttpClient';\nimport * as HttpClientError from '@effect/platform/HttpClientError';\nimport * as HttpClientResponse from '@effect/platform/HttpClientResponse';\nimport * as Effect from 'effect/Effect';\nimport * as FiberRef from 'effect/FiberRef';\nimport * as Layer from 'effect/Layer';\nimport * as Stream from 'effect/Stream';\n\nimport { log } from '@dxos/log';\nimport { type EdgeFunctionEnv, ErrorCodec } from '@dxos/protocols';\n/**\n * Copy pasted from https://github.com/Effect-TS/effect/blob/main/packages/platform/src/internal/fetchHttpClient.ts\n */\nexport const requestInitTagKey = '@effect/platform/FetchHttpClient/FetchOptions';\n\nexport class FunctionsAiHttpClient {\n static make = (service: EdgeFunctionEnv.FunctionsAiService) =>\n HttpClient.make((request, url, signal, fiber) => {\n const context = fiber.getFiberRef(FiberRef.currentContext);\n const options: RequestInit = context.unsafeMap.get(requestInitTagKey) ?? {};\n const headers = options.headers\n ? Headers.merge(Headers.fromInput(options.headers), request.headers)\n : request.headers;\n\n const send = (body: BodyInit | undefined) =>\n Effect.tryPromise({\n try: () =>\n service.fetch(\n new Request(url, {\n ...options,\n method: request.method,\n headers,\n body,\n // Note: Don't pass signal - it can't be serialized through RPC\n }),\n ),\n catch: (cause) => {\n log.error('Failed to fetch', { errorSerialized: ErrorCodec.encode(cause as Error) });\n return new HttpClientError.RequestError({\n request,\n reason: 'Transport',\n cause,\n });\n },\n }).pipe(Effect.map((response) => HttpClientResponse.fromWeb(request, response)));\n\n switch (request.body._tag) {\n case 'Raw':\n case 'Uint8Array':\n return send(request.body.body as any);\n case 'FormData':\n return send(request.body.formData);\n case 'Stream':\n return Stream.toReadableStreamEffect(request.body.stream).pipe(Effect.flatMap(send));\n }\n\n return send(undefined);\n });\n\n static layer = (service: EdgeFunctionEnv.Functions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CAAWC,8BAAmBD,CAAAA,CAAAA;AAC/E,UAAIF,aAAa3F,WAAW,GAAG;AAC7B,eAAOO,qBAAqBoF,aAAa,CAAA,GAAIrB,QAAOpE,EAAAA;MACtD;AAGA,aAAOoE;IACT;IAEA,KAAK,WAAW;AACd,aAAO/D,qBAAqBgE,QAAQwB,EAAC,GAAIzB,QAAOpE,EAAAA;IAClD;IAEA,KAAK,cAAc;AACjB,aAAOK,qBAAqBgE,QAAQyB,MAAM1B,QAAOpE,EAAAA;IACnD;IAEA,SAAS;AACP,aAAOoE;IACT;EACF;AACF;",
6
+ "names": ["BaseError", "ServiceNotAvailableError", "BaseError", "extend", "service", "options", "context", "FunctionNotFoundError", "functionKey", "function", "FunctionError", "TriggerStateNotFoundError", "OperationHandlerSet", "ExampleHandlers", "OperationHandlerSet", "lazy", "HttpClient", "HttpClientRequest", "Context", "Effect", "Layer", "Redacted", "Query", "Database", "AccessToken", "CredentialsService", "Tag", "getCredential", "query", "gen", "credentials", "promise", "getApiKey", "credential", "apiKey", "Error", "service", "make", "configuredLayer", "succeed", "ConfiguredCredentialsService", "layerConfig", "effect", "serviceCredentials", "forEach", "value", "layerFromDatabase", "caching", "dbService", "Database", "Service", "cache", "Map", "queryCredentials", "cacheKey", "JSON", "stringify", "has", "get", "accessTokens", "db", "Query", "type", "AccessToken", "run", "filter", "accessToken", "source", "map", "token", "set", "length", "addCredentials", "push", "find", "withAuthorization", "kind", "mapRequest", "request", "authorization", "setHeader", "Context", "Effect", "Layer", "Schema", "Obj", "Type", "invariant", "LogLevel", "log", "Context", "Effect", "Layer", "AgentStatus", "Obj", "ObjectId", "Message", "TracingService", "Tag", "noop", "getTraceContext", "write", "traceInvocationStart", "sync", "invocationId", "ObjectId", "random", "invocationTraceQueue", "undefined", "traceInvocationEnd", "layerNoop", "succeed", "layerSubframe", "mapContext", "effect", "gen", "tracing", "context", "event", "die", "layerInvocation", "data", "currentInvocation", "emitStatus", "fnUntraced", "Obj", "make", "AgentStatus", "parentMessage", "toolCallId", "created", "Date", "toISOString", "emitConverationMessage", "Message", "properties", "MESSAGE_PROPERTY_TOOL_CALL_ID", "ComputeEventPayload", "Union", "Struct", "type", "Literal", "nodeId", "String", "inputs", "Array", "outputs", "property", "value", "Any", "event", "ComputeEvent", "payload", "pipe", "Type", "object", "typename", "version", "ComputeEventLogger", "Tag", "noop", "log", "undefined", "layerFromTracing", "effect", "gen", "tracing", "TracingService", "write", "Obj", "make", "getTraceContext", "logCustomEvent", "data", "logger", "Error", "createDefectLogger", "catchAll", "error", "createEventLogger", "level", "message", "logFunction", "LogLevel", "WARN", "warn", "VERBOSE", "verbose", "DEBUG", "debug", "INFO", "info", "ERROR", "invariant", "Context", "Effect", "Layer", "FunctionInvocationService", "Tag", "layerNotAvailable", "succeed", "invokeFunction", "die", "resolveFunction", "functionDef", "input", "serviceFunctionEffect", "service", "key", "Context", "Effect", "Layer", "QueueService", "Tag", "notAvailable", "succeed", "queues", "get", "_dxn", "Error", "create", "queue", "undefined", "make", "layer", "getQueue", "dxn", "pipe", "map", "createQueue", "options", "append", "objects", "promise", "ContextQueueService", "make", "Schema", "Annotation", "Obj", "Ref", "Type", "FormInputAnnotation", "Text", "Script", "Struct", "name", "String", "pipe", "optional", "description", "changed", "Boolean", "FormInputAnnotation", "set", "source", "Ref", "Text", "Type", "object", "typename", "version", "Annotation", "LabelAnnotation", "IconAnnotation", "icon", "hue", "make", "props", "Obj", "make", "Schema", "SchemaAST", "Annotation", "Obj", "QueryAST", "Ref", "Type", "OptionsAnnotationId", "SystemTypeAnnotation", "DXN", "Kinds", "kindLiteralAnnotations", "title", "EmailSpec", "Struct", "kind", "Literal", "annotations", "QueueSpec", "queue", "DXN", "Schema", "SubscriptionSpec", "query", "raw", "optional", "String", "ast", "QueryAST", "Query", "options", "deep", "Boolean", "delay", "Number", "TimerSpec", "cron", "ExamplesAnnotationId", "WebhookSpec", "method", "OptionsAnnotationId", "port", "Spec", "Union", "TriggerSchema", "function", "Ref", "Obj", "Unknown", "inputNodeId", "enabled", "spec", "concurrency", "default", "description", "input", "Record", "key", "value", "Any", "pipe", "Type", "object", "typename", "version", "Annotation", "IconAnnotation", "set", "icon", "hue", "SystemTypeAnnotation", "Trigger", "make", "props", "Schema", "DXN", "Obj", "Ref", "EmailEvent", "Struct", "from", "String", "to", "subject", "created", "body", "QueueEvent", "queue", "DXN", "Schema", "item", "Any", "cursor", "SubscriptionEvent", "type", "Ref", "Obj", "Unknown", "changedObjectId", "optional", "TimerEvent", "tick", "Number", "WebhookEvent", "url", "method", "Literal", "headers", "Record", "key", "value", "bodyText", "TriggerEvent", "Union", "FUNCTIONS_META_KEY", "FUNCTIONS_PRESET_META_KEY", "getUserFunctionIdInMetadata", "meta", "keys", "find", "key", "source", "id", "setUserFunctionIdInMetadata", "functionId", "Error", "push", "AnthropicClient", "Effect", "Layer", "Schema", "SchemaAST", "AiModelResolver", "AiService", "AnthropicResolver", "LifecycleState", "Resource", "Database", "Feed", "JsonSchema", "Ref", "refFromEncodedReference", "EchoClient", "createFeedServiceLayer", "runAndForwardErrors", "assertState", "failedInvariant", "invariant", "PublicKey", "Operation", "Headers", "HttpClient", "HttpClientError", "HttpClientResponse", "Effect", "FiberRef", "Layer", "Stream", "log", "ErrorCodec", "requestInitTagKey", "FunctionsAiHttpClient", "make", "service", "request", "url", "signal", "fiber", "context", "getFiberRef", "currentContext", "options", "unsafeMap", "get", "headers", "merge", "fromInput", "send", "body", "tryPromise", "try", "fetch", "Request", "method", "catch", "cause", "error", "errorSerialized", "encode", "RequestError", "reason", "pipe", "map", "response", "fromWeb", "_tag", "formData", "toReadableStreamEffect", "stream", "flatMap", "undefined", "layer", "succeed", "wrapFunctionHandler", "func", "Operation", "isOperationWithHandler", "TypeError", "serviceTags", "services", "map", "service", "key", "meta", "name", "description", "inputSchema", "JsonSchema", "toJsonSchema", "input", "outputSchema", "output", "undefined", "handler", "data", "context", "includes", "Database", "Service", "QueueService", "Feed", "dataService", "queryService", "FunctionError", "message", "isAnyKeyword", "ast", "Schema", "validateSync", "error", "cause", "funcContext", "FunctionContext", "open", "types", "length", "invariant", "db", "graph", "schemaRegistry", "register", "dataWithDecodedRefs", "decodeRefsFromSchema", "result", "isEffect", "runAndForwardErrors", "pipe", "orDie", "provide", "createLayer", "Resource", "client", "queues", "EchoClient", "connectToService", "queueService", "_open", "spaceId", "constructDatabase", "failedInvariant", "spaceKey", "PublicKey", "fromHex", "reactiveSchemaQuery", "preloadSchemaOnOpen", "setSpaceRoot", "spaceRootUrl", "constructQueueFactory", "_close", "close", "assertState", "_lifecycleState", "LifecycleState", "OPEN", "dbLayer", "layer", "notAvailable", "queuesLayer", "feedLayer", "createFeedServiceLayer", "credentials", "CredentialsService", "layerFromDatabase", "caching", "configuredLayer", "functionInvocationService", "MockedFunctionInvocationService", "tracing", "TracingService", "layerNoop", "aiLayer", "functionsAiService", "AiModelResolver", "buildAiService", "AnthropicResolver", "make", "apiUrl", "FunctionsAiHttpClient", "AiService", "mergeAll", "succeed", "FunctionInvocationService", "invokeFunction", "die", "resolveFunction", "value", "encoded", "encodedBoundAST", "Ref", "isRefType", "isRef", "resolver", "createRefResolver", "space", "refFromEncodedReference", "_tag", "Array", "isArray", "prop", "getPropertySignatures", "toString", "type", "elements", "rest", "elementType", "item", "nonUndefined", "filter", "t", "isUndefinedKeyword", "f", "from"]
7
+ }
@@ -0,0 +1 @@
1
+ {"inputs":{"src/errors.ts":{"bytes":3073,"imports":[{"path":"@dxos/errors","kind":"import-statement","external":true}],"format":"esm"},"src/example/definitions.ts":{"bytes":4309,"imports":[{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true}],"format":"esm"},"src/example/fib.ts":{"bytes":1942,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/example/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/example/reply.ts":{"bytes":1599,"imports":[{"path":"effect/Console","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/example/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/example/sleep.ts":{"bytes":1402,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"src/example/definitions.ts","kind":"import-statement","original":"./definitions"},{"path":"@dxos/operation","kind":"import-statement","external":true}],"format":"esm"},"src/example/index.ts":{"bytes":1160,"imports":[{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/example/definitions.ts","kind":"import-statement","original":"./definitions"},{"path":"src/example/fib.ts","kind":"dynamic-import","original":"./fib"},{"path":"src/example/reply.ts","kind":"dynamic-import","original":"./reply"},{"path":"src/example/sleep.ts","kind":"dynamic-import","original":"./sleep"}],"format":"esm"},"src/sdk.ts":{"bytes":1781,"imports":[],"format":"esm"},"src/services/credentials.ts":{"bytes":16035,"imports":[{"path":"@effect/platform/HttpClient","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClientRequest","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Redacted","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true}],"format":"esm"},"src/services/tracing.ts":{"bytes":12828,"imports":[{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true}],"format":"esm"},"src/services/event-logger.ts":{"bytes":12036,"imports":[{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/services/tracing.ts","kind":"import-statement","original":"./tracing"}],"format":"esm"},"src/services/function-invocation-service.ts":{"bytes":4050,"imports":[{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true}],"format":"esm"},"src/services/queues.ts":{"bytes":6416,"imports":[{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true}],"format":"esm"},"src/services/index.ts":{"bytes":1416,"imports":[{"path":"src/services/credentials.ts","kind":"import-statement","original":"./credentials"},{"path":"src/services/credentials.ts","kind":"import-statement","original":"./credentials"},{"path":"src/services/event-logger.ts","kind":"import-statement","original":"./event-logger"},{"path":"src/services/event-logger.ts","kind":"import-statement","original":"./event-logger"},{"path":"src/services/function-invocation-service.ts","kind":"import-statement","original":"./function-invocation-service"},{"path":"src/services/queues.ts","kind":"import-statement","original":"./queues"},{"path":"src/services/tracing.ts","kind":"import-statement","original":"./tracing"}],"format":"esm"},"src/types/Script.ts":{"bytes":4368,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"src/types/Trigger.ts":{"bytes":16024,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true}],"format":"esm"},"src/types/TriggerEvent.ts":{"bytes":5983,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"format":"esm"},"src/types/url.ts":{"bytes":3375,"imports":[],"format":"esm"},"src/types/index.ts":{"bytes":909,"imports":[{"path":"src/types/Script.ts","kind":"import-statement","original":"./Script"},{"path":"src/types/Trigger.ts","kind":"import-statement","original":"./Trigger"},{"path":"src/types/TriggerEvent.ts","kind":"import-statement","original":"./TriggerEvent"},{"path":"src/types/url.ts","kind":"import-statement","original":"./url"}],"format":"esm"},"src/protocol/functions-ai-http-client.ts":{"bytes":9111,"imports":[{"path":"@effect/platform/Headers","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClient","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClientError","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClientResponse","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/FiberRef","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true}],"format":"esm"},"src/protocol/protocol.ts":{"bytes":36578,"imports":[{"path":"@effect/ai-anthropic/AnthropicClient","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/ai/resolvers","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"src/errors.ts","kind":"import-statement","original":"../errors"},{"path":"src/services/index.ts","kind":"import-statement","original":"../services"},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/protocol/functions-ai-http-client.ts","kind":"import-statement","original":"./functions-ai-http-client"}],"format":"esm"},"src/protocol/index.ts":{"bytes":459,"imports":[{"path":"src/protocol/protocol.ts","kind":"import-statement","original":"./protocol"}],"format":"esm"},"src/index.ts":{"bytes":867,"imports":[{"path":"src/errors.ts","kind":"import-statement","original":"./errors"},{"path":"src/example/index.ts","kind":"import-statement","original":"./example"},{"path":"src/sdk.ts","kind":"import-statement","original":"./sdk"},{"path":"src/services/index.ts","kind":"import-statement","original":"./services"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"},{"path":"src/protocol/index.ts","kind":"import-statement","original":"./protocol"}],"format":"esm"}},"outputs":{"dist/lib/neutral/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":65466},"dist/lib/neutral/index.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-GEM2K7BA.mjs","kind":"import-statement"},{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"dist/lib/neutral/fib-XBUKWUUS.mjs","kind":"dynamic-import"},{"path":"dist/lib/neutral/reply-XBQTXDLZ.mjs","kind":"dynamic-import"},{"path":"dist/lib/neutral/sleep-TLQKHAK2.mjs","kind":"dynamic-import"},{"path":"@effect/platform/HttpClient","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClientRequest","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Redacted","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@effect/ai-anthropic/AnthropicClient","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/ai/resolvers","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@effect/platform/Headers","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClient","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClientError","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClientResponse","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/FiberRef","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true}],"exports":["ComputeEvent","ComputeEventLogger","ComputeEventPayload","ConfiguredCredentialsService","ContextQueueService","CredentialsService","ExampleHandlers","FUNCTIONS_META_KEY","FUNCTIONS_PRESET_META_KEY","Fibonacci","FunctionError","FunctionInvocationService","FunctionNotFoundError","MESSAGE_PROPERTY_TOOL_CALL_ID","QueueService","Reply","Script","ServiceNotAvailableError","Sleep","TracingService","Trigger","TriggerEvent","TriggerStateNotFoundError","createDefectLogger","createEventLogger","getUserFunctionIdInMetadata","logCustomEvent","setUserFunctionIdInMetadata","withAuthorization","wrapFunctionHandler"],"entryPoint":"src/index.ts","inputs":{"src/errors.ts":{"bytesInOutput":736},"src/index.ts":{"bytesInOutput":0},"src/example/index.ts":{"bytesInOutput":215},"src/services/credentials.ts":{"bytesInOutput":3564},"src/services/index.ts":{"bytesInOutput":0},"src/services/event-logger.ts":{"bytesInOutput":2914},"src/services/tracing.ts":{"bytesInOutput":2514},"src/services/function-invocation-service.ts":{"bytesInOutput":820},"src/services/queues.ts":{"bytesInOutput":1233},"src/types/Script.ts":{"bytesInOutput":1027},"src/types/index.ts":{"bytesInOutput":0},"src/types/Trigger.ts":{"bytesInOutput":4031},"src/types/TriggerEvent.ts":{"bytesInOutput":1364},"src/types/url.ts":{"bytesInOutput":576},"src/protocol/protocol.ts":{"bytesInOutput":10448},"src/protocol/functions-ai-http-client.ts":{"bytesInOutput":2183}},"bytes":32899},"dist/lib/neutral/fib-XBUKWUUS.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1006},"dist/lib/neutral/fib-XBUKWUUS.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-GEM2K7BA.mjs","kind":"import-statement"},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/example/fib.ts","inputs":{"src/example/fib.ts":{"bytesInOutput":333}},"bytes":487},"dist/lib/neutral/reply-XBQTXDLZ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":801},"dist/lib/neutral/reply-XBQTXDLZ.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-GEM2K7BA.mjs","kind":"import-statement"},{"path":"effect/Console","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/example/reply.ts","inputs":{"src/example/reply.ts":{"bytesInOutput":282}},"bytes":438},"dist/lib/neutral/sleep-TLQKHAK2.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":709},"dist/lib/neutral/sleep-TLQKHAK2.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-GEM2K7BA.mjs","kind":"import-statement"},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/example/sleep.ts","inputs":{"src/example/sleep.ts":{"bytesInOutput":221}},"bytes":377},"dist/lib/neutral/chunk-GEM2K7BA.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2128},"dist/lib/neutral/chunk-GEM2K7BA.mjs":{"imports":[{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true}],"exports":["Fibonacci","Reply","Sleep","__export"],"inputs":{"src/example/definitions.ts":{"bytesInOutput":1032}},"bytes":1329}}}
@@ -0,0 +1,18 @@
1
+ import {
2
+ Reply
3
+ } from "./chunk-GEM2K7BA.mjs";
4
+
5
+ // src/example/reply.ts
6
+ import * as Console from "effect/Console";
7
+ import * as Effect from "effect/Effect";
8
+ import { Operation } from "@dxos/operation";
9
+ var reply_default = Reply.pipe(Operation.withHandler(Effect.fn(function* (input) {
10
+ yield* Console.log("reply", {
11
+ input
12
+ });
13
+ return input;
14
+ })));
15
+ export {
16
+ reply_default as default
17
+ };
18
+ //# sourceMappingURL=reply-XBQTXDLZ.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/example/reply.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Console from 'effect/Console';\nimport * as Effect from 'effect/Effect';\n\nimport { Operation } from '@dxos/operation';\nimport { Reply } from './definitions';\n\nexport default Reply.pipe(\n Operation.withHandler(\n Effect.fn(function* (input) {\n yield* Console.log('reply', { input });\n return input;\n }),\n ),\n);\n"],
5
+ "mappings": ";;;;;AAIA,YAAYA,aAAa;AACzB,YAAYC,YAAY;AAExB,SAASC,iBAAiB;AAG1B,IAAA,gBAAeC,MAAMC,KACnBC,UAAUC,YACDC,UAAG,WAAWC,OAAK;AACxB,SAAeC,YAAI,SAAS;IAAED;EAAM,CAAA;AACpC,SAAOA;AACT,CAAA,CAAA,CAAA;",
6
+ "names": ["Console", "Effect", "Operation", "Reply", "pipe", "Operation", "withHandler", "fn", "input", "log"]
7
+ }
@@ -0,0 +1,14 @@
1
+ import {
2
+ Sleep
3
+ } from "./chunk-GEM2K7BA.mjs";
4
+
5
+ // src/example/sleep.ts
6
+ import * as Effect from "effect/Effect";
7
+ import { Operation } from "@dxos/operation";
8
+ var sleep_default = Sleep.pipe(Operation.withHandler(Effect.fn(function* ({ duration = 1e5 }) {
9
+ yield* Effect.sleep(duration);
10
+ })));
11
+ export {
12
+ sleep_default as default
13
+ };
14
+ //# sourceMappingURL=sleep-TLQKHAK2.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/example/sleep.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport { Sleep } from './definitions';\nimport { Operation } from '@dxos/operation';\n\nexport default Sleep.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ duration = 100_000 }) {\n yield* Effect.sleep(duration);\n }),\n ),\n);\n"],
5
+ "mappings": ";;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,iBAAiB;AAE1B,IAAA,gBAAeC,MAAMC,KACnBC,UAAUC,YACDC,UAAG,WAAW,EAAEC,WAAW,IAAO,GAAE;AACzC,SAAcC,aAAMD,QAAAA;AACtB,CAAA,CAAA,CAAA;",
6
+ "names": ["Effect", "Operation", "Sleep", "pipe", "Operation", "withHandler", "fn", "duration", "sleep"]
7
+ }
@@ -1,28 +1,26 @@
1
1
  import { BaseError, type BaseErrorOptions } from '@dxos/errors';
2
2
  declare const ServiceNotAvailableError_base: {
3
3
  new (options?: BaseErrorOptions): {
4
- code: "SERVICE_NOT_AVAILABLE";
4
+ name: "ServiceNotAvailable";
5
5
  context: Record<string, unknown>;
6
- readonly name: "SERVICE_NOT_AVAILABLE";
7
6
  readonly message: string;
8
- readonly _tag: "SERVICE_NOT_AVAILABLE";
7
+ readonly _tag: "ServiceNotAvailable";
9
8
  stack?: string;
10
9
  cause?: unknown;
11
10
  };
12
- code: "SERVICE_NOT_AVAILABLE";
11
+ name: "ServiceNotAvailable";
13
12
  is(error: unknown): error is BaseError;
14
13
  wrap(options?: Omit<BaseErrorOptions, "cause"> & {
15
14
  ifTypeDiffers?: boolean;
16
15
  }): (error: unknown) => {
17
- code: "SERVICE_NOT_AVAILABLE";
16
+ name: "ServiceNotAvailable";
18
17
  context: Record<string, unknown>;
19
- readonly name: "SERVICE_NOT_AVAILABLE";
20
18
  readonly message: string;
21
- readonly _tag: "SERVICE_NOT_AVAILABLE";
19
+ readonly _tag: "ServiceNotAvailable";
22
20
  stack?: string;
23
21
  cause?: unknown;
24
22
  };
25
- extend<Code extends string = string>(code: Code, message?: string): any;
23
+ extend<Name extends string = string>(name: Name, message?: string): any;
26
24
  isError(error: unknown): error is Error;
27
25
  captureStackTrace(targetObject: object, constructorOpt?: Function): void;
28
26
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
@@ -33,28 +31,26 @@ export declare class ServiceNotAvailableError extends ServiceNotAvailableError_b
33
31
  }
34
32
  declare const FunctionNotFoundError_base: {
35
33
  new (options?: BaseErrorOptions): {
36
- code: "FUNCTION_NOT_FOUND";
34
+ name: "FunctionNotFound";
37
35
  context: Record<string, unknown>;
38
- readonly name: "FUNCTION_NOT_FOUND";
39
36
  readonly message: string;
40
- readonly _tag: "FUNCTION_NOT_FOUND";
37
+ readonly _tag: "FunctionNotFound";
41
38
  stack?: string;
42
39
  cause?: unknown;
43
40
  };
44
- code: "FUNCTION_NOT_FOUND";
41
+ name: "FunctionNotFound";
45
42
  is(error: unknown): error is BaseError;
46
43
  wrap(options?: Omit<BaseErrorOptions, "cause"> & {
47
44
  ifTypeDiffers?: boolean;
48
45
  }): (error: unknown) => {
49
- code: "FUNCTION_NOT_FOUND";
46
+ name: "FunctionNotFound";
50
47
  context: Record<string, unknown>;
51
- readonly name: "FUNCTION_NOT_FOUND";
52
48
  readonly message: string;
53
- readonly _tag: "FUNCTION_NOT_FOUND";
49
+ readonly _tag: "FunctionNotFound";
54
50
  stack?: string;
55
51
  cause?: unknown;
56
52
  };
57
- extend<Code extends string = string>(code: Code, message?: string): any;
53
+ extend<Name extends string = string>(name: Name, message?: string): any;
58
54
  isError(error: unknown): error is Error;
59
55
  captureStackTrace(targetObject: object, constructorOpt?: Function): void;
60
56
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
@@ -65,28 +61,26 @@ export declare class FunctionNotFoundError extends FunctionNotFoundError_base {
65
61
  }
66
62
  declare const FunctionError_base: {
67
63
  new (options?: BaseErrorOptions): {
68
- code: "FUNCTION_ERROR";
64
+ name: "FunctionError";
69
65
  context: Record<string, unknown>;
70
- readonly name: "FUNCTION_ERROR";
71
66
  readonly message: string;
72
- readonly _tag: "FUNCTION_ERROR";
67
+ readonly _tag: "FunctionError";
73
68
  stack?: string;
74
69
  cause?: unknown;
75
70
  };
76
- code: "FUNCTION_ERROR";
71
+ name: "FunctionError";
77
72
  is(error: unknown): error is BaseError;
78
73
  wrap(options?: Omit<BaseErrorOptions, "cause"> & {
79
74
  ifTypeDiffers?: boolean;
80
75
  }): (error: unknown) => {
81
- code: "FUNCTION_ERROR";
76
+ name: "FunctionError";
82
77
  context: Record<string, unknown>;
83
- readonly name: "FUNCTION_ERROR";
84
78
  readonly message: string;
85
- readonly _tag: "FUNCTION_ERROR";
79
+ readonly _tag: "FunctionError";
86
80
  stack?: string;
87
81
  cause?: unknown;
88
82
  };
89
- extend<Code extends string = string>(code: Code, message?: string): any;
83
+ extend<Name extends string = string>(name: Name, message?: string): any;
90
84
  isError(error: unknown): error is Error;
91
85
  captureStackTrace(targetObject: object, constructorOpt?: Function): void;
92
86
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
@@ -96,28 +90,26 @@ export declare class FunctionError extends FunctionError_base {
96
90
  }
97
91
  declare const TriggerStateNotFoundError_base: {
98
92
  new (options?: BaseErrorOptions): {
99
- code: "TRIGGER_STATE_NOT_FOUND";
93
+ name: "TriggerStateNotFound";
100
94
  context: Record<string, unknown>;
101
- readonly name: "TRIGGER_STATE_NOT_FOUND";
102
95
  readonly message: string;
103
- readonly _tag: "TRIGGER_STATE_NOT_FOUND";
96
+ readonly _tag: "TriggerStateNotFound";
104
97
  stack?: string;
105
98
  cause?: unknown;
106
99
  };
107
- code: "TRIGGER_STATE_NOT_FOUND";
100
+ name: "TriggerStateNotFound";
108
101
  is(error: unknown): error is BaseError;
109
102
  wrap(options?: Omit<BaseErrorOptions, "cause"> & {
110
103
  ifTypeDiffers?: boolean;
111
104
  }): (error: unknown) => {
112
- code: "TRIGGER_STATE_NOT_FOUND";
105
+ name: "TriggerStateNotFound";
113
106
  context: Record<string, unknown>;
114
- readonly name: "TRIGGER_STATE_NOT_FOUND";
115
107
  readonly message: string;
116
- readonly _tag: "TRIGGER_STATE_NOT_FOUND";
108
+ readonly _tag: "TriggerStateNotFound";
117
109
  stack?: string;
118
110
  cause?: unknown;
119
111
  };
120
- extend<Code extends string = string>(code: Code, message?: string): any;
112
+ extend<Name extends string = string>(name: Name, message?: string): any;
121
113
  isError(error: unknown): error is Error;
122
114
  captureStackTrace(targetObject: object, constructorOpt?: Function): void;
123
115
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;;;;;;;;;;;;;;qBAiBkQ,CAAC;;;;;;;;;;;;;;;;AAfnU,qBAAa,wBAAyB,SAAQ,6BAAkE;gBAClG,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC;CAGzE;;;;;;;;;;;;;;qBAWiU,CAAC;;;;;;;;;;;;;;;;AATnU,qBAAa,qBAAsB,SAAQ,0BAA4D;gBACzF,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC;CAG7E;;;;;;;;;;;;;;qBAKiU,CAAC;;;;;;;;;;;;;;;;AAHnU,qBAAa,aAAc,SAAQ,kBAA+D;CAAG;;;;;;;;;;;;;;qBAG6N,CAAC;;;;;;;;;;;;;;;;AADnU,qBAAa,yBAA0B,SAAQ,8BAAsE;CAAG"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;;;;;;;;;;;;;qBAiB4O,CAAC;;;;;;;;;;;;;;;AAf7S,qBAAa,wBAAyB,SAAQ,6BAAgE;gBAChG,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC;CAGzE;;;;;;;;;;;;;qBAW2S,CAAC;;;;;;;;;;;;;;;AAT7S,qBAAa,qBAAsB,SAAQ,0BAA0D;gBACvF,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC;CAG7E;;;;;;;;;;;;;qBAK2S,CAAC;;;;;;;;;;;;;;;AAH7S,qBAAa,aAAc,SAAQ,kBAA8D;CAAG;;;;;;;;;;;;;qBAGwM,CAAC;;;;;;;;;;;;;;;AAD7S,qBAAa,yBAA0B,SAAQ,8BAAmE;CAAG"}
@@ -0,0 +1,11 @@
1
+ import { Operation } from '@dxos/operation';
2
+ export declare const Fibonacci: Operation.Definition<{
3
+ readonly iterations?: number | undefined;
4
+ }, {
5
+ readonly result: string;
6
+ }, never>;
7
+ export declare const Reply: Operation.Definition<any, any, never>;
8
+ export declare const Sleep: Operation.Definition<{
9
+ readonly duration?: number | undefined;
10
+ }, void, never>;
11
+ //# sourceMappingURL=definitions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../../../src/example/definitions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,eAAO,MAAM,SAAS;;;;SAepB,CAAC;AAEH,eAAO,MAAM,KAAK,uCAQhB,CAAC;AAEH,eAAO,MAAM,KAAK;;eAahB,CAAC"}
@@ -1,7 +1,8 @@
1
- declare const _default: import("..").FunctionDefinition<{
1
+ import { Operation } from '@dxos/operation';
2
+ declare const _default: Operation.WithHandler<Operation.Definition<{
2
3
  readonly iterations?: number | undefined;
3
4
  }, {
4
5
  readonly result: string;
5
- }, import("..").FunctionServices>;
6
+ }, never>>;
6
7
  export default _default;
7
8
  //# sourceMappingURL=fib.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fib.d.ts","sourceRoot":"","sources":["../../../../src/example/fib.ts"],"names":[],"mappings":";;;;;AASA,wBAsBG"}
1
+ {"version":3,"file":"fib.d.ts","sourceRoot":"","sources":["../../../../src/example/fib.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;;;;;;AAG5C,wBAYE"}
@@ -1,12 +1,4 @@
1
- export declare namespace Example {
2
- const fib: import("..").FunctionDefinition<{
3
- readonly iterations?: number | undefined;
4
- }, {
5
- readonly result: string;
6
- }, import("..").FunctionServices>;
7
- const reply: import("..").FunctionDefinition<any, any, import("..").FunctionServices>;
8
- const sleep: import("..").FunctionDefinition<{
9
- readonly duration?: number | undefined;
10
- }, void, import("..").FunctionServices>;
11
- }
1
+ import { OperationHandlerSet } from '@dxos/operation';
2
+ export * from './definitions';
3
+ export declare const ExampleHandlers: OperationHandlerSet.OperationHandlerSet;
12
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/example/index.ts"],"names":[],"mappings":"AAQA,yBAAiB,OAAO,CAAC;IAChB,MAAM,GAAG;;;;qCAAO,CAAC;IACjB,MAAM,KAAK,0EAAS,CAAC;IACrB,MAAM,KAAK;;2CAAS,CAAC;CAC7B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/example/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,cAAc,eAAe,CAAC;AAE9B,eAAO,MAAM,eAAe,yCAI3B,CAAC"}
@@ -1,3 +1,4 @@
1
- declare const _default: import("..").FunctionDefinition<any, any, import("..").FunctionServices>;
1
+ import { Operation } from '@dxos/operation';
2
+ declare const _default: Operation.WithHandler<Operation.Definition<any, any, never>>;
2
3
  export default _default;
3
4
  //# sourceMappingURL=reply.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../../../src/example/reply.ts"],"names":[],"mappings":";AAUA,wBAUG"}
1
+ {"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../../../src/example/reply.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;;AAG5C,wBAOE"}
@@ -1,5 +1,6 @@
1
- declare const _default: import("..").FunctionDefinition<{
1
+ import { Operation } from '@dxos/operation';
2
+ declare const _default: Operation.WithHandler<Operation.Definition<{
2
3
  readonly duration?: number | undefined;
3
- }, void, import("..").FunctionServices>;
4
+ }, void, never>>;
4
5
  export default _default;
5
6
  //# sourceMappingURL=sleep.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../../../src/example/sleep.ts"],"names":[],"mappings":";;;AASA,wBAcG"}
1
+ {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../../../src/example/sleep.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;;;;AAE5C,wBAME"}
@@ -0,0 +1,12 @@
1
+ import * as HttpClient from '@effect/platform/HttpClient';
2
+ import * as Layer from 'effect/Layer';
3
+ import { type EdgeFunctionEnv } from '@dxos/protocols';
4
+ /**
5
+ * Copy pasted from https://github.com/Effect-TS/effect/blob/main/packages/platform/src/internal/fetchHttpClient.ts
6
+ */
7
+ export declare const requestInitTagKey = "@effect/platform/FetchHttpClient/FetchOptions";
8
+ export declare class FunctionsAiHttpClient {
9
+ static make: (service: EdgeFunctionEnv.FunctionsAiService) => HttpClient.HttpClient;
10
+ static layer: (service: EdgeFunctionEnv.FunctionsAiService) => Layer.Layer<HttpClient.HttpClient, never, never>;
11
+ }
12
+ //# sourceMappingURL=functions-ai-http-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions-ai-http-client.d.ts","sourceRoot":"","sources":["../../../../src/protocol/functions-ai-http-client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAK1D,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,OAAO,EAAE,KAAK,eAAe,EAAc,MAAM,iBAAiB,CAAC;AACnE;;GAEG;AACH,eAAO,MAAM,iBAAiB,kDAAkD,CAAC;AAEjF,qBAAa,qBAAqB;IAChC,MAAM,CAAC,IAAI,GAAI,SAAS,eAAe,CAAC,kBAAkB,2BAyCrD;IAEL,MAAM,CAAC,KAAK,GAAI,SAAS,eAAe,CAAC,kBAAkB,sDACiB;CAC7E"}
@@ -1,7 +1,7 @@
1
1
  import { type FunctionProtocol } from '@dxos/protocols';
2
- import { FunctionDefinition } from '../sdk';
2
+ import { Operation } from '@dxos/operation';
3
3
  /**
4
4
  * Wraps a function handler made with `defineFunction` to a protocol that the functions-runtime expects.
5
5
  */
6
- export declare const wrapFunctionHandler: (func: FunctionDefinition) => FunctionProtocol.Func;
6
+ export declare const wrapFunctionHandler: (func: Operation.WithHandler<Operation.Definition.Any>) => FunctionProtocol.Func;
7
7
  //# sourceMappingURL=protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../../src/protocol/protocol.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGxD,OAAO,EAAE,kBAAkB,EAAyB,MAAM,QAAQ,CAAC;AAInE;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,kBAAkB,KAAG,gBAAgB,CAAC,IA6D/E,CAAC"}
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../../src/protocol/protocol.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAKxD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,KAAG,gBAAgB,CAAC,IAwE5G,CAAC"}