@dxos/functions 0.8.4-main.67995b8 → 0.8.4-main.72ec0f3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/dist/lib/browser/index.mjs +789 -363
  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 +789 -363
  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 +89 -28
  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/protocol/index.d.ts +2 -0
  22. package/dist/types/src/protocol/index.d.ts.map +1 -0
  23. package/dist/types/src/protocol/protocol.d.ts +7 -0
  24. package/dist/types/src/protocol/protocol.d.ts.map +1 -0
  25. package/dist/types/src/protocol/protocol.test.d.ts +2 -0
  26. package/dist/types/src/protocol/protocol.test.d.ts.map +1 -0
  27. package/dist/types/src/sdk.d.ts +89 -0
  28. package/dist/types/src/sdk.d.ts.map +1 -0
  29. package/dist/types/src/services/credentials.d.ts +19 -3
  30. package/dist/types/src/services/credentials.d.ts.map +1 -1
  31. package/dist/types/src/services/event-logger.d.ts +20 -5
  32. package/dist/types/src/services/event-logger.d.ts.map +1 -1
  33. package/dist/types/src/services/function-invocation-service.d.ts +11 -0
  34. package/dist/types/src/services/function-invocation-service.d.ts.map +1 -0
  35. package/dist/types/src/services/index.d.ts +6 -6
  36. package/dist/types/src/services/index.d.ts.map +1 -1
  37. package/dist/types/src/services/queues.d.ts +21 -5
  38. package/dist/types/src/services/queues.d.ts.map +1 -1
  39. package/dist/types/src/services/tracing.d.ts +34 -6
  40. package/dist/types/src/services/tracing.d.ts.map +1 -1
  41. package/dist/types/src/types/Function.d.ts +58 -0
  42. package/dist/types/src/types/Function.d.ts.map +1 -0
  43. package/dist/types/src/types/Script.d.ts +28 -0
  44. package/dist/types/src/types/Script.d.ts.map +1 -0
  45. package/dist/types/src/types/Trigger.d.ts +139 -0
  46. package/dist/types/src/types/Trigger.d.ts.map +1 -0
  47. package/dist/types/src/types/TriggerEvent.d.ts +44 -0
  48. package/dist/types/src/types/TriggerEvent.d.ts.map +1 -0
  49. package/dist/types/src/types/index.d.ts +6 -0
  50. package/dist/types/src/types/index.d.ts.map +1 -0
  51. package/dist/types/src/types/url.d.ts +12 -0
  52. package/dist/types/src/types/url.d.ts.map +1 -0
  53. package/dist/types/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +20 -74
  55. package/src/errors.ts +13 -5
  56. package/src/example/fib.ts +32 -0
  57. package/src/example/forex-effect.ts +40 -0
  58. package/src/example/index.ts +13 -0
  59. package/src/example/reply.ts +21 -0
  60. package/src/example/sleep.ts +24 -0
  61. package/src/index.ts +5 -9
  62. package/src/{executor → protocol}/index.ts +1 -1
  63. package/src/protocol/protocol.test.ts +59 -0
  64. package/src/protocol/protocol.ts +145 -0
  65. package/src/sdk.ts +226 -0
  66. package/src/services/credentials.ts +84 -5
  67. package/src/services/event-logger.ts +13 -4
  68. package/src/services/function-invocation-service.ts +23 -0
  69. package/src/services/index.ts +7 -6
  70. package/src/services/queues.ts +36 -10
  71. package/src/services/tracing.ts +81 -17
  72. package/src/types/Function.ts +62 -0
  73. package/src/types/Script.ts +33 -0
  74. package/src/types/Trigger.ts +139 -0
  75. package/src/types/TriggerEvent.ts +62 -0
  76. package/src/types/index.ts +9 -0
  77. package/src/types/url.ts +31 -0
  78. package/dist/lib/browser/bundler/index.mjs +0 -247
  79. package/dist/lib/browser/bundler/index.mjs.map +0 -7
  80. package/dist/lib/browser/chunk-6PTFLPCO.mjs +0 -462
  81. package/dist/lib/browser/chunk-6PTFLPCO.mjs.map +0 -7
  82. package/dist/lib/browser/edge/index.mjs +0 -69
  83. package/dist/lib/browser/edge/index.mjs.map +0 -7
  84. package/dist/lib/browser/testing/index.mjs +0 -59
  85. package/dist/lib/browser/testing/index.mjs.map +0 -7
  86. package/dist/lib/node-esm/bundler/index.mjs +0 -249
  87. package/dist/lib/node-esm/bundler/index.mjs.map +0 -7
  88. package/dist/lib/node-esm/chunk-NYJ2TSXO.mjs +0 -464
  89. package/dist/lib/node-esm/chunk-NYJ2TSXO.mjs.map +0 -7
  90. package/dist/lib/node-esm/edge/index.mjs +0 -71
  91. package/dist/lib/node-esm/edge/index.mjs.map +0 -7
  92. package/dist/lib/node-esm/testing/index.mjs +0 -60
  93. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  94. package/dist/types/src/bundler/bundler.d.ts +0 -50
  95. package/dist/types/src/bundler/bundler.d.ts.map +0 -1
  96. package/dist/types/src/bundler/bundler.test.d.ts +0 -2
  97. package/dist/types/src/bundler/bundler.test.d.ts.map +0 -1
  98. package/dist/types/src/bundler/index.d.ts +0 -2
  99. package/dist/types/src/bundler/index.d.ts.map +0 -1
  100. package/dist/types/src/edge/functions.d.ts +0 -16
  101. package/dist/types/src/edge/functions.d.ts.map +0 -1
  102. package/dist/types/src/edge/index.d.ts +0 -2
  103. package/dist/types/src/edge/index.d.ts.map +0 -1
  104. package/dist/types/src/executor/executor.d.ts +0 -8
  105. package/dist/types/src/executor/executor.d.ts.map +0 -1
  106. package/dist/types/src/executor/index.d.ts +0 -2
  107. package/dist/types/src/executor/index.d.ts.map +0 -1
  108. package/dist/types/src/handler.d.ts +0 -62
  109. package/dist/types/src/handler.d.ts.map +0 -1
  110. package/dist/types/src/schema.d.ts +0 -38
  111. package/dist/types/src/schema.d.ts.map +0 -1
  112. package/dist/types/src/services/database.d.ts +0 -30
  113. package/dist/types/src/services/database.d.ts.map +0 -1
  114. package/dist/types/src/services/local-function-execution.d.ts +0 -11
  115. package/dist/types/src/services/local-function-execution.d.ts.map +0 -1
  116. package/dist/types/src/services/remote-function-execution-service.d.ts +0 -15
  117. package/dist/types/src/services/remote-function-execution-service.d.ts.map +0 -1
  118. package/dist/types/src/services/service-container.d.ts +0 -56
  119. package/dist/types/src/services/service-container.d.ts.map +0 -1
  120. package/dist/types/src/services/service-registry.d.ts +0 -29
  121. package/dist/types/src/services/service-registry.d.ts.map +0 -1
  122. package/dist/types/src/services/service-registry.test.d.ts +0 -2
  123. package/dist/types/src/services/service-registry.test.d.ts.map +0 -1
  124. package/dist/types/src/testing/index.d.ts +0 -3
  125. package/dist/types/src/testing/index.d.ts.map +0 -1
  126. package/dist/types/src/testing/layer.d.ts +0 -10
  127. package/dist/types/src/testing/layer.d.ts.map +0 -1
  128. package/dist/types/src/testing/logger.d.ts +0 -5
  129. package/dist/types/src/testing/logger.d.ts.map +0 -1
  130. package/dist/types/src/testing/services.d.ts +0 -59
  131. package/dist/types/src/testing/services.d.ts.map +0 -1
  132. package/dist/types/src/trace.d.ts +0 -124
  133. package/dist/types/src/trace.d.ts.map +0 -1
  134. package/dist/types/src/translations.d.ts +0 -12
  135. package/dist/types/src/translations.d.ts.map +0 -1
  136. package/dist/types/src/types.d.ts +0 -411
  137. package/dist/types/src/types.d.ts.map +0 -1
  138. package/dist/types/src/url.d.ts +0 -17
  139. package/dist/types/src/url.d.ts.map +0 -1
  140. package/src/bundler/bundler.test.ts +0 -59
  141. package/src/bundler/bundler.ts +0 -292
  142. package/src/bundler/index.ts +0 -5
  143. package/src/edge/functions.ts +0 -64
  144. package/src/edge/index.ts +0 -9
  145. package/src/executor/executor.ts +0 -54
  146. package/src/handler.ts +0 -120
  147. package/src/schema.ts +0 -57
  148. package/src/services/database.ts +0 -74
  149. package/src/services/local-function-execution.ts +0 -70
  150. package/src/services/remote-function-execution-service.ts +0 -66
  151. package/src/services/service-container.ts +0 -113
  152. package/src/services/service-registry.test.ts +0 -42
  153. package/src/services/service-registry.ts +0 -59
  154. package/src/testing/index.ts +0 -6
  155. package/src/testing/layer.ts +0 -31
  156. package/src/testing/logger.ts +0 -16
  157. package/src/testing/services.ts +0 -114
  158. package/src/trace.ts +0 -180
  159. package/src/translations.ts +0 -20
  160. package/src/types.ts +0 -211
  161. package/src/url.ts +0 -52
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/handler.ts", "../../../src/schema.ts", "../../../src/trace.ts", "../../../src/types.ts", "../../../src/url.ts", "../../../src/executor/executor.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema, type Context, type Effect } from 'effect';\n\nimport { type AiServiceClient } from '@dxos/ai';\n// import { type Space } from '@dxos/client/echo';\nimport type { EchoDatabase } from '@dxos/echo-db';\nimport { type HasId } from '@dxos/echo-schema';\nimport { type SpaceId, type DXN } from '@dxos/keys';\nimport { type QueryResult } from '@dxos/protocols';\n\nimport type { Services } from './services';\n\n// TODO(burdon): Model after http request. Ref Lambda/OpenFaaS.\n// https://docs.aws.amazon.com/lambda/latest/dg/typescript-handler.html\n// https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/#functions\n// https://www.npmjs.com/package/aws-lambda\n\n/**\n * Function handler.\n */\nexport type FunctionHandler<TData = {}, TOutput = any> = (params: {\n /**\n * Services and context available to the function.\n */\n context: FunctionContext;\n\n /**\n * Data passed as the input to the function.\n * Must match the function's input schema.\n * This will be the payload from the trigger or other data passed into the function in a workflow.\n */\n data: TData;\n}) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any, Services>;\n\n/**\n * Function context.\n */\nexport interface FunctionContext {\n /**\n * Space from which the function was invoked.\n */\n space: SpaceAPI | undefined;\n\n ai: AiServiceClient;\n\n /**\n * Resolves a service available to the function.\n * @throws if the service is not available.\n */\n getService: <T extends Context.Tag<any, any>>(tag: T) => Context.Tag.Service<T>;\n\n getSpace: (spaceId: SpaceId) => Promise<SpaceAPI>;\n}\n\nexport interface FunctionContextAi {\n // TODO(dmaretskyi): Refer to cloudflare AI docs for more comprehensive typedefs.\n run(model: string, inputs: any, options?: any): Promise<any>;\n}\n\n//\n// API.\n//\n\n// TODO(dmaretskyi): Temporary API to get the queues working.\n// TODO(dmaretskyi): To be replaced with integrating queues into echo.\nexport interface QueuesAPI {\n queryQueue(queue: DXN, options?: {}): Promise<QueryResult>;\n insertIntoQueue(queue: DXN, objects: HasId[]): Promise<void>;\n}\n\n/**\n * Space interface available to functions.\n */\nexport interface SpaceAPI {\n get id(): SpaceId;\n get db(): EchoDatabase;\n\n // TODO(dmaretskyi): Align with echo api: queues.get(id).append(items);\n get queues(): QueuesAPI;\n}\n\n// TODO(wittjosiah): Queues are incompatible.\nconst __assertFunctionSpaceIsCompatibleWithTheClientSpace = () => {\n // const _: SpaceAPI = {} as Space;\n};\n\nexport type FunctionDefinition<T = {}, O = any> = {\n name: string;\n description?: string;\n inputSchema: Schema.Schema<T, any>;\n outputSchema?: Schema.Schema<O, any>;\n handler: FunctionHandler<T, O>;\n};\n\n// TODO(dmaretskyi): Bind input type to function handler.\nexport const defineFunction = <T, O>({\n name,\n description,\n inputSchema,\n outputSchema = Schema.Any,\n handler,\n}: FunctionDefinition<T, O>): FunctionDefinition<T, O> => {\n if (!Schema.isSchema(inputSchema)) {\n throw new Error('Input schema must be a valid schema');\n }\n if (typeof handler !== 'function') {\n throw new Error('Handler must be a function');\n }\n\n return {\n name,\n description,\n inputSchema,\n outputSchema,\n handler,\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Type } from '@dxos/echo';\nimport { JsonSchemaType, LabelAnnotation, Ref } from '@dxos/echo-schema';\nimport { DataType } from '@dxos/schema';\n\n/**\n * Source script.\n */\nexport const ScriptType = Schema.Struct({\n name: Schema.optional(Schema.String),\n description: Schema.optional(Schema.String),\n // TODO(burdon): Change to hash of deployed content.\n // Whether source has changed since last deploy.\n changed: Schema.optional(Schema.Boolean),\n source: Ref(DataType.Text),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Script',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n);\n\nexport interface ScriptType extends Schema.Schema.Type<typeof ScriptType> {}\n\n/**\n * Function deployment.\n */\nexport const FunctionType = Schema.Struct({\n // TODO(burdon): Rename to id/uri?\n name: Schema.NonEmptyString,\n version: Schema.String,\n\n description: Schema.optional(Schema.String),\n\n // Reference to a source script if it exists within ECHO.\n // TODO(burdon): Don't ref ScriptType directly (core).\n source: Schema.optional(Ref(ScriptType)),\n\n inputSchema: Schema.optional(JsonSchemaType),\n outputSchema: Schema.optional(JsonSchemaType),\n\n // Local binding to a function name.\n binding: Schema.optional(Schema.String),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Function',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n);\nexport interface FunctionType extends Schema.Schema.Type<typeof FunctionType> {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Type, type Ref } from '@dxos/echo';\nimport { Queue } from '@dxos/echo-db';\nimport { ObjectId } from '@dxos/echo-schema';\nimport { log } from '@dxos/log';\n\nimport { FunctionTrigger, type FunctionTriggerType } from './types';\n\nexport enum InvocationOutcome {\n SUCCESS = 'success',\n FAILURE = 'failure',\n PENDING = 'pending',\n}\n\n// TODO(burdon): Convert to extensible discriminated union of EDGE events.\nexport enum InvocationTraceEventType {\n START = 'start',\n END = 'end',\n}\n\nexport const TraceEventException = Schema.Struct({\n timestampMs: Schema.Number,\n message: Schema.String,\n name: Schema.String,\n stack: Schema.optional(Schema.String),\n});\nexport type TraceEventException = Schema.Schema.Type<typeof TraceEventException>;\n\nexport const InvocationTraceStartEvent = Schema.Struct({\n /**\n * Queue message id.\n */\n id: ObjectId,\n type: Schema.Literal(InvocationTraceEventType.START),\n /**\n * Invocation id, the same for invocation start and end events.\n */\n invocationId: ObjectId,\n /**\n * Event generation time.\n */\n timestampMs: Schema.Number,\n /**\n * Data passed to function / workflow as an argument.\n */\n // TODO(burdon): Input schema?\n input: Schema.Object,\n /**\n * Queue for function/workflow invocation events.\n */\n invocationTraceQueue: Type.Ref(Queue),\n /**\n * DXN of the invoked function/workflow.\n */\n invocationTarget: Type.Ref(Type.Expando),\n /**\n * Present for automatic invocations.\n */\n trigger: Schema.optional(Type.Ref(FunctionTrigger)),\n}).pipe(Type.Obj({ typename: 'dxos.org/type/InvocationTraceStart', version: '0.1.0' }));\n\nexport type InvocationTraceStartEvent = Schema.Schema.Type<typeof InvocationTraceStartEvent>;\n\nexport const InvocationTraceEndEvent = Schema.Struct({\n /**\n * Trace event id.\n */\n id: ObjectId,\n type: Schema.Literal(InvocationTraceEventType.END),\n /**\n * Invocation id, will be the same for invocation start and end.\n */\n invocationId: ObjectId,\n /**\n * Event generation time.\n */\n // TODO(burdon): Remove ms suffix.\n timestampMs: Schema.Number,\n outcome: Schema.Enums(InvocationOutcome),\n exception: Schema.optional(TraceEventException),\n}).pipe(Type.Obj({ typename: 'dxos.org/type/InvocationTraceEnd', version: '0.1.0' }));\n\nexport type InvocationTraceEndEvent = Schema.Schema.Type<typeof InvocationTraceEndEvent>;\n\nexport type InvocationTraceEvent = InvocationTraceStartEvent | InvocationTraceEndEvent;\n\nexport const TraceEventLog = Schema.Struct({\n timestampMs: Schema.Number,\n level: Schema.String,\n message: Schema.String,\n context: Schema.optional(Schema.Object),\n});\n\nexport const TraceEvent = Schema.Struct({\n id: ObjectId,\n // TODO(burdon): Need enum/numeric result (not string).\n outcome: Schema.String,\n truncated: Schema.Boolean,\n /**\n * Time when the event was persisted.\n */\n ingestionTimestampMs: Schema.Number,\n logs: Schema.Array(TraceEventLog),\n exceptions: Schema.Array(TraceEventException),\n}).pipe(Type.Obj({ typename: 'dxos.org/type/TraceEvent', version: '0.1.0' }));\n\nexport type TraceEvent = Schema.Schema.Type<typeof TraceEvent>;\n\n/**\n * InvocationTrace event format.\n * This is the combined format of InvocationTraceStartEvent and InvocationTraceEndEvents for UI consumption.\n */\nexport type InvocationSpan = {\n id: string;\n timestampMs: number;\n outcome: InvocationOutcome;\n input: object;\n durationMs: number;\n invocationTraceQueue: Ref.Ref<Queue>;\n invocationTarget: Ref.Ref<Type.Expando>;\n trigger?: Ref.Ref<FunctionTriggerType>;\n exception?: TraceEventException;\n};\n\nexport const createInvocationSpans = (items?: InvocationTraceEvent[]): InvocationSpan[] => {\n if (!items) {\n return [];\n }\n\n const eventsByInvocationId = new Map<string, { start?: InvocationTraceStartEvent; end?: InvocationTraceEndEvent }>();\n for (const event of items) {\n if (!('invocationId' in event)) {\n // Skip legacy format entries.\n continue;\n }\n\n const invocationId = event.invocationId;\n const entry = eventsByInvocationId.get(invocationId) || { start: undefined, end: undefined };\n if (event.type === InvocationTraceEventType.START) {\n entry.start = event as InvocationTraceStartEvent;\n } else if (event.type === InvocationTraceEventType.END) {\n entry.end = event as InvocationTraceEndEvent;\n }\n\n eventsByInvocationId.set(invocationId, entry);\n }\n\n const now = Date.now();\n const result: InvocationSpan[] = [];\n\n // Create spans for each invocation\n for (const [invocationId, { start, end }] of eventsByInvocationId.entries()) {\n if (!start) {\n // No start event, can't create a meaningful span\n log.warn('found end event without matching start', { invocationId });\n continue;\n }\n\n const isInProgress = end === undefined;\n\n result.push({\n id: invocationId,\n timestampMs: start.timestampMs,\n durationMs: isInProgress ? now - start.timestampMs : end!.timestampMs - start.timestampMs,\n outcome: end?.outcome ?? InvocationOutcome.PENDING,\n exception: end?.exception,\n input: start.input,\n invocationTraceQueue: start.invocationTraceQueue,\n invocationTarget: start.invocationTarget,\n trigger: start.trigger,\n });\n }\n\n return result;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema, SchemaAST } from 'effect';\n\nimport { Expando, OptionsAnnotationId, TypedObject, Ref, RawObject } from '@dxos/echo-schema';\nimport { DXN } from '@dxos/keys';\n\nimport { FunctionType } from './schema';\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 enum TriggerKind {\n Timer = 'timer',\n Webhook = 'webhook',\n Subscription = 'subscription',\n Email = 'email',\n Queue = 'queue',\n}\n\nconst kindLiteralAnnotations = { title: 'Kind' };\n\n/**\n * Cron timer.\n */\nconst TimerTriggerSchema = Schema.Struct({\n kind: Schema.Literal(TriggerKind.Timer).annotations(kindLiteralAnnotations),\n cron: Schema.String.annotations({\n title: 'Cron',\n [SchemaAST.ExamplesAnnotationId]: ['0 0 * * *'],\n }),\n}).pipe(Schema.mutable);\nexport type TimerTrigger = Schema.Schema.Type<typeof TimerTriggerSchema>;\n\nconst EmailTriggerSchema = Schema.Struct({\n kind: Schema.Literal(TriggerKind.Email).annotations(kindLiteralAnnotations),\n}).pipe(Schema.mutable);\nexport type EmailTrigger = Schema.Schema.Type<typeof EmailTriggerSchema>;\n\nconst QueueTriggerSchema = Schema.Struct({\n kind: Schema.Literal(TriggerKind.Queue).annotations(kindLiteralAnnotations),\n queue: DXN.Schema,\n}).pipe(Schema.mutable);\nexport type QueueTrigger = Schema.Schema.Type<typeof QueueTriggerSchema>;\n\n/**\n * Webhook.\n */\nconst WebhookTriggerSchema = Schema.Struct({\n kind: Schema.Literal(TriggerKind.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}).pipe(Schema.mutable);\nexport type WebhookTrigger = Schema.Schema.Type<typeof WebhookTriggerSchema>;\n\n// TODO(burdon): Use ECHO definition (from https://github.com/dxos/dxos/pull/8233).\nconst QuerySchema = Schema.Struct({\n type: Schema.optional(Schema.String.annotations({ title: 'Type' })),\n props: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),\n}).annotations({ title: 'Query' });\n\n/**\n * Subscription.\n */\nconst SubscriptionTriggerSchema = Schema.Struct({\n kind: Schema.Literal(TriggerKind.Subscription).annotations(kindLiteralAnnotations),\n // TODO(burdon): Define query DSL (from ECHO). Reconcile with Table.Query.\n filter: QuerySchema,\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}).pipe(Schema.mutable);\nexport type SubscriptionTrigger = Schema.Schema.Type<typeof SubscriptionTriggerSchema>;\n\n/**\n * Trigger schema (discriminated union).\n */\nexport const TriggerSchema = Schema.Union(\n TimerTriggerSchema,\n WebhookTriggerSchema,\n SubscriptionTriggerSchema,\n EmailTriggerSchema,\n QueueTriggerSchema,\n).annotations({\n title: 'Trigger',\n});\nexport type TriggerType = Schema.Schema.Type<typeof TriggerSchema>;\n\nexport type EventType =\n | EmailTriggerOutput\n | WebhookTriggerOutput\n | QueueTriggerOutput\n | SubscriptionTriggerOutput\n | TimerTriggerOutput;\n\n// TODO(burdon): Reuse trigger schema from @dxos/functions (TriggerType).\nexport const EmailTriggerOutput = Schema.mutable(\n Schema.Struct({\n from: Schema.String,\n to: Schema.String,\n subject: Schema.String,\n created: Schema.String,\n body: Schema.String,\n }),\n);\nexport type EmailTriggerOutput = Schema.Schema.Type<typeof EmailTriggerOutput>;\n\nexport const WebhookTriggerOutput = Schema.mutable(\n 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 }),\n);\nexport type WebhookTriggerOutput = Schema.Schema.Type<typeof WebhookTriggerOutput>;\n\nexport const QueueTriggerOutput = Schema.mutable(\n Schema.Struct({\n queue: DXN.Schema,\n item: Schema.Any,\n cursor: Schema.String,\n }),\n);\nexport type QueueTriggerOutput = Schema.Schema.Type<typeof QueueTriggerOutput>;\n\nexport const SubscriptionTriggerOutput = Schema.mutable(\n Schema.Struct({ type: Schema.String, changedObjectId: Schema.String }),\n);\nexport type SubscriptionTriggerOutput = Schema.Schema.Type<typeof SubscriptionTriggerOutput>;\n\nexport const TimerTriggerOutput = Schema.mutable(Schema.Struct({ tick: Schema.Number }));\nexport type TimerTriggerOutput = Schema.Schema.Type<typeof TimerTriggerOutput>;\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 */\nexport const FunctionTriggerSchema = 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(Expando).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 enabled: Schema.optional(Schema.Boolean.annotations({ title: 'Enabled' })),\n\n spec: Schema.optional(TriggerSchema),\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: '{{$.trigger.event}}',\n * instructions: 'Summarize and perform entity-extraction'\n * mailbox: { '/': 'dxn:echo:AAA:ZZZ' }\n * }\n */\n input: Schema.optional(Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.Any }))),\n});\n\nexport type FunctionTriggerType = Schema.Schema.Type<typeof FunctionTriggerSchema>;\n\n/**\n * Function trigger.\n */\nexport class FunctionTrigger extends TypedObject({\n typename: 'dxos.org/type/FunctionTrigger',\n version: '0.2.0',\n})(FunctionTriggerSchema.fields) {}\n\n// TODO(wittjosiah): Remove?\n\n/**\n * Function manifest file.\n */\nexport const FunctionManifestSchema = Schema.Struct({\n functions: Schema.optional(Schema.mutable(Schema.Array(RawObject(FunctionType)))),\n triggers: Schema.optional(Schema.mutable(Schema.Array(RawObject(FunctionTrigger)))),\n});\nexport type FunctionManifest = Schema.Schema.Type<typeof FunctionManifestSchema>;\n\nexport const FUNCTION_TYPES = [FunctionType, FunctionTrigger];\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type ObjectMeta } from '@dxos/echo-schema';\nimport { type SpaceId } from '@dxos/keys';\n\n// TODO: use URL scheme for source?\nconst FUNCTIONS_META_KEY = 'dxos.org/service/function';\n\nexport const FUNCTIONS_PRESET_META_KEY = 'dxos.org/service/function-preset';\n\nconst isSecure = (protocol: string) => {\n return protocol === 'https:' || protocol === 'wss:';\n};\n\nexport const getUserFunctionUrlInMetadata = (meta: ObjectMeta) => {\n return meta.keys.find((key) => key.source === FUNCTIONS_META_KEY)?.id;\n};\n\nexport const setUserFunctionUrlInMetadata = (meta: ObjectMeta, functionUrl: string) => {\n const key = meta.keys.find((key) => key.source === FUNCTIONS_META_KEY);\n if (key) {\n if (key.id !== functionUrl) {\n throw new Error('Metadata mismatch');\n }\n } else {\n meta.keys.push({ source: FUNCTIONS_META_KEY, id: functionUrl });\n }\n};\n\n/**\n * NOTE: functionId is backend ID, not ECHO object id.\n */\nexport const makeFunctionUrl = (fn: { functionId: string }) => `/${fn.functionId}`;\n\nexport const 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\nexport type InvocationOptions = {\n spaceId?: SpaceId;\n subjectId?: string;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Effect, Schema } from 'effect';\n\nimport type { SpaceId } from '@dxos/client/echo';\nimport { runAndForwardErrors } from '@dxos/effect';\n\nimport type { FunctionContext, FunctionDefinition } from '../handler';\nimport type { ServiceContainer, Services } from '../services';\n\nexport class FunctionExecutor {\n constructor(private readonly _services: ServiceContainer) {}\n\n // TODO(dmaretskyi): Invocation context: queue, space, etc...\n async invoke<F extends FunctionDefinition<any, any>>(\n fnDef: F,\n input: F extends FunctionDefinition<infer I, infer _O> ? I : never,\n ): Promise<F extends FunctionDefinition<infer _I, infer O> ? O : never> {\n // Assert input matches schema\n const assertInput = fnDef.inputSchema.pipe(Schema.asserts);\n (assertInput as any)(input);\n\n const context: FunctionContext = {\n getService: this._services.getService.bind(this._services),\n getSpace: async (_spaceId: SpaceId) => {\n throw new Error('Not available. Use the database service instead.');\n },\n space: undefined,\n get ai(): never {\n throw new Error('Not available. Use the ai service instead.');\n },\n };\n\n const result = fnDef.handler({ context, data: input });\n\n let data: unknown;\n if (Effect.isEffect(result)) {\n data = await (result as Effect.Effect<unknown, unknown, Services>).pipe(\n Effect.provide(this._services.createLayer()),\n runAndForwardErrors,\n );\n } else {\n data = await result;\n }\n\n // Assert output matches schema\n const assertOutput = fnDef.outputSchema?.pipe(Schema.asserts);\n (assertOutput as any)(data);\n\n return data as any;\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAIA,SAASA,cAAyC;AA8F3C,IAAMC,iBAAiB,CAAO,EACnCC,MACAC,aACAC,aACAC,eAAeC,OAAOC,KACtBC,QAAO,MACkB;AACzB,MAAI,CAACF,OAAOG,SAASL,WAAAA,GAAc;AACjC,UAAM,IAAIM,MAAM,qCAAA;EAClB;AACA,MAAI,OAAOF,YAAY,YAAY;AACjC,UAAM,IAAIE,MAAM,4BAAA;EAClB;AAEA,SAAO;IACLR;IACAC;IACAC;IACAC;IACAG;EACF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MAAEV;MAASW,MAAMjB;IAAM,CAAA;AAEpD,QAAIiB;AACJ,QAAIC,OAAOC,SAASJ,MAAAA,GAAS;AAC3BE,aAAO,MAAOF,OAAqDZ,KACjEe,OAAOE,QAAQ,KAAKvB,UAAUwB,YAAW,CAAA,GACzCC,mBAAAA;IAEJ,OAAO;AACLL,aAAO,MAAMF;IACf;AAGA,UAAMQ,eAAexB,MAAMyB,cAAcrB,KAAKC,QAAOC,OAAO;AAC3DkB,iBAAqBN,IAAAA;AAEtB,WAAOA;EACT;AACF;",
6
- "names": ["Schema", "defineFunction", "name", "description", "inputSchema", "outputSchema", "Schema", "Any", "handler", "isSchema", "Error", "Schema", "Type", "JsonSchemaType", "LabelAnnotation", "Ref", "DataType", "ScriptType", "Schema", "Struct", "name", "optional", "String", "description", "changed", "Boolean", "source", "Ref", "DataType", "Text", "pipe", "Type", "Obj", "typename", "version", "LabelAnnotation", "set", "FunctionType", "NonEmptyString", "inputSchema", "JsonSchemaType", "outputSchema", "binding", "Schema", "Type", "Queue", "ObjectId", "log", "Schema", "SchemaAST", "Expando", "OptionsAnnotationId", "TypedObject", "Ref", "RawObject", "DXN", "TriggerKind", "kindLiteralAnnotations", "title", "TimerTriggerSchema", "Schema", "Struct", "kind", "Literal", "annotations", "cron", "String", "SchemaAST", "ExamplesAnnotationId", "pipe", "mutable", "EmailTriggerSchema", "QueueTriggerSchema", "queue", "DXN", "WebhookTriggerSchema", "method", "optional", "OptionsAnnotationId", "port", "Number", "QuerySchema", "type", "props", "Record", "key", "value", "Any", "SubscriptionTriggerSchema", "filter", "options", "deep", "Boolean", "delay", "TriggerSchema", "Union", "EmailTriggerOutput", "from", "to", "subject", "created", "body", "WebhookTriggerOutput", "url", "headers", "bodyText", "QueueTriggerOutput", "item", "cursor", "SubscriptionTriggerOutput", "changedObjectId", "TimerTriggerOutput", "tick", "FunctionTriggerSchema", "function", "Ref", "Expando", "inputNodeId", "enabled", "spec", "input", "FunctionTrigger", "TypedObject", "typename", "version", "fields", "FunctionManifestSchema", "functions", "Array", "RawObject", "FunctionType", "triggers", "FUNCTION_TYPES", "InvocationOutcome", "InvocationTraceEventType", "TraceEventException", "Schema", "Struct", "timestampMs", "Number", "message", "String", "name", "stack", "optional", "InvocationTraceStartEvent", "id", "ObjectId", "type", "Literal", "invocationId", "input", "Object", "invocationTraceQueue", "Type", "Ref", "Queue", "invocationTarget", "Expando", "trigger", "FunctionTrigger", "pipe", "Obj", "typename", "version", "InvocationTraceEndEvent", "outcome", "Enums", "exception", "TraceEventLog", "level", "context", "TraceEvent", "truncated", "Boolean", "ingestionTimestampMs", "logs", "Array", "exceptions", "createInvocationSpans", "items", "eventsByInvocationId", "Map", "event", "entry", "get", "start", "undefined", "end", "set", "now", "Date", "result", "entries", "log", "warn", "isInProgress", "push", "durationMs", "FUNCTIONS_META_KEY", "FUNCTIONS_PRESET_META_KEY", "isSecure", "protocol", "getUserFunctionUrlInMetadata", "meta", "keys", "find", "key", "source", "id", "setUserFunctionUrlInMetadata", "functionUrl", "Error", "push", "makeFunctionUrl", "fn", "functionId", "getInvocationUrl", "edgeUrl", "options", "baseUrl", "URL", "relativeUrl", "replace", "url", "toString", "spaceId", "searchParams", "set", "subjectId", "Effect", "Schema", "runAndForwardErrors", "FunctionExecutor", "_services", "invoke", "fnDef", "input", "assertInput", "inputSchema", "pipe", "Schema", "asserts", "context", "getService", "bind", "getSpace", "_spaceId", "Error", "space", "undefined", "ai", "result", "handler", "data", "Effect", "isEffect", "provide", "createLayer", "runAndForwardErrors", "assertOutput", "outputSchema"]
3
+ "sources": ["../../../src/errors.ts", "../../../src/example/fib.ts", "../../../src/sdk.ts", "../../../src/types/Function.ts", "../../../src/types/Script.ts", "../../../src/types/Trigger.ts", "../../../src/types/TriggerEvent.ts", "../../../src/types/url.ts", "../../../src/example/reply.ts", "../../../src/example/sleep.ts", "../../../src/example/index.ts", "../../../src/services/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/protocol/protocol.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { BaseError, type BaseErrorOptions } from '@dxos/errors';\n\nexport class ServiceNotAvailableError extends BaseError.extend('SERVICE_NOT_AVAILABLE', '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('FUNCTION_NOT_FOUND', '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('FUNCTION_ERROR', 'Function invocation error') {}\n\nexport class TriggerStateNotFoundError extends BaseError.extend('TRIGGER_STATE_NOT_FOUND', 'Trigger state not found') {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { defineFunction } from '../sdk';\n\nexport default defineFunction({\n key: 'example.org/function/fib',\n name: 'Fibonacci',\n description: 'Function that calculates a Fibonacci number',\n inputSchema: Schema.Struct({\n iterations: Schema.optional(Schema.Number).annotations({\n description: 'Number of iterations',\n default: 100_000,\n }),\n }),\n outputSchema: Schema.Struct({\n result: Schema.String,\n }),\n handler: Effect.fn(function* ({ data: { iterations = 100_000 } }) {\n let a = 0n;\n let b = 1n;\n for (let i = 0; i < iterations; i++) {\n a += b;\n b = a - b;\n }\n return { result: a.toString() };\n }),\n});\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { type AiService } from '@dxos/ai';\nimport { Obj, Type } from '@dxos/echo';\nimport { type DatabaseService } from '@dxos/echo-db';\nimport { assertArgument, failedInvariant } from '@dxos/invariant';\n\nimport {\n type CredentialsService,\n type FunctionInvocationService,\n type QueueService,\n type TracingService,\n} from './services';\nimport { Function } from './types';\nimport { getUserFunctionIdInMetadata, setUserFunctionIdInMetadata } from './types';\n\n// TODO(burdon): Model after http request. Ref Lambda/OpenFaaS.\n// https://docs.aws.amazon.com/lambda/latest/dg/typescript-handler.html\n// https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/#functions\n// https://www.npmjs.com/package/aws-lambda\n\n/**\n * Services that are provided at the function call site by the caller.\n */\nexport type InvocationServices = TracingService;\n\n/**\n * Services that are available to invoked functions.\n */\nexport type FunctionServices =\n | InvocationServices\n | AiService.AiService\n | CredentialsService\n | DatabaseService\n | QueueService\n | FunctionInvocationService;\n\n/**\n * Function handler.\n */\nexport type FunctionHandler<TData = {}, TOutput = any, S extends FunctionServices = FunctionServices> = (params: {\n /**\n * Context available to the function.\n */\n context: FunctionContext;\n\n /**\n * Data passed as the input to the function.\n * Must match the function's input schema.\n * This will be the payload from the trigger or other data passed into the function in a workflow.\n */\n data: TData;\n}) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any, S>;\n\n/**\n * Function context.\n */\nexport interface FunctionContext {\n // TODO(dmaretskyi): Consider what we should put into context.\n}\n\nconst typeId = Symbol.for('@dxos/functions/FunctionDefinition');\n\nexport type FunctionDefinition<T = any, O = any, S extends FunctionServices = FunctionServices> = {\n [typeId]: true;\n key: string;\n name: string;\n description?: string;\n inputSchema: Schema.Schema<T, any>;\n outputSchema?: Schema.Schema<O, any>;\n\n /**\n * Keys of the required services.\n */\n services: readonly string[];\n\n handler: FunctionHandler<T, O, S>;\n meta?: {\n /**\n * Tools that are projected from functions have this annotation.\n *\n * deployedFunctionId:\n * - Backend deployment ID assigned by the EDGE function service (typically a UUID).\n * - Used for remote invocation via `FunctionInvocationService` → `RemoteFunctionExecutionService`.\n * - Persisted on the corresponding ECHO `Function.Function` object's metadata under the\n * `FUNCTIONS_META_KEY` and retrieved with `getUserFunctionIdInMetadata`.\n */\n deployedFunctionId?: string;\n };\n};\n\nexport declare namespace FunctionDefinition {\n export type Any = FunctionDefinition<any, any, any>;\n export type Input<T extends Any> = T extends FunctionDefinition<infer I, infer _O, infer _S> ? I : never;\n export type Output<T extends Any> = T extends FunctionDefinition<infer _I, infer O, infer _S> ? O : never;\n export type Services<T extends Any> = T extends FunctionDefinition<infer _I, infer _O, infer S> ? S : never;\n}\n\nexport type FunctionProps<T, O> = {\n key: string;\n name: string;\n description?: string;\n inputSchema: Schema.Schema<T, any>;\n outputSchema?: Schema.Schema<O, any>;\n // TODO(dmaretskyi): This currently doesn't cause a compile-time error if the handler requests a service that is not specified\n services?: readonly Context.Tag<any, any>[];\n\n handler: FunctionHandler<T, O, FunctionServices>;\n};\n\n// TODO(dmaretskyi): Output type doesn't get typechecked.\nexport const defineFunction: {\n <I, O>(params: FunctionProps<I, O>): FunctionDefinition<I, O, FunctionServices>;\n} = ({ key, name, description, inputSchema, outputSchema = Schema.Any, handler, services }) => {\n if (!Schema.isSchema(inputSchema)) {\n throw new Error('Input schema must be a valid schema');\n }\n if (typeof handler !== 'function') {\n throw new Error('Handler must be a function');\n }\n\n // Captures the function definition location.\n const limit = Error.stackTraceLimit;\n Error.stackTraceLimit = 2;\n const traceError = new Error();\n Error.stackTraceLimit = limit;\n let cache: false | string = false;\n const captureStackTrace = () => {\n if (cache !== false) {\n return cache;\n }\n if (traceError.stack !== undefined) {\n const stack = traceError.stack.split('\\n');\n if (stack[2] !== undefined) {\n cache = stack[2].trim();\n return cache;\n }\n }\n };\n\n const handlerWithSpan = (...args: any[]) => {\n const result = (handler as any)(...args);\n if (Effect.isEffect(result)) {\n return Effect.withSpan(result, `${key ?? name}`, {\n captureStackTrace,\n });\n }\n return result;\n };\n\n return {\n [typeId]: true,\n key,\n name,\n description,\n inputSchema,\n outputSchema,\n handler: handlerWithSpan,\n services: !services ? [] : getServiceKeys(services),\n } satisfies FunctionDefinition.Any;\n};\n\nconst getServiceKeys = (services: readonly Context.Tag<any, any>[]) => {\n return services.map((tag: any) => {\n if (typeof tag.key === 'string') {\n return tag.key;\n }\n console.log(tag);\n failedInvariant();\n });\n};\n\nexport const FunctionDefinition = {\n make: defineFunction,\n isFunction: (value: unknown): value is FunctionDefinition.Any => {\n return typeof value === 'object' && value !== null && Symbol.for('@dxos/functions/FunctionDefinition') in value;\n },\n serialize: (functionDef: FunctionDefinition.Any): Function.Function => {\n assertArgument(FunctionDefinition.isFunction(functionDef), 'functionDef');\n return serializeFunction(functionDef);\n },\n deserialize: (functionObj: Function.Function): FunctionDefinition.Any => {\n assertArgument(Obj.instanceOf(Function.Function, functionObj), 'functionObj');\n return deserializeFunction(functionObj);\n },\n};\n\nexport const serializeFunction = (functionDef: FunctionDefinition.Any): Function.Function => {\n const fn = Function.make({\n key: functionDef.key,\n name: functionDef.name,\n version: '0.1.0',\n description: functionDef.description,\n inputSchema: Type.toJsonSchema(functionDef.inputSchema),\n outputSchema: !functionDef.outputSchema ? undefined : Type.toJsonSchema(functionDef.outputSchema),\n services: functionDef.services,\n });\n if (functionDef.meta?.deployedFunctionId) {\n setUserFunctionIdInMetadata(Obj.getMeta(fn), functionDef.meta.deployedFunctionId);\n }\n return fn;\n};\n\nexport const deserializeFunction = (functionObj: Function.Function): FunctionDefinition<unknown, unknown> => {\n return {\n [typeId]: true,\n // TODO(dmaretskyi): Fix key.\n key: functionObj.key ?? functionObj.name,\n name: functionObj.name,\n description: functionObj.description,\n inputSchema: !functionObj.inputSchema ? Schema.Unknown : Type.toEffectSchema(functionObj.inputSchema),\n outputSchema: !functionObj.outputSchema ? undefined : Type.toEffectSchema(functionObj.outputSchema),\n // TODO(dmaretskyi): This should throw error.\n handler: () => {},\n services: functionObj.services ?? [],\n meta: {\n deployedFunctionId: getUserFunctionIdInMetadata(Obj.getMeta(functionObj)),\n },\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Obj, Type } from '@dxos/echo';\nimport { JsonSchemaType, LabelAnnotation, Ref } from '@dxos/echo/internal';\n\nimport { Script } from './Script';\n\n/**\n * Function deployment.\n */\nexport const Function = Schema.Struct({\n /**\n * Global registry ID.\n * NOTE: The `key` property refers to the original registry entry.\n */\n // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.\n // TODO(dmaretskyi): Consider making it part of ECHO meta.\n // TODO(dmaretskyi): Make required.\n key: Schema.optional(Schema.String).annotations({\n description: 'Unique registration key for the blueprint',\n }),\n\n // TODO(burdon): Rename to id/uri?\n name: Schema.NonEmptyString,\n version: Schema.String,\n\n description: Schema.optional(Schema.String),\n\n /**\n * ISO date string of the last deployment.\n */\n updated: Schema.optional(Schema.String),\n\n // Reference to a source script if it exists within ECHO.\n // TODO(burdon): Don't ref ScriptType directly (core).\n source: Schema.optional(Ref(Script)),\n\n inputSchema: Schema.optional(JsonSchemaType),\n outputSchema: Schema.optional(JsonSchemaType),\n\n /**\n * List of required services.\n * Match the Context.Tag keys of the FunctionServices variants.\n */\n services: Schema.optional(Schema.Array(Schema.String)),\n\n // Local binding to a function name.\n binding: Schema.optional(Schema.String),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Function',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n);\nexport interface Function extends Schema.Schema.Type<typeof Function> {}\n\nexport const make = (props: Obj.MakeProps<typeof Function>) => Obj.make(Function, props);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Obj, Ref, Type } from '@dxos/echo';\nimport { FormAnnotation, LabelAnnotation } 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(FormAnnotation.set(false), Schema.optional),\n source: Type.Ref(Text.Text).pipe(FormAnnotation.set(false)),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Script',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\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 = {}) =>\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 { Obj, QueryAST, Type } from '@dxos/echo';\nimport { Expando, OptionsAnnotationId, Ref } 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}).pipe(Schema.mutable);\nexport type EmailSpec = Schema.Schema.Type<typeof EmailSpec>;\n\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}).pipe(Schema.mutable);\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 }).pipe(Schema.mutable),\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}).pipe(Schema.mutable);\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}).pipe(Schema.mutable);\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}).pipe(Schema.mutable);\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 Trigger_ = 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(Expando).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 enabled: Schema.optional(Schema.Boolean.annotations({ title: 'Enabled' })),\n\n spec: Schema.optional(Spec),\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: '{{$.trigger.event}}',\n * instructions: 'Summarize and perform entity-extraction'\n * mailbox: { '/': 'dxn:echo:AAA:ZZZ' }\n * }\n */\n input: Schema.optional(Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.Any }))),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Trigger',\n version: '0.1.0',\n }),\n);\nexport interface Trigger extends Schema.Schema.Type<typeof Trigger_> {}\nexport interface TriggerEncoded extends Schema.Schema.Encoded<typeof Trigger_> {}\nexport const Trigger: Schema.Schema<Trigger, TriggerEncoded> = Trigger_;\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, Type } from '@dxos/echo';\n\nexport type TriggerEvent = EmailEvent | QueueEvent | SubscriptionEvent | TimerEvent | WebhookEvent;\n\n// TODO(burdon): Reuse trigger schema from @dxos/functions (TriggerType).\nexport const EmailEvent = Schema.mutable(\n Schema.Struct({\n from: Schema.String,\n to: Schema.String,\n subject: Schema.String,\n created: Schema.String,\n body: Schema.String,\n }),\n);\nexport type EmailEvent = Schema.Schema.Type<typeof EmailEvent>;\n\nexport const QueueEvent = Schema.mutable(\n Schema.Struct({\n queue: DXN.Schema,\n item: Schema.Any,\n cursor: Schema.String,\n }),\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: Type.Ref(Obj.Any),\n\n /**\n * @deprecated\n */\n changedObjectId: Schema.optional(Schema.String),\n}).pipe(Schema.mutable);\nexport type SubscriptionEvent = Schema.Schema.Type<typeof SubscriptionEvent>;\n\nexport const TimerEvent = Schema.mutable(Schema.Struct({ tick: Schema.Number }));\nexport type TimerEvent = Schema.Schema.Type<typeof TimerEvent>;\n\nexport const WebhookEvent = Schema.mutable(\n 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 }),\n);\nexport type WebhookEvent = Schema.Schema.Type<typeof WebhookEvent>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type ObjectMeta } from '@dxos/echo/internal';\n\n// TODO: use URL scheme for source?\nexport const FUNCTIONS_META_KEY = 'dxos.org/service/function';\n\nexport const FUNCTIONS_PRESET_META_KEY = 'dxos.org/service/function-preset';\n\n/**\n * NOTE: functionId is backend ID, not ECHO object id.\n */\nexport const getUserFunctionIdInMetadata = (meta: ObjectMeta) => {\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 */\nexport const setUserFunctionIdInMetadata = (meta: ObjectMeta, 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 Console from 'effect/Console';\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { defineFunction } from '../sdk';\n\nexport default defineFunction({\n key: 'example.org/function/reply',\n name: 'Reply',\n description: 'Function that echoes the input',\n inputSchema: Schema.Any,\n outputSchema: Schema.Any,\n handler: Effect.fn(function* ({ data }) {\n yield* Console.log('reply', { data });\n return data;\n }),\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { defineFunction } from '../sdk';\n\nexport default defineFunction({\n key: 'example.org/function/sleep',\n name: 'Sleep',\n description: 'Function that sleeps for a given amount of time',\n inputSchema: Schema.Struct({\n duration: Schema.optional(Schema.Number).annotations({\n description: 'Milliseconds to sleep',\n default: 100_000,\n }),\n }),\n outputSchema: Schema.Void,\n handler: Effect.fn(function* ({ data: { duration = 100_000 } }) {\n yield* Effect.sleep(duration);\n }),\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { default as fib$ } from './fib';\nimport { default as reply$ } from './reply';\nimport { default as sleep$ } from './sleep';\n\nexport namespace Example {\n export const fib = fib$;\n export const reply = reply$;\n export const sleep = sleep$;\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport { DatabaseService } from '@dxos/echo-db';\n\nexport * from './credentials';\nexport { ConfiguredCredentialsService, type ServiceCredential } from './credentials';\nexport * from './event-logger';\nexport { createEventLogger, createDefectLogger } from './event-logger';\nexport * from './function-invocation-service';\nexport * from './queues';\nexport * from './tracing';\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 { DatabaseService } from '@dxos/echo-db';\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 = (credentials: { service: string; apiKey: Config.Config<Redacted.Redacted<string>> }[]) =>\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 = () =>\n Layer.effect(\n CredentialsService,\n Effect.gen(function* () {\n const dbService = yield* DatabaseService;\n const queryCredentials = async (query: CredentialQuery): Promise<ServiceCredential[]> => {\n const { objects: accessTokens } = await dbService.db.query(Query.type(AccessToken.AccessToken)).run();\n return accessTokens\n .filter((accessToken) => accessToken.source === query.service)\n .map((accessToken) => ({\n service: accessToken.source,\n apiKey: accessToken.token,\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 API key from the credential.\n */\nexport const withAuthorization = (query: CredentialQuery, kind?: 'Bearer' | 'Basic') =>\n HttpClient.mapRequestEffect(\n Effect.fnUntraced(function* (request) {\n const key = yield* CredentialsService.getApiKey(query).pipe(Effect.map(Redacted.value));\n const authorization = kind ? `${kind} ${key}` : key;\n return HttpClientRequest.setHeader(request, 'Authorization', authorization);\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';\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.Obj({ typename: 'dxos.org/type/ComputeEvent', 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 }));\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 { Obj } from '@dxos/echo';\nimport type { ObjectId } from '@dxos/echo/internal';\nimport { Message } from '@dxos/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.Any) => void;\n }\n>() {\n static noop: Context.Tag.Service<TracingService> = {\n getTraceContext: () => ({}),\n write: () => {},\n };\n\n static layerNoop: Layer.Layer<TracingService> = Layer.succeed(TracingService, TracingService.noop);\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) => tracing.write(event),\n getTraceContext: () => context,\n };\n }),\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 );\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 );\n });\n}\n\nexport namespace TracingService {\n export interface TraceContext {\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/**\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';\n\nimport { type FunctionDefinition, type InvocationServices } from '../sdk';\n\nexport class FunctionInvocationService extends Context.Tag('@dxos/functions/FunctionInvocationService')<\n FunctionInvocationService,\n {\n invokeFunction<I, O>(\n functionDef: FunctionDefinition<I, O, any>,\n input: I,\n ): Effect.Effect<O, never, InvocationServices>;\n }\n>() {\n static invokeFunction = <I, O>(\n functionDef: FunctionDefinition<I, O, any>,\n input: I,\n ): Effect.Effect<O, never, FunctionInvocationService | InvocationServices> =>\n Effect.serviceFunctionEffect(FunctionInvocationService, (service) => service.invokeFunction)(functionDef, input);\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 { Obj, Relation } 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 Obj.Any | Relation.Any = Obj.Any | Relation.Any>(\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 Obj.Any | Relation.Any = Obj.Any | Relation.Any>(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 Obj.Any | Relation.Any = Obj.Any | Relation.Any>(\n queue: Queue<T>,\n objects: T[],\n ): Effect.Effect<void> => 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 Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { AiService } from '@dxos/ai';\nimport { Type } from '@dxos/echo';\nimport { EchoClient } from '@dxos/echo-db';\nimport { acquireReleaseResource } from '@dxos/effect';\nimport { failedInvariant, invariant } from '@dxos/invariant';\nimport { PublicKey } from '@dxos/keys';\nimport { type FunctionProtocol } from '@dxos/protocols';\n\nimport { FunctionError } from '../errors';\nimport { FunctionDefinition, type FunctionServices } from '../sdk';\nimport { CredentialsService, DatabaseService, FunctionInvocationService, TracingService } from '../services';\nimport { QueueService } from '../services';\n\n/**\n * Wraps a function handler made with `defineFunction` to a protocol that the functions-runtime expects.\n */\nexport const wrapFunctionHandler = (func: FunctionDefinition): FunctionProtocol.Func => {\n if (!FunctionDefinition.isFunction(func)) {\n throw new TypeError('Invalid function definition');\n }\n\n return {\n meta: {\n key: func.key,\n name: func.name,\n description: func.description,\n inputSchema: Type.toJsonSchema(func.inputSchema),\n outputSchema: func.outputSchema === undefined ? undefined : Type.toJsonSchema(func.outputSchema),\n services: func.services,\n },\n handler: async ({ data, context }) => {\n if (\n (func.services.includes(DatabaseService.key) || func.services.includes(QueueService.key)) &&\n (!context.services.dataService || !context.services.queryService)\n ) {\n throw new FunctionError({\n message: 'Services not provided: dataService, queryService',\n });\n }\n\n try {\n if (!SchemaAST.isAnyKeyword(func.inputSchema.ast)) {\n Schema.validateSync(func.inputSchema)(data);\n }\n\n let result = await func.handler({\n // TODO(dmaretskyi): Fix the types.\n context: context as any,\n data,\n });\n\n if (Effect.isEffect(result)) {\n result = await Effect.runPromise(\n (result as Effect.Effect<unknown, unknown, FunctionServices>).pipe(\n Effect.orDie,\n Effect.provide(createServiceLayer(context)),\n ),\n );\n }\n\n if (func.outputSchema && !SchemaAST.isAnyKeyword(func.outputSchema.ast)) {\n Schema.validateSync(func.outputSchema)(result);\n }\n\n return result;\n } catch (error) {\n if (FunctionError.is(error)) {\n throw error;\n } else {\n throw new FunctionError({\n cause: error,\n context: { func: func.key },\n });\n }\n }\n },\n };\n};\n\n/**\n * Creates a layer of services for the function.\n */\nconst createServiceLayer = (context: FunctionProtocol.Context): Layer.Layer<FunctionServices> => {\n return Layer.unwrapScoped(\n Effect.gen(function* () {\n let client: EchoClient | undefined;\n\n if (context.services.dataService && context.services.queryService) {\n client = yield* acquireReleaseResource(() => {\n invariant(context.services.dataService && context.services.queryService);\n // TODO(dmaretskyi): Queues service.\n return new EchoClient().connectToService({\n dataService: context.services.dataService,\n queryService: context.services.queryService,\n queueService: context.services.queueService,\n });\n });\n }\n\n const db =\n client && context.spaceId\n ? yield* acquireReleaseResource(() =>\n client.constructDatabase({\n spaceId: context.spaceId ?? failedInvariant(),\n spaceKey: PublicKey.fromHex(context.spaceKey ?? failedInvariant('spaceKey missing in context')),\n reactiveSchemaQuery: false,\n }),\n )\n : undefined;\n\n if (db) {\n console.log('Setting space root', context.spaceRootUrl);\n yield* Effect.promise(() =>\n db!.setSpaceRoot(context.spaceRootUrl ?? failedInvariant('spaceRootUrl missing in context')),\n );\n }\n\n const queues = client && context.spaceId ? client.constructQueueFactory(context.spaceId) : undefined;\n\n const dbLayer = db ? DatabaseService.layer(db) : DatabaseService.notAvailable;\n const queuesLayer = queues ? QueueService.layer(queues) : QueueService.notAvailable;\n const credentials = dbLayer\n ? CredentialsService.layerFromDatabase().pipe(Layer.provide(dbLayer))\n : CredentialsService.configuredLayer([]);\n const functionInvocationService = MockedFunctionInvocationService;\n const aiService = AiService.notAvailable;\n const tracing = TracingService.layerNoop;\n\n return Layer.mergeAll(dbLayer, queuesLayer, credentials, functionInvocationService, aiService, tracing);\n }),\n );\n};\n\nconst MockedFunctionInvocationService = Layer.succeed(FunctionInvocationService, {\n invokeFunction: () => Effect.die('Calling functions from functions is not implemented yet.'),\n});\n"],
5
+ "mappings": ";;;;;;;AAIA,SAASA,iBAAwC;AAE1C,IAAMC,2BAAN,cAAuCC,UAAUC,OAAO,yBAAyB,uBAAA,EAAA;EACtF,YAAYC,SAAiBC,SAA6C;AACxE,UAAM;MAAEC,SAAS;QAAEF;MAAQ;MAAG,GAAGC;IAAQ,CAAA;EAC3C;AACF;AAEO,IAAME,wBAAN,cAAoCL,UAAUC,OAAO,sBAAsB,oBAAA,EAAA;EAChF,YAAYK,aAAqBH,SAA6C;AAC5E,UAAM;MAAEC,SAAS;QAAEG,UAAUD;MAAY;MAAG,GAAGH;IAAQ,CAAA;EACzD;AACF;AAEO,IAAMK,gBAAN,cAA4BR,UAAUC,OAAO,kBAAkB,2BAAA,EAAA;AAA8B;AAE7F,IAAMQ,4BAAN,cAAwCT,UAAUC,OAAO,2BAA2B,yBAAA,EAAA;AAA4B;;;AChBvH,YAAYS,aAAY;AACxB,YAAYC,aAAY;;;ACAxB,YAAYC,YAAY;AACxB,YAAYC,aAAY;AAGxB,SAASC,OAAAA,MAAKC,QAAAA,aAAY;AAE1B,SAASC,gBAAgBC,uBAAuB;;;ACXhD;;;cAA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", "options", "context", "FunctionNotFoundError", "functionKey", "function", "FunctionError", "TriggerStateNotFoundError", "Effect", "Schema", "Effect", "Schema", "Obj", "Type", "assertArgument", "failedInvariant", "make", "Schema", "Obj", "Type", "JsonSchemaType", "LabelAnnotation", "Ref", "Schema", "Obj", "Ref", "Type", "FormAnnotation", "LabelAnnotation", "Text", "Script", "Struct", "name", "String", "pipe", "optional", "description", "changed", "Boolean", "FormAnnotation", "set", "source", "Type", "Ref", "Text", "Obj", "typename", "version", "LabelAnnotation", "make", "props", "Function", "Struct", "key", "optional", "String", "annotations", "description", "name", "NonEmptyString", "version", "updated", "source", "Ref", "Script", "inputSchema", "JsonSchemaType", "outputSchema", "services", "Array", "binding", "pipe", "Type", "Obj", "typename", "LabelAnnotation", "set", "make", "props", "make", "Schema", "SchemaAST", "Obj", "QueryAST", "Type", "Expando", "OptionsAnnotationId", "Ref", "DXN", "Kinds", "kindLiteralAnnotations", "title", "EmailSpec", "Struct", "kind", "Literal", "annotations", "pipe", "mutable", "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", "Trigger_", "function", "Ref", "Expando", "inputNodeId", "enabled", "spec", "input", "Record", "key", "value", "Any", "Type", "Obj", "typename", "version", "Trigger", "make", "props", "Schema", "DXN", "Obj", "Type", "EmailEvent", "mutable", "Struct", "from", "String", "to", "subject", "created", "body", "QueueEvent", "queue", "DXN", "Schema", "item", "Any", "cursor", "SubscriptionEvent", "type", "Type", "Ref", "Obj", "changedObjectId", "optional", "pipe", "TimerEvent", "tick", "Number", "WebhookEvent", "url", "method", "Literal", "headers", "Record", "key", "value", "bodyText", "FUNCTIONS_META_KEY", "FUNCTIONS_PRESET_META_KEY", "getUserFunctionIdInMetadata", "meta", "keys", "find", "key", "source", "id", "setUserFunctionIdInMetadata", "functionId", "Error", "push", "typeId", "Symbol", "for", "defineFunction", "key", "name", "description", "inputSchema", "outputSchema", "Any", "handler", "services", "isSchema", "Error", "limit", "stackTraceLimit", "traceError", "cache", "captureStackTrace", "stack", "undefined", "split", "trim", "handlerWithSpan", "args", "result", "isEffect", "withSpan", "getServiceKeys", "map", "tag", "console", "log", "failedInvariant", "FunctionDefinition", "make", "isFunction", "value", "serialize", "functionDef", "assertArgument", "serializeFunction", "deserialize", "functionObj", "Obj", "instanceOf", "Function", "deserializeFunction", "fn", "version", "Type", "toJsonSchema", "meta", "deployedFunctionId", "setUserFunctionIdInMetadata", "getMeta", "Unknown", "toEffectSchema", "getUserFunctionIdInMetadata", "defineFunction", "key", "name", "description", "inputSchema", "Struct", "iterations", "optional", "Number", "annotations", "default", "outputSchema", "result", "String", "handler", "fn", "data", "a", "b", "i", "toString", "Console", "Effect", "Schema", "defineFunction", "key", "name", "description", "inputSchema", "Any", "outputSchema", "handler", "fn", "data", "log", "Effect", "Schema", "defineFunction", "key", "name", "description", "inputSchema", "Struct", "duration", "optional", "Number", "annotations", "default", "outputSchema", "Void", "handler", "fn", "data", "sleep", "Example", "fib", "fib$", "reply", "reply$", "sleep", "sleep$", "DatabaseService", "HttpClient", "HttpClientRequest", "Context", "Effect", "Layer", "Redacted", "Query", "DatabaseService", "AccessToken", "CredentialsService", "Tag", "getCredential", "query", "gen", "credentials", "promise", "getApiKey", "credential", "apiKey", "Error", "service", "make", "configuredLayer", "succeed", "ConfiguredCredentialsService", "layerConfig", "effect", "serviceCredentials", "forEach", "value", "layerFromDatabase", "dbService", "DatabaseService", "queryCredentials", "objects", "accessTokens", "db", "Query", "type", "AccessToken", "run", "filter", "accessToken", "source", "map", "token", "length", "addCredentials", "push", "find", "withAuthorization", "kind", "mapRequestEffect", "fnUntraced", "request", "key", "pipe", "authorization", "setHeader", "Context", "Effect", "Layer", "Schema", "Obj", "Type", "invariant", "LogLevel", "log", "Context", "Effect", "Layer", "AgentStatus", "Obj", "Message", "TracingService", "Tag", "noop", "getTraceContext", "write", "layerNoop", "succeed", "layerSubframe", "mapContext", "effect", "gen", "tracing", "context", "event", "emitStatus", "fnUntraced", "data", "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", "Obj", "typename", "version", "ComputeEventLogger", "Tag", "noop", "log", "undefined", "layerFromTracing", "effect", "gen", "tracing", "TracingService", "write", "make", "logCustomEvent", "data", "logger", "Error", "createDefectLogger", "catchAll", "error", "createEventLogger", "level", "message", "logFunction", "LogLevel", "WARN", "warn", "VERBOSE", "verbose", "DEBUG", "debug", "INFO", "info", "ERROR", "invariant", "Context", "Effect", "FunctionInvocationService", "Tag", "invokeFunction", "functionDef", "input", "serviceFunctionEffect", "service", "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", "Effect", "Layer", "Schema", "SchemaAST", "AiService", "Type", "EchoClient", "acquireReleaseResource", "failedInvariant", "invariant", "PublicKey", "wrapFunctionHandler", "func", "FunctionDefinition", "isFunction", "TypeError", "meta", "key", "name", "description", "inputSchema", "Type", "toJsonSchema", "outputSchema", "undefined", "services", "handler", "data", "context", "includes", "DatabaseService", "QueueService", "dataService", "queryService", "FunctionError", "message", "isAnyKeyword", "ast", "Schema", "validateSync", "result", "isEffect", "runPromise", "pipe", "orDie", "provide", "createServiceLayer", "error", "is", "cause", "unwrapScoped", "gen", "client", "acquireReleaseResource", "invariant", "EchoClient", "connectToService", "queueService", "db", "spaceId", "constructDatabase", "failedInvariant", "spaceKey", "PublicKey", "fromHex", "reactiveSchemaQuery", "console", "log", "spaceRootUrl", "promise", "setSpaceRoot", "queues", "constructQueueFactory", "dbLayer", "layer", "notAvailable", "queuesLayer", "credentials", "CredentialsService", "layerFromDatabase", "configuredLayer", "functionInvocationService", "MockedFunctionInvocationService", "aiService", "AiService", "tracing", "TracingService", "layerNoop", "mergeAll", "succeed", "FunctionInvocationService", "invokeFunction", "die"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/bundler/bundler.ts":{"bytes":32934,"imports":[{"path":"@effect/platform","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"esbuild-wasm","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/bundler/index.ts":{"bytes":457,"imports":[{"path":"src/bundler/bundler.ts","kind":"import-statement","original":"./bundler"}],"format":"esm"},"src/edge/functions.ts":{"bytes":6596,"imports":[{"path":"@dxos/client/edge","kind":"import-statement","external":true},{"path":"@dxos/edge-client","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/edge/index.ts":{"bytes":864,"imports":[{"path":"src/edge/functions.ts","kind":"import-statement","original":"./functions"}],"format":"esm"},"src/handler.ts":{"bytes":6202,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"src/schema.ts":{"bytes":5364,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"src/types.ts":{"bytes":21469,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"src/schema.ts","kind":"import-statement","original":"./schema"}],"format":"esm"},"src/trace.ts":{"bytes":16911,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/url.ts":{"bytes":5989,"imports":[],"format":"esm"},"src/services/database.ts":{"bytes":7073,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"src/services/queues.ts":{"bytes":3988,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"src/services/credentials.ts":{"bytes":5646,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"src/services/tracing.ts":{"bytes":3846,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"format":"esm"},"src/services/event-logger.ts":{"bytes":11618,"imports":[{"path":"effect","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/remote-function-execution-service.ts":{"bytes":7717,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"src/services/service-container.ts":{"bytes":12083,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/services/credentials.ts","kind":"import-statement","original":"./credentials"},{"path":"src/services/database.ts","kind":"import-statement","original":"./database"},{"path":"src/services/event-logger.ts","kind":"import-statement","original":"./event-logger"},{"path":"src/services/queues.ts","kind":"import-statement","original":"./queues"},{"path":"src/services/remote-function-execution-service.ts","kind":"import-statement","original":"./remote-function-execution-service"},{"path":"src/services/tracing.ts","kind":"import-statement","original":"./tracing"}],"format":"esm"},"src/errors.ts":{"bytes":1431,"imports":[{"path":"@dxos/errors","kind":"import-statement","external":true}],"format":"esm"},"src/services/local-function-execution.ts":{"bytes":8184,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"src/errors.ts","kind":"import-statement","original":"../errors"}],"format":"esm"},"src/services/index.ts":{"bytes":1217,"imports":[{"path":"src/services/database.ts","kind":"import-statement","original":"./database"},{"path":"src/services/queues.ts","kind":"import-statement","original":"./queues"},{"path":"src/services/service-container.ts","kind":"import-statement","original":"./service-container"},{"path":"src/services/credentials.ts","kind":"import-statement","original":"./credentials"},{"path":"src/services/tracing.ts","kind":"import-statement","original":"./tracing"},{"path":"src/services/event-logger.ts","kind":"import-statement","original":"./event-logger"},{"path":"src/services/remote-function-execution-service.ts","kind":"import-statement","original":"./remote-function-execution-service"},{"path":"src/services/local-function-execution.ts","kind":"import-statement","original":"./local-function-execution"}],"format":"esm"},"src/executor/executor.ts":{"bytes":5494,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true}],"format":"esm"},"src/executor/index.ts":{"bytes":459,"imports":[{"path":"src/executor/executor.ts","kind":"import-statement","original":"./executor"}],"format":"esm"},"src/index.ts":{"bytes":1091,"imports":[{"path":"src/handler.ts","kind":"import-statement","original":"./handler"},{"path":"src/schema.ts","kind":"import-statement","original":"./schema"},{"path":"src/trace.ts","kind":"import-statement","original":"./trace"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/url.ts","kind":"import-statement","original":"./url"},{"path":"src/services/index.ts","kind":"import-statement","original":"./services"},{"path":"src/executor/index.ts","kind":"import-statement","original":"./executor"},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"}],"format":"esm"},"src/testing/logger.ts":{"bytes":1635,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/services/index.ts","kind":"import-statement","original":"../services"}],"format":"esm"},"src/testing/services.ts":{"bytes":6612,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/services/index.ts","kind":"import-statement","original":"../services"},{"path":"src/testing/logger.ts","kind":"import-statement","original":"./logger"}],"format":"esm"},"src/testing/layer.ts":{"bytes":3597,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-db/testing","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"src/services/index.ts","kind":"import-statement","original":"../services"}],"format":"esm"},"src/testing/index.ts":{"bytes":539,"imports":[{"path":"src/testing/services.ts","kind":"import-statement","original":"./services"},{"path":"src/testing/layer.ts","kind":"import-statement","original":"./layer"}],"format":"esm"}},"outputs":{"dist/lib/browser/bundler/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":16045},"dist/lib/browser/bundler/index.mjs":{"imports":[{"path":"@effect/platform","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"esbuild-wasm","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Bundler","initializeBundler"],"entryPoint":"src/bundler/index.ts","inputs":{"src/bundler/bundler.ts":{"bytesInOutput":7755},"src/bundler/index.ts":{"bytesInOutput":0}},"bytes":7859},"dist/lib/browser/edge/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3361},"dist/lib/browser/edge/index.mjs":{"imports":[{"path":"@dxos/client/edge","kind":"import-statement","external":true},{"path":"@dxos/edge-client","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["incrementSemverPatch","publicKeyToDid","uploadWorkerFunction"],"entryPoint":"src/edge/index.ts","inputs":{"src/edge/functions.ts":{"bytesInOutput":1679},"src/edge/index.ts":{"bytesInOutput":0}},"bytes":1816},"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":32397},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-6PTFLPCO.mjs","kind":"import-statement"},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true}],"exports":["ComputeEvent","ComputeEventLogger","ComputeEventPayload","ConfiguredCredentialsService","ContextQueueService","CredentialsService","DatabaseService","EmailTriggerOutput","FUNCTIONS_PRESET_META_KEY","FUNCTION_TYPES","FunctionError","FunctionExecutor","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationOutcome","InvocationTraceEndEvent","InvocationTraceEventType","InvocationTraceStartEvent","LocalFunctionExecutionService","QueueService","QueueTriggerOutput","RemoteFunctionExecutionService","SERVICE_TAGS","ScriptType","ServiceContainer","ServiceNotAvailableError","SubscriptionTriggerOutput","TimerTriggerOutput","TraceEvent","TraceEventException","TraceEventLog","TracingService","TriggerKind","TriggerSchema","WebhookTriggerOutput","createDefectLogger","createEventLogger","createInvocationSpans","defineFunction","getInvocationUrl","getUserFunctionUrlInMetadata","logCustomEvent","makeFunctionUrl","setUserFunctionUrlInMetadata"],"entryPoint":"src/index.ts","inputs":{"src/handler.ts":{"bytesInOutput":422},"src/index.ts":{"bytesInOutput":0},"src/schema.ts":{"bytesInOutput":1255},"src/trace.ts":{"bytesInOutput":4266},"src/types.ts":{"bytesInOutput":4732},"src/url.ts":{"bytesInOutput":1189},"src/executor/executor.ts":{"bytesInOutput":1104},"src/executor/index.ts":{"bytesInOutput":0}},"bytes":14608},"dist/lib/browser/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6586},"dist/lib/browser/testing/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-6PTFLPCO.mjs","kind":"import-statement"},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-db/testing","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true}],"exports":["TestDatabaseLayer","createTestServices"],"entryPoint":"src/testing/index.ts","inputs":{"src/testing/services.ts":{"bytesInOutput":895},"src/testing/logger.ts":{"bytesInOutput":201},"src/testing/index.ts":{"bytesInOutput":0},"src/testing/layer.ts":{"bytesInOutput":644}},"bytes":2084},"dist/lib/browser/chunk-6PTFLPCO.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":32727},"dist/lib/browser/chunk-6PTFLPCO.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"effect","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","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"exports":["ComputeEvent","ComputeEventLogger","ComputeEventPayload","ConfiguredCredentialsService","ContextQueueService","CredentialsService","DatabaseService","FunctionError","LocalFunctionExecutionService","QueueService","RemoteFunctionExecutionService","SERVICE_TAGS","ServiceContainer","ServiceNotAvailableError","TracingService","createDefectLogger","createEventLogger","logCustomEvent"],"inputs":{"src/services/database.ts":{"bytesInOutput":1505},"src/services/queues.ts":{"bytesInOutput":815},"src/services/credentials.ts":{"bytesInOutput":1169},"src/services/tracing.ts":{"bytesInOutput":776},"src/services/event-logger.ts":{"bytesInOutput":2846},"src/services/remote-function-execution-service.ts":{"bytesInOutput":1734},"src/services/service-container.ts":{"bytesInOutput":2489},"src/errors.ts":{"bytesInOutput":293},"src/services/local-function-execution.ts":{"bytesInOutput":1683},"src/services/index.ts":{"bytesInOutput":0}},"bytes":14069}}}
1
+ {"inputs":{"src/errors.ts":{"bytes":3093,"imports":[{"path":"@dxos/errors","kind":"import-statement","external":true}],"format":"esm"},"src/types/Script.ts":{"bytes":3911,"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/Function.ts":{"bytes":5969,"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":"src/types/Script.ts","kind":"import-statement","original":"./Script"}],"format":"esm"},"src/types/Trigger.ts":{"bytes":14603,"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":5563,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"format":"esm"},"src/types/url.ts":{"bytes":3230,"imports":[],"format":"esm"},"src/types/index.ts":{"bytes":1061,"imports":[{"path":"src/types/Function.ts","kind":"import-statement","original":"./Function"},{"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/sdk.ts":{"bytes":18832,"imports":[{"path":"effect/Effect","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":"src/types/index.ts","kind":"import-statement","original":"./types"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/example/fib.ts":{"bytes":3247,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"src/sdk.ts","kind":"import-statement","original":"../sdk"}],"format":"esm"},"src/example/reply.ts":{"bytes":2136,"imports":[{"path":"effect/Console","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"src/sdk.ts","kind":"import-statement","original":"../sdk"}],"format":"esm"},"src/example/sleep.ts":{"bytes":2579,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"src/sdk.ts","kind":"import-statement","original":"../sdk"}],"format":"esm"},"src/example/index.ts":{"bytes":1301,"imports":[{"path":"src/example/fib.ts","kind":"import-statement","original":"./fib"},{"path":"src/example/reply.ts","kind":"import-statement","original":"./reply"},{"path":"src/example/sleep.ts","kind":"import-statement","original":"./sleep"}],"format":"esm"},"src/services/credentials.ts":{"bytes":15210,"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-db","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true}],"format":"esm"},"src/services/tracing.ts":{"bytes":8840,"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/types","kind":"import-statement","external":true}],"format":"esm"},"src/services/event-logger.ts":{"bytes":11905,"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":2233,"imports":[{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true}],"format":"esm"},"src/services/queues.ts":{"bytes":6500,"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":1597,"imports":[{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"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/protocol/protocol.ts":{"bytes":18414,"imports":[{"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/echo","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/sdk.ts","kind":"import-statement","original":"../sdk"},{"path":"src/services/index.ts","kind":"import-statement","original":"../services"},{"path":"src/services/index.ts","kind":"import-statement","original":"../services"}],"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/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":66248},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/Effect","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":"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":"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/Console","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"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-db","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/types","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","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/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/echo","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}],"exports":["ComputeEvent","ComputeEventLogger","ComputeEventPayload","ConfiguredCredentialsService","ContextQueueService","CredentialsService","DatabaseService","Example","FUNCTIONS_META_KEY","FUNCTIONS_PRESET_META_KEY","Function","FunctionDefinition","FunctionError","FunctionInvocationService","FunctionNotFoundError","MESSAGE_PROPERTY_TOOL_CALL_ID","QueueService","Script","ServiceNotAvailableError","TracingService","Trigger","TriggerEvent","TriggerStateNotFoundError","createDefectLogger","createEventLogger","defineFunction","deserializeFunction","getUserFunctionIdInMetadata","logCustomEvent","serializeFunction","setUserFunctionIdInMetadata","withAuthorization","wrapFunctionHandler"],"entryPoint":"src/index.ts","inputs":{"src/errors.ts":{"bytesInOutput":744},"src/index.ts":{"bytesInOutput":0},"src/example/fib.ts":{"bytesInOutput":708},"src/sdk.ts":{"bytesInOutput":3412},"src/types/Function.ts":{"bytesInOutput":1675},"src/types/Script.ts":{"bytesInOutput":897},"src/types/index.ts":{"bytesInOutput":0},"src/types/Trigger.ts":{"bytesInOutput":3602},"src/types/TriggerEvent.ts":{"bytesInOutput":1314},"src/types/url.ts":{"bytesInOutput":576},"src/example/reply.ts":{"bytesInOutput":448},"src/example/sleep.ts":{"bytesInOutput":550},"src/example/index.ts":{"bytesInOutput":164},"src/services/index.ts":{"bytesInOutput":69},"src/services/credentials.ts":{"bytesInOutput":3402},"src/services/event-logger.ts":{"bytesInOutput":2934},"src/services/tracing.ts":{"bytesInOutput":1773},"src/services/function-invocation-service.ts":{"bytesInOutput":390},"src/services/queues.ts":{"bytesInOutput":1233},"src/protocol/protocol.ts":{"bytesInOutput":4446}},"bytes":29942}}}