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

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 (95) hide show
  1. package/README.md +4 -6
  2. package/dist/lib/neutral/Trace.mjs +34 -0
  3. package/dist/lib/neutral/Trace.mjs.map +7 -0
  4. package/dist/lib/neutral/chunk-BHLSCAA2.mjs +123 -0
  5. package/dist/lib/neutral/chunk-BHLSCAA2.mjs.map +7 -0
  6. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  7. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  8. package/dist/lib/neutral/chunk-Z2XDJJVH.mjs +49 -0
  9. package/dist/lib/neutral/chunk-Z2XDJJVH.mjs.map +7 -0
  10. package/dist/lib/neutral/fib-S6PPI4UW.mjs +23 -0
  11. package/dist/lib/neutral/fib-S6PPI4UW.mjs.map +7 -0
  12. package/dist/lib/{browser → neutral}/index.mjs +649 -633
  13. package/dist/lib/neutral/index.mjs.map +7 -0
  14. package/dist/lib/neutral/meta.json +1 -0
  15. package/dist/lib/neutral/reply-TOHXEG7V.mjs +19 -0
  16. package/dist/lib/neutral/reply-TOHXEG7V.mjs.map +7 -0
  17. package/dist/lib/neutral/sleep-QPSZDPEH.mjs +15 -0
  18. package/dist/lib/neutral/sleep-QPSZDPEH.mjs.map +7 -0
  19. package/dist/types/src/Trace.d.ts +135 -0
  20. package/dist/types/src/Trace.d.ts.map +1 -0
  21. package/dist/types/src/errors.d.ts.map +1 -1
  22. package/dist/types/src/example/definitions.d.ts +11 -0
  23. package/dist/types/src/example/definitions.d.ts.map +1 -0
  24. package/dist/types/src/example/fib.d.ts +3 -2
  25. package/dist/types/src/example/fib.d.ts.map +1 -1
  26. package/dist/types/src/example/index.d.ts +3 -11
  27. package/dist/types/src/example/index.d.ts.map +1 -1
  28. package/dist/types/src/example/reply.d.ts +2 -1
  29. package/dist/types/src/example/reply.d.ts.map +1 -1
  30. package/dist/types/src/example/sleep.d.ts +3 -2
  31. package/dist/types/src/example/sleep.d.ts.map +1 -1
  32. package/dist/types/src/index.d.ts +4 -0
  33. package/dist/types/src/index.d.ts.map +1 -1
  34. package/dist/types/src/process/Process.d.ts +247 -0
  35. package/dist/types/src/process/Process.d.ts.map +1 -0
  36. package/dist/types/src/process/ServiceResolver.d.ts +74 -0
  37. package/dist/types/src/process/ServiceResolver.d.ts.map +1 -0
  38. package/dist/types/src/process/StorageService.d.ts +58 -0
  39. package/dist/types/src/process/StorageService.d.ts.map +1 -0
  40. package/dist/types/src/protocol/protocol.d.ts +2 -2
  41. package/dist/types/src/protocol/protocol.d.ts.map +1 -1
  42. package/dist/types/src/sdk.d.ts +4 -104
  43. package/dist/types/src/sdk.d.ts.map +1 -1
  44. package/dist/types/src/services/event-logger.d.ts +4 -4
  45. package/dist/types/src/services/function-invocation-service.d.ts +6 -5
  46. package/dist/types/src/services/function-invocation-service.d.ts.map +1 -1
  47. package/dist/types/src/services/queues.d.ts +4 -2
  48. package/dist/types/src/services/queues.d.ts.map +1 -1
  49. package/dist/types/src/services/tracing.d.ts +25 -2
  50. package/dist/types/src/services/tracing.d.ts.map +1 -1
  51. package/dist/types/src/types/Script.d.ts +4 -3
  52. package/dist/types/src/types/Script.d.ts.map +1 -1
  53. package/dist/types/src/types/Trigger.d.ts +8 -9
  54. package/dist/types/src/types/Trigger.d.ts.map +1 -1
  55. package/dist/types/src/types/TriggerEvent.d.ts +3 -2
  56. package/dist/types/src/types/TriggerEvent.d.ts.map +1 -1
  57. package/dist/types/src/types/index.d.ts +0 -1
  58. package/dist/types/src/types/index.d.ts.map +1 -1
  59. package/dist/types/src/types/url.d.ts +2 -2
  60. package/dist/types/tsconfig.tsbuildinfo +1 -1
  61. package/package.json +25 -20
  62. package/src/Trace.ts +162 -0
  63. package/src/errors.ts +1 -1
  64. package/src/example/definitions.ts +48 -0
  65. package/src/example/fib.ts +14 -24
  66. package/src/example/forex-effect.ts +1 -1
  67. package/src/example/index.ts +7 -8
  68. package/src/example/reply.ts +10 -13
  69. package/src/example/sleep.ts +8 -17
  70. package/src/index.ts +4 -0
  71. package/src/process/Process.ts +457 -0
  72. package/src/process/ServiceResolver.ts +173 -0
  73. package/src/process/StorageService.ts +99 -0
  74. package/src/protocol/protocol.ts +33 -27
  75. package/src/sdk.ts +6 -256
  76. package/src/services/event-logger.ts +1 -1
  77. package/src/services/function-invocation-service.ts +6 -5
  78. package/src/services/queues.ts +10 -2
  79. package/src/services/tracing.ts +35 -2
  80. package/src/types/Script.ts +7 -3
  81. package/src/types/Trigger.ts +17 -6
  82. package/src/types/TriggerEvent.ts +2 -2
  83. package/src/types/index.ts +0 -1
  84. package/src/types/url.ts +2 -2
  85. package/dist/lib/browser/index.mjs.map +0 -7
  86. package/dist/lib/browser/meta.json +0 -1
  87. package/dist/lib/node-esm/index.mjs +0 -1230
  88. package/dist/lib/node-esm/index.mjs.map +0 -7
  89. package/dist/lib/node-esm/meta.json +0 -1
  90. package/dist/types/src/operation-compatibility.test.d.ts +0 -2
  91. package/dist/types/src/operation-compatibility.test.d.ts.map +0 -1
  92. package/dist/types/src/types/Function.d.ts +0 -52
  93. package/dist/types/src/types/Function.d.ts.map +0 -1
  94. package/src/operation-compatibility.test.ts +0 -185
  95. package/src/types/Function.ts +0 -82
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/errors.ts", "../../../src/example/index.ts", "../../../src/process/Process.ts", "../../../src/process/ServiceResolver.ts", "../../../src/process/StorageService.ts", "../../../src/services/credentials.ts", "../../../src/services/event-logger.ts", "../../../src/services/tracing.ts", "../../../src/services/function-invocation-service.ts", "../../../src/services/queues.ts", "../../../src/types/Script.ts", "../../../src/types/Trigger.ts", "../../../src/types/TriggerEvent.ts", "../../../src/types/url.ts", "../../../src/protocol/protocol.ts", "../../../src/protocol/functions-ai-http-client.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { BaseError, type BaseErrorOptions } from '@dxos/errors';\n\nexport class ServiceNotAvailableError extends BaseError.extend('ServiceNotAvailable', 'Service not available') {\n constructor(service: string, options?: Omit<BaseErrorOptions, 'context'>) {\n super({ context: { service }, ...options, message: `Service not available: ${service}` });\n }\n}\n\nexport class FunctionNotFoundError extends BaseError.extend('FunctionNotFound', 'Function not found') {\n constructor(functionKey: string, options?: Omit<BaseErrorOptions, 'context'>) {\n super({ context: { function: functionKey }, ...options });\n }\n}\n\nexport class FunctionError extends BaseError.extend('FunctionError', 'Function invocation error') {}\n\nexport class TriggerStateNotFoundError extends BaseError.extend('TriggerStateNotFound', 'Trigger state not found') {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { OperationHandlerSet } from '@dxos/operation';\nexport * from './definitions';\n\nexport const ExampleHandlers = OperationHandlerSet.lazy(\n () => import('./fib'),\n () => import('./reply'),\n () => import('./sleep'),\n);\n", "//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Scope from 'effect/Scope';\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\nimport type * as Exit from 'effect/Exit';\nimport * as Context from 'effect/Context';\nimport type * as Types from 'effect/Types';\n\nimport { Operation, OperationHandlerSet } from '@dxos/operation';\nimport type { TracingService } from '../services/tracing';\nimport * as Option from 'effect/Option';\nimport type { Atom } from '@effect-atom/atom';\nimport type { ObjectId } from '@dxos/protocols';\nimport { assertArgument } from '@dxos/invariant';\nimport * as Trace from '../Trace';\n\n//\n// Process.\n//\n\n/** Opaque process id (arbitrary string). */\nexport const ID = Schema.String.pipe(Schema.brand('ProcessId'));\nexport type ID = Schema.Schema.Type<typeof ID>;\n\n/**\n * A running process callbacks.\n *\n * Process lifecycle: Initial -> Running <-> Suspended -> Terminated.\n *\n * - onSpawn -> called once when the process is spawned.\n * - onInput -> called for every input submitted to the process.\n * - onAlarm -> called for processes scheduling alarms.\n * - onChildEvent -> called when child process produces output or exits.\n */\nexport interface Callbacks<I, O, R> {\n /**\n * Called when the process is spawned.\n * Not called for processes that are resumed from a previously suspended state.\n *\n * @returns A signal indicating to the runtime whether the process is finished, or should be resumed later.\n * @throws Throwing in the handler will terminate the process with an error.\n *\n * Note: This function should aim to complete in under 5 seconds to avoid exceeding limits in serverless environments.\n */\n onSpawn(): Effect.Effect<void, never, R | BaseServices>;\n\n /**\n * Called when there's input available to process.\n *\n * The function can be called in parallel.\n *\n * @returns A signal indicating to the runtime whether the process is finished, or should be resumed later.\n * @throws Throwing in the handler will terminate the process with an error.\n *\n * Note: This function should aim to complete in under 5 seconds to avoid exceeding limits in serverless environments.\n */\n onInput(input: I): Effect.Effect<void, never, R | BaseServices>;\n\n /**\n * Called when the process's alarm is triggered.\n *\n * @throws Throwing in the handler will terminate the process with an error.\n */\n onAlarm(): Effect.Effect<void, never, R | BaseServices>;\n\n /**\n * Called when the process's child process produces output or exits.\n *\n * This allows the parent process to hibernate while a long-running child process is running.\n */\n onChildEvent(event: ChildEvent<unknown>): Effect.Effect<void, never, R | BaseServices>;\n}\n\n/**\n * Services that are always available to all processes.\n */\nexport type BaseServices = TracingService | Trace.TraceService;\n\nexport type ChildEvent<T> =\n | {\n readonly _tag: 'output';\n readonly pid: ID;\n readonly data: T;\n }\n | {\n readonly _tag: 'exited';\n readonly pid: ID;\n readonly result: Exit.Exit<void>;\n };\n\nexport interface ProcessContext<I, O> {\n readonly id: ID;\n\n /**\n * Parameters assigned during process creation.\n */\n readonly params: Params;\n\n /**\n * Complete this process with sucessful result.\n * No additional events will be pushed to the process.\n */\n succeed(): void;\n\n /**\n * Complete this process with an error.\n * No additional events will be pushed to the process.\n */\n fail(error: Error): void;\n\n /**\n * Submit output of the process.\n */\n submitOutput(output: O): void;\n\n /**\n * Set an alarm for the process to be woken up later.\n *\n * @param timeout - Optional timeout in milliseconds. If not provided, the process is woken up as soon as possible.\n */\n setAlarm(timeout?: number): void;\n}\n\n/**\n * Generic parameters for a all processes.\n */\nexport interface Params {\n /**\n * Process name for debugging purposes.\n */\n readonly name: string | null;\n\n /**\n * Target object that this process is assigned to.\n */\n readonly target: ObjectId | null;\n}\n\n//\n// Executable.\n//\n\nexport const ProcessTypeId = '~@dxos/functions/Process' as const;\nexport type ProcessTypeId = typeof ProcessTypeId;\n\n/**\n * A process (factory).\n * Can be instantiated mutlitple times to produce new runtime instance with separate state and callbacks.\n * `create` is used to instantiate a new process.\n * Can store runtime state in scope of `create` function.\n */\nexport interface Process<I, O, R> extends Process.Variance<I, O, R> {\n /**\n * Unique identifier for the executable in the reverse DNS format.\n */\n readonly key: string;\n\n /**\n * Human-readable label from {@link MakeExecutableOpts.name} when provided.\n */\n readonly name?: string;\n\n readonly services: readonly Context.Tag<any, any>[];\n\n /**\n * Create a new instance of the process.\n */\n create(ctx: ProcessContext<I, O>): Effect.Effect<Callbacks<I, O, R>, never, R | BaseServices | Scope.Scope>;\n}\n\nexport const isProcess = (executable: unknown): executable is Process.Any =>\n typeof executable === 'object' && executable !== null && ProcessTypeId in executable;\n\nexport namespace Process {\n export interface Variance<I, O, R> {\n readonly [ProcessTypeId]: {\n readonly _Input: Types.Contravariant<I>;\n readonly _Output: Types.Covariant<O>;\n readonly _Requirements: Types.Covariant<R>;\n };\n }\n\n export type Any = Process<any, any, never>;\n}\n\nexport interface MakeProcessOpts {\n /**\n * Unique identifier for the process in the reverse DNS format.\n */\n readonly key: string;\n\n readonly input: Schema.Schema.AnyNoContext;\n readonly output: Schema.Schema.AnyNoContext;\n readonly services: readonly Context.Tag<any, any>[];\n}\n\nexport const make = <const Opts extends Types.NoExcessProperties<MakeProcessOpts, Opts>>(\n opts: Opts,\n create: (\n ctx: ProcessContext<Schema.Schema.Type<Opts['input']>, Schema.Schema.Type<Opts['output']>>,\n ) => Effect.Effect<\n Partial<\n Callbacks<\n Schema.Schema.Type<Opts['input']>,\n Schema.Schema.Type<Opts['output']>,\n Context.Tag.Identifier<NonNullable<Opts['services']>[number]>\n >\n >,\n never,\n Context.Tag.Identifier<NonNullable<Opts['services']>[number]> | BaseServices | Scope.Scope\n >,\n): Process<\n Schema.Schema.Type<Opts['input']>,\n Schema.Schema.Type<Opts['output']>,\n Context.Tag.Identifier<NonNullable<Opts['services']>[number]>\n> => {\n assertArgument(/^[a-z0-9]([a-z0-9.\\-/]*[a-z0-9])?$/i.test(opts.key), 'key', 'Invalid key');\n return {\n [ProcessTypeId]: {} as any,\n ...opts,\n create: (ctx) =>\n create(ctx).pipe(\n Effect.map((partial) => ({\n onSpawn: () => Effect.void,\n onInput: () => Effect.void,\n onAlarm: () => Effect.void,\n onChildEvent: () => Effect.void,\n ...partial,\n })),\n ),\n };\n};\n\nexport const fromOperation = <const Op extends Operation.Definition.Any>(\n op: Op,\n handler: OperationHandlerSet.OperationHandlerSet,\n): Process<Operation.Definition.Input<Op>, Operation.Definition.Output<Op>, Operation.Definition.Services<Op>> =>\n make(\n {\n key: op.meta.key,\n input: op.input,\n output: op.output,\n services: op.services,\n },\n (ctx) =>\n Effect.gen(function* () {\n const semaphore = yield* Effect.makeSemaphore(1);\n\n return {\n onInput: (input: Operation.Definition.Input<Op>) =>\n Effect.gen(function* () {\n const opHandler = yield* OperationHandlerSet.getHandler(handler, op).pipe(Effect.orDie);\n const output = yield* opHandler.handler(input).pipe(Effect.orDie) as Effect.Effect<\n Operation.Definition.Output<Op>,\n never,\n never\n >;\n\n ctx.submitOutput(output);\n ctx.succeed();\n }).pipe(semaphore.withPermits(1)),\n };\n }),\n );\n\n/**\n * Runtime state of a process.\n */\nexport enum State {\n // Process is actively running.\n RUNNING = 'RUNNING',\n\n // Process is waiting for a child process to complete or an alarm to trigger.\n HYBERNATING = 'HYBERNATING',\n\n // Process is waiting for input. It will only resume when input is submitted.\n IDLE = 'IDLE',\n\n // Process is terminating and will transition to TERMINATED state.\n // TODO(dmaretskyi): Consider removing.\n TERMINATING = 'TERMINATING',\n\n // Process has been externally terminated.\n TERMINATED = 'TERMINATED',\n\n // Process has completed successfully.\n SUCCEEDED = 'SUCCEEDED',\n\n // Process has failed.\n FAILED = 'FAILED',\n}\n\n/**\n * Read-only view of a process tree\n */\nexport interface Monitor {\n /**\n * Get the current state of the process tree.\n */\n processTree: Effect.Effect<readonly Info[]>;\n\n /**\n * Atom for the process tree.\n */\n processTreeAtom: Atom.Atom<readonly Info[]>;\n}\n\nexport class ProcessMonitorService extends Context.Tag('@dxos/functions/ProcessMonitorService')<\n ProcessMonitorService,\n Monitor\n>() {}\n\nexport interface Info {\n readonly pid: ID;\n readonly parentPid: ID | null;\n\n /**\n * Key of the process.\n *\n * NOTE: There might be multiple running processes with the same key.\n */\n readonly key: string;\n\n /**\n * Parameters of the process.\n */\n readonly params: Params;\n\n /**\n * State of the process.\n */\n readonly state: State;\n\n /**\n * Error of the process.\n * Only for process in FAILED state.\n */\n readonly error: string | null;\n\n /**\n * UNIX timestamp in milliseconds.\n */\n readonly startedAt: number;\n\n /**\n * UNIX timestamp in milliseconds.\n */\n readonly completedAt: Option.Option<number>;\n\n readonly metrics: {\n /**\n * Total wall time of all handler invocations of the process in milliseconds.\n */\n readonly wallTime: number;\n\n /**\n * Total number of inputs submitted to the process.\n */\n readonly inputCount: number;\n\n /**\n * Total number of outputs submitted to the process.\n */\n readonly outputCount: number;\n };\n}\n\n/**\n * New process is spawned.\n */\nexport const SpawnedEvent = Trace.EventType('process.spawned', {\n schema: Schema.Void,\n isEphemeral: false,\n});\n\n/**\n * Process has reached a terminal state.\n */\nexport const ExitedEvent = Trace.EventType('process.exited', {\n schema: Schema.Struct({\n outcome: Schema.Literal('succeeded', 'failed', 'terminated'),\n }),\n isEphemeral: false,\n});\n\n/**\n * Renders spawned processes as a forest: top-level rows use \"- \", nested rows use ├── / └── / │.\n */\nexport const prettyProcessTree = (tree: readonly Info[]): string => {\n if (tree.length === 0) {\n return '';\n }\n\n const pidSet = new Set(tree.map((node) => node.pid));\n const childrenByParent = new Map<string, Info[]>();\n const roots: Info[] = [];\n\n for (const node of tree) {\n const parent = node.parentPid;\n if (parent === null || !pidSet.has(parent)) {\n roots.push(node);\n continue;\n }\n const key = String(parent);\n const siblings = childrenByParent.get(key) ?? [];\n siblings.push(node);\n childrenByParent.set(key, siblings);\n }\n\n const byPid = (a: Info, b: Info) => String(a.pid).localeCompare(String(b.pid));\n roots.sort(byPid);\n for (const siblings of childrenByParent.values()) {\n siblings.sort(byPid);\n }\n\n const formatLabel = (node: Info): string => {\n const idShort = String(node.pid).slice(0, 6);\n const parts = [idShort, node.state];\n if (node.params.name != null && node.params.name !== '') {\n parts.push(node.params.name);\n }\n if (node.error != null) {\n parts.push(`(${node.error})`);\n }\n const { inputCount, outputCount, wallTime } = node.metrics;\n parts.push(`[in:${inputCount} out:${outputCount} wall:${Math.round(wallTime)}ms]`);\n return parts.join(' ');\n };\n\n const lines: string[] = [];\n\n const walk = (node: Info, prefix: string, isLast: boolean, isRoot: boolean): void => {\n if (isRoot) {\n lines.push(`- ${formatLabel(node)}`);\n } else {\n const branch = isLast ? '└── ' : '├── ';\n lines.push(`${prefix}${branch}${formatLabel(node)}`);\n }\n\n const children = childrenByParent.get(String(node.pid)) ?? [];\n const nextPrefix = isRoot ? ' ' : `${prefix}${isLast ? ' ' : '│ '}`;\n children.forEach((child, index) => {\n walk(child, nextPrefix, index === children.length - 1, false);\n });\n };\n\n for (const root of roots) {\n walk(root, '', true, true);\n }\n\n return lines.join('\\n');\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Option from 'effect/Option';\nimport type { DXN, SpaceId } from '@dxos/keys';\n\nimport { ServiceNotAvailableError } from '../errors';\nimport * as Process from './Process';\nimport * as Scope from 'effect/Scope';\nimport * as Either from 'effect/Either';\n\nconst ServiceResolverTypeId = '~@dxos/functions/ServiceResolver' as const;\ntype ServiceResolverTypeId = typeof ServiceResolverTypeId;\n\nexport interface ServiceResolver {\n readonly [ServiceResolverTypeId]: ServiceResolverTypeId;\n\n /**\n * Resolve a set of services identified by their tags.\n * Returns a Context containing all requested services, or fails with ServiceNotAvailableError.\n */\n resolve<Tag extends Context.Tag<any, any>>(\n tag: Tag,\n context: ResolutionContext,\n ): Effect.Effect<Context.Tag.Service<Tag>, ServiceNotAvailableError, Scope.Scope>;\n}\n\n/**\n * Tag for the ServiceResolver service.\n */\nexport const ServiceResolver = Context.GenericTag<ServiceResolver>('@dxos/functions/ServiceResolver');\n\nexport const resolve = Effect.serviceFunctionEffect(ServiceResolver, (_) => _.resolve);\n\nexport const resolveAll = <const Tags extends readonly Context.Tag<any, any>[]>(\n tags: Tags,\n context: ResolutionContext,\n): Effect.Effect<Context.Context<Tags[number]>, ServiceNotAvailableError, Scope.Scope | ServiceResolver> =>\n Effect.gen(function* () {\n const services = yield* Effect.forEach(tags, (tag) =>\n resolve(tag, context).pipe(Effect.map((service) => Context.make(tag, service))),\n );\n return Context.mergeAll(...services);\n });\n\n/**\n * Provides context for service resolution.\n */\nexport interface ResolutionContext {\n /**\n * Under which identity the process is running.\n */\n readonly identity?: string;\n\n /**\n * Under which space the process is running.\n */\n readonly space?: SpaceId;\n\n /**\n * DXN of the conversation feed the process is running in.\n */\n readonly conversation?: DXN.String;\n\n /**\n * Under which process the process is running.\n */\n readonly process?: Process.ID;\n}\n\nexport const succeed = <I, S>(\n tag: Context.Tag<I, S>,\n getService: (context: ResolutionContext) => Effect.Effect<S, ServiceNotAvailableError, Scope.Scope>,\n): ServiceResolver => {\n return make((tag1, context) => {\n if (tag1.key !== tag.key) {\n return Effect.fail(new ServiceNotAvailableError(`Service not available: ${String(tag.key ?? tag)}`));\n }\n const service = getService(context);\n return service as any;\n });\n};\n\n/**\n * Create a ServiceResolver from a custom resolution function.\n */\nexport const make = (\n resolveFn: <I, S>(\n tag: Context.Tag<I, S>,\n context: ResolutionContext,\n ) => Effect.Effect<S, ServiceNotAvailableError, Scope.Scope>,\n): ServiceResolver => ({\n [ServiceResolverTypeId]: ServiceResolverTypeId,\n resolve: resolveFn,\n});\n\n/**\n * Create a ServiceResolver backed by a static Context.\n * Tags present in the context are resolved; missing tags fail with ServiceNotAvailableError.\n */\nexport const fromContext = (ctx: Context.Context<any>): ServiceResolver =>\n make((tag, context) =>\n Effect.gen(function* () {\n const service = Context.getOption(ctx, tag);\n if (Option.isNone(service)) {\n return yield* Effect.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));\n }\n return service.value;\n }),\n );\n\n/**\n * Create a ServiceResolver that resolves tags from the current Effect context.\n * Only the specified tags are available; requests for other tags fail.\n */\nexport const fromRequirements = <const Tags extends readonly Context.Tag<any, any>[]>(\n ...tags: Tags\n): Effect.Effect<ServiceResolver, never, Context.Tag.Identifier<Tags[number]>> =>\n Effect.contextWith((parentCtx: Context.Context<any>) => {\n const available = new Set(tags.map((tag) => tag.key));\n return make((tag, context) =>\n Effect.gen(function* () {\n let result: Context.Context<never> = Context.empty() as Context.Context<never>;\n if (!available.has(tag.key)) {\n return yield* Effect.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));\n }\n const service = Context.getOption(parentCtx, tag);\n if (Option.isNone(service)) {\n return yield* Effect.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));\n }\n return service.value;\n }),\n );\n });\n\n/**\n * Like {@link fromRequirements} but returns a Layer that provides ServiceResolver.\n */\nexport const layerRequirements = <const Tags extends readonly Context.Tag<any, any>[]>(\n ...tags: Tags\n): Layer.Layer<ServiceResolver, never, Context.Tag.Identifier<Tags[number]>> =>\n Layer.effect(ServiceResolver, fromRequirements(...tags));\n\n/**\n * Compose multiple resolvers left to right. Earlier resolvers take precedence:\n * the first resolver that can satisfy a tag wins.\n */\nexport const compose = (...resolvers: readonly ServiceResolver[]): ServiceResolver =>\n make((tag, context) =>\n Effect.gen(function* () {\n for (const resolver of resolvers) {\n const single = yield* resolver.resolve(tag, context).pipe(Effect.either);\n if (Either.isRight(single)) {\n return single.right;\n }\n }\n\n return yield* Effect.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));\n }),\n );\n\n/**\n * An empty resolver that fails for any requested service.\n */\nexport const empty: ServiceResolver = make((tag, context) => {\n return Effect.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));\n});\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Pipeable from 'effect/Pipeable';\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\nimport * as Schema from 'effect/Schema';\n\nexport interface Service {\n /** Read a value by key. Returns `None` if key does not exist. */\n get<S extends Schema.Schema<any, string, any>>(\n schema: S,\n key: string,\n ): Effect.Effect<Option.Option<Schema.Schema.Type<S>>, never, Schema.Schema.Context<S>>;\n\n /** Write a value for the given key. */\n set<S extends Schema.Schema<any, string, any>>(\n schema: S,\n key: string,\n value: Schema.Schema.Type<S>,\n ): Effect.Effect<void, never, Schema.Schema.Context<S>>;\n\n /** Remove a key. */\n delete(key: string): Effect.Effect<void>;\n\n /** List all keys, optionally filtered by prefix. */\n list(prefix?: string): Effect.Effect<readonly string[]>;\n\n /** Remove all keys managed by this scoped store. */\n clear(): Effect.Effect<void>;\n}\n\n/**\n * Scoped key-value storage service for processes.\n * Each process receives its own namespaced instance via the process manager.\n * Construct a live implementation with `StorageService.layer` from `@dxos/functions-runtime`.\n */\nexport class StorageService extends Context.Tag('@dxos/functions/StorageService')<StorageService, Service>() {}\n\nexport const get = Effect.serviceFunctionEffect(StorageService, (_) => _.get);\nexport const set = Effect.serviceFunctionEffect(StorageService, (_) => _.set);\nexport const deleteKey = Effect.serviceFunctionEffect(StorageService, (_) => _.delete);\nexport const list = Effect.serviceFunctionEffect(StorageService, (_) => _.list);\nexport const clear = Effect.serviceFunctionEffect(StorageService, (_) => _.clear);\n\n/**\n * Typed key in a storage service.\n */\nexport interface Key<T> extends Pipeable.Pipeable {\n readonly key: string;\n\n get: Effect.Effect<Option.Option<T>, never, StorageService>;\n set(value: T): Effect.Effect<void, never, StorageService>;\n delete(): Effect.Effect<void, never, StorageService>;\n}\n\n/**\n * Create a typed key in a storage service.\n */\nexport const key = <S extends Schema.Schema<any, string, any>>(schema: S, key: string): Key<Schema.Schema.Type<S>> => {\n return {\n key,\n get: get(schema, key),\n set: (value: Schema.Schema.Type<S>) => set(schema, key, value),\n delete: () => deleteKey(key),\n pipe(...args: any) {\n return Pipeable.pipeArguments(this, arguments);\n },\n };\n};\n\n/**\n * Typed key in a storage service with a default value.\n */\nexport interface KeyWithDefault<T, U> extends Pipeable.Pipeable {\n readonly key: string;\n get: Effect.Effect<T | U, never, StorageService>;\n set(value: U): Effect.Effect<void, never, StorageService>;\n delete(): Effect.Effect<void, never, StorageService>;\n}\n\n/**\n * Assign a default value to a key if it is not present.\n */\nexport const withDefault =\n <T>(getDefault: () => NoInfer<T>) =>\n (key: Key<T>): KeyWithDefault<T, T> => {\n return {\n key: key.key,\n get: key.get.pipe(Effect.map(Option.getOrElse(() => getDefault()))),\n set: (value) => key.set(value),\n delete: () => key.delete(),\n pipe(...args: any) {\n return Pipeable.pipeArguments(this, arguments);\n },\n };\n };\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as HttpClient from '@effect/platform/HttpClient';\nimport * as HttpClientRequest from '@effect/platform/HttpClientRequest';\nimport type * as Config from 'effect/Config';\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Redacted from 'effect/Redacted';\n\nimport { Query } from '@dxos/echo';\nimport { Database } from '@dxos/echo';\nimport { AccessToken } from '@dxos/types';\n\nexport type CredentialQuery = {\n service?: string;\n};\n\n// TODO(dmaretskyi): Unify with other apis.\n// packages/sdk/schema/src/common/access-token.ts\nexport type ServiceCredential = {\n service: string;\n\n // TODO(dmaretskyi): Build out.\n apiKey?: string;\n};\n\nexport class CredentialsService extends Context.Tag('@dxos/functions/CredentialsService')<\n CredentialsService,\n {\n /**\n * Query all.\n */\n queryCredentials: (query: CredentialQuery) => Promise<ServiceCredential[]>;\n\n /**\n * Get a single credential.\n * @throws {Error} If no credential is found.\n */\n getCredential: (query: CredentialQuery) => Promise<ServiceCredential>;\n }\n>() {\n static getCredential = (query: CredentialQuery): Effect.Effect<ServiceCredential, never, CredentialsService> =>\n Effect.gen(function* () {\n const credentials = yield* CredentialsService;\n return yield* Effect.promise(() => credentials.getCredential(query));\n });\n\n static getApiKey = (query: CredentialQuery): Effect.Effect<Redacted.Redacted<string>, never, CredentialsService> =>\n Effect.gen(function* () {\n const credential = yield* CredentialsService.getCredential(query);\n if (!credential.apiKey) {\n throw new Error(`API key not found for service: ${query.service}`);\n }\n return Redacted.make(credential.apiKey);\n });\n\n static configuredLayer = (credentials: ServiceCredential[]) =>\n Layer.succeed(CredentialsService, new ConfiguredCredentialsService(credentials));\n\n static layerConfig = (\n credentials: {\n service: string;\n apiKey: Config.Config<Redacted.Redacted<string>>;\n }[],\n ) =>\n Layer.effect(\n CredentialsService,\n Effect.gen(function* () {\n const serviceCredentials = yield* Effect.forEach(credentials, ({ service, apiKey }) =>\n Effect.gen(function* () {\n return {\n service,\n apiKey: Redacted.value(yield* apiKey),\n };\n }),\n );\n\n return new ConfiguredCredentialsService(serviceCredentials);\n }),\n );\n\n static layerFromDatabase = ({ caching = false }: { caching?: boolean } = {}) =>\n Layer.effect(\n CredentialsService,\n Effect.gen(function* () {\n const dbService = yield* Database.Service;\n const cache = new Map<string, ServiceCredential[]>();\n\n const queryCredentials = async (query: CredentialQuery): Promise<ServiceCredential[]> => {\n const cacheKey = JSON.stringify(query);\n if (caching && cache.has(cacheKey)) {\n return cache.get(cacheKey)!;\n }\n\n const accessTokens = await dbService.db.query(Query.type(AccessToken.AccessToken)).run();\n const credentials = accessTokens\n .filter((accessToken) => accessToken.source === query.service)\n .map((accessToken) => ({\n service: accessToken.source,\n apiKey: accessToken.token,\n }));\n\n if (caching) {\n cache.set(cacheKey, credentials);\n }\n\n return credentials;\n };\n\n return {\n getCredential: async (query) => {\n const credentials = await queryCredentials(query);\n if (credentials.length === 0) {\n throw new Error(`Credential not found for service: ${query.service}`);\n }\n\n return credentials[0];\n },\n queryCredentials: async (query) => {\n return queryCredentials(query);\n },\n };\n }),\n );\n}\n\nexport class ConfiguredCredentialsService implements Context.Tag.Service<CredentialsService> {\n constructor(private readonly credentials: ServiceCredential[] = []) {}\n\n addCredentials(credentials: ServiceCredential[]): ConfiguredCredentialsService {\n this.credentials.push(...credentials);\n return this;\n }\n\n async queryCredentials(query: CredentialQuery): Promise<ServiceCredential[]> {\n return this.credentials.filter((credential) => credential.service === query.service);\n }\n\n async getCredential(query: CredentialQuery): Promise<ServiceCredential> {\n const credential = this.credentials.find((credential) => credential.service === query.service);\n if (!credential) {\n throw new Error(`Credential not found for service: ${query.service}`);\n }\n\n return credential;\n }\n}\n\n/**\n * Maps the request to include the given token in the Authorization header.\n */\nexport const withAuthorization = (token: string, kind?: 'Bearer' | 'Basic') =>\n HttpClient.mapRequest((request) => {\n const authorization = kind ? `${kind} ${token}` : token;\n return HttpClientRequest.setHeader(request, 'Authorization', authorization);\n });\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Schema from 'effect/Schema';\n\nimport { Obj, Type } from '@dxos/echo';\nimport { invariant } from '@dxos/invariant';\nimport { LogLevel, log } from '@dxos/log';\n\nimport { TracingService } from './tracing';\n\nexport const ComputeEventPayload = Schema.Union(\n Schema.Struct({\n type: Schema.Literal('begin-compute'),\n nodeId: Schema.String,\n /**\n * Names of the inputs begin computed.\n */\n inputs: Schema.Array(Schema.String),\n }),\n Schema.Struct({\n type: Schema.Literal('end-compute'),\n nodeId: Schema.String,\n /**\n * Names of the outputs computed.\n */\n outputs: Schema.Array(Schema.String),\n }),\n Schema.Struct({\n type: Schema.Literal('compute-input'),\n nodeId: Schema.String,\n property: Schema.String,\n value: Schema.Any,\n }),\n Schema.Struct({\n type: Schema.Literal('compute-output'),\n nodeId: Schema.String,\n property: Schema.String,\n value: Schema.Any,\n }),\n Schema.Struct({\n type: Schema.Literal('custom'),\n nodeId: Schema.String,\n event: Schema.Any,\n }),\n);\nexport type ComputeEventPayload = Schema.Schema.Type<typeof ComputeEventPayload>;\n\nexport const ComputeEvent = Schema.Struct({\n payload: ComputeEventPayload,\n}).pipe(Type.object({ typename: 'org.dxos.type.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 }), tracing.getTraceContext());\n },\n nodeId: undefined,\n };\n }),\n );\n}\n\nexport const logCustomEvent = (data: any) =>\n Effect.gen(function* () {\n const logger = yield* ComputeEventLogger;\n if (!logger.nodeId) {\n throw new Error('logCustomEvent must be called within a node compute function');\n }\n logger.log({\n type: 'custom',\n nodeId: logger.nodeId,\n event: data,\n });\n });\n\nexport const createDefectLogger = <A, E, R>(): ((self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>) =>\n Effect.catchAll((error) =>\n Effect.gen(function* () {\n log.error('unhandled effect error', { error });\n throw error;\n }),\n );\n\nexport const createEventLogger = (\n level: LogLevel,\n message: string = 'event',\n): Context.Tag.Service<ComputeEventLogger> => {\n const logFunction = (\n {\n [LogLevel.WARN]: log.warn,\n [LogLevel.VERBOSE]: log.verbose,\n [LogLevel.DEBUG]: log.debug,\n [LogLevel.INFO]: log.info,\n [LogLevel.ERROR]: log.error,\n } as any\n )[level];\n invariant(logFunction);\n return {\n log: (event: ComputeEventPayload) => {\n logFunction(message, event);\n },\n nodeId: undefined,\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nimport { AgentStatus } from '@dxos/ai';\nimport { type DXN, Obj, Ref } from '@dxos/echo';\nimport { ObjectId } from '@dxos/keys';\nimport { Message } from '@dxos/types';\n\nimport type { Trigger } from '../types';\n\n/**\n * Provides a way for compute primitives (functions, workflows, tools)\n * to emit an execution trace as a series of structured ECHO objects.\n * @deprecated Use Trace.TraceService instead.\n */\nexport class TracingService extends Context.Tag('@dxos/functions/TracingService')<\n TracingService,\n {\n /**\n * Gets the parent message ID.\n */\n getTraceContext: () => TracingService.TraceContext;\n\n /**\n * Write an event to the tracing queue.\n * @param event - The event to write. Must be an a typed object.\n */\n write: (event: Obj.Unknown, traceContext: TracingService.TraceContext) => void;\n\n /**\n * Write an ephemeral event.\n */\n ephemeral: (event: Obj.Unknown, traceContext: TracingService.TraceContext) => void;\n\n traceInvocationStart({\n payload,\n target,\n }: {\n payload: TracingService.FunctionInvocationPayload;\n target?: DXN;\n }): Effect.Effect<TracingService.InvocationTraceData>;\n\n traceInvocationEnd({\n trace,\n exception,\n }: {\n trace: TracingService.InvocationTraceData;\n exception?: any;\n }): Effect.Effect<void>;\n }\n>() {\n static noop: Context.Tag.Service<TracingService> = {\n getTraceContext: () => ({}),\n write: () => {},\n ephemeral: () => {},\n traceInvocationStart: () =>\n Effect.sync(() => ({ invocationId: ObjectId.random(), invocationTraceQueue: undefined })),\n traceInvocationEnd: () => Effect.sync(() => {}),\n };\n\n static layerNoop: Layer.Layer<TracingService> = Layer.succeed(TracingService, TracingService.noop);\n\n /**\n * Creates a TracingService layer that emits events to the parent tracing service.\n */\n static layerSubframe = (mapContext: (currentContext: TracingService.TraceContext) => TracingService.TraceContext) =>\n Layer.effect(\n TracingService,\n Effect.gen(function* () {\n const tracing = yield* TracingService;\n const context = mapContext(tracing.getTraceContext());\n return {\n write: (event, context) => tracing.write(event, context),\n ephemeral: (event, context) => tracing.ephemeral(event, context),\n getTraceContext: () => context,\n traceInvocationStart: () => Effect.die('Tracing invocation inside another invocation is not supported.'),\n traceInvocationEnd: () => Effect.die('Tracing invocation inside another invocation is not supported.'),\n };\n }),\n );\n\n /**\n * Create sublayer to trace an invocation.\n * @param data\n * @returns\n */\n static layerInvocation = (data: TracingService.InvocationTraceData) =>\n TracingService.layerSubframe((context) => ({\n ...context,\n currentInvocation: data,\n }));\n\n /**\n * Emit the current human-readable execution status.\n */\n static emitStatus: (\n data: Omit<Obj.MakeProps<typeof AgentStatus>, 'created'>,\n ) => Effect.Effect<void, never, TracingService> = Effect.fnUntraced(function* (data) {\n const tracing = yield* TracingService;\n tracing.write(\n Obj.make(AgentStatus, {\n parentMessage: tracing.getTraceContext().parentMessage,\n toolCallId: tracing.getTraceContext().toolCallId,\n created: new Date().toISOString(),\n ...data,\n }),\n tracing.getTraceContext(),\n );\n });\n\n static emitConverationMessage: (\n data: Obj.MakeProps<typeof Message.Message> | Message.Message,\n ) => Effect.Effect<void, never, TracingService> = Effect.fnUntraced(function* (data) {\n const tracing = yield* TracingService;\n tracing.write(\n Obj.make(Message.Message, {\n parentMessage: tracing.getTraceContext().parentMessage,\n ...data,\n properties: {\n [MESSAGE_PROPERTY_TOOL_CALL_ID]: tracing.getTraceContext().toolCallId,\n ...data.properties,\n },\n }),\n tracing.getTraceContext(),\n );\n });\n\n static emitEphemeralMessage: (data: Message.Message) => Effect.Effect<void, never, TracingService> =\n Effect.fnUntraced(function* (data) {\n const tracing = yield* TracingService;\n tracing.ephemeral(data, tracing.getTraceContext());\n });\n}\n\nexport namespace TracingService {\n export interface TraceContext {\n currentInvocation?: InvocationTraceData;\n\n /**\n * If this thread sprung from a tool call, this is the ID of the message containing the tool call.\n */\n parentMessage?: ObjectId;\n\n /**\n * If the current thread is a byproduct of a tool call, this is the ID of the tool call.\n */\n toolCallId?: string;\n\n debugInfo?: unknown;\n }\n\n /**\n * Trace data for a function/trigger invocation.\n */\n export interface InvocationTraceData {\n invocationId: ObjectId;\n invocationTraceQueue?: DXN.String;\n }\n\n /**\n * Payload for a function/trigger invocation.\n */\n export interface FunctionInvocationPayload {\n data?: any;\n inputNodeId?: string;\n trigger?: {\n id: string;\n kind: Trigger.Kind;\n };\n chat?: Ref.Ref<Obj.Unknown>;\n process?: {\n pid: string;\n parentPid?: string;\n /**\n * Key of the executable.\n */\n key: string;\n\n /**\n * Process name.\n */\n name?: string;\n\n /**\n * Target object that the process is assigned to.\n */\n target?: string;\n };\n }\n}\n\n/**\n * Goes into {@link Message['properties']}\n */\nexport const MESSAGE_PROPERTY_TOOL_CALL_ID = 'toolCallId' as const;\n", "//\n// Copyright 2025 DXOS.org\n//\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nimport type { FunctionNotFoundError } from '../errors';\nimport { type InvocationServices } from '../sdk';\nimport { Operation } from '@dxos/operation';\n\nexport class FunctionInvocationService extends Context.Tag('@dxos/functions/FunctionInvocationService')<\n FunctionInvocationService,\n {\n invokeFunction<I, O>(\n functionDef: Operation.Definition<I, O, any>,\n input: I,\n ): Effect.Effect<O, never, InvocationServices>;\n\n resolveFunction(key: string): Effect.Effect<Operation.Definition.Any, FunctionNotFoundError>;\n }\n>() {\n static layerNotAvailable = Layer.succeed(FunctionInvocationService, {\n invokeFunction: () => Effect.die('FunctionInvocationService is not avaialble.'),\n resolveFunction: () => Effect.die('FunctionInvocationService is not available.'),\n });\n\n static invokeFunction = <I, O>(\n functionDef: Operation.Definition<I, O, any>,\n input: I,\n ): Effect.Effect<O, never, FunctionInvocationService | InvocationServices> =>\n Effect.serviceFunctionEffect(FunctionInvocationService, (service) => service.invokeFunction)(functionDef, input);\n\n static resolveFunction = (\n key: string,\n ): Effect.Effect<Operation.Definition.Any, FunctionNotFoundError, FunctionInvocationService> =>\n Effect.serviceFunctionEffect(FunctionInvocationService, (service) => service.resolveFunction)(key);\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nimport { type Entity } from '@dxos/echo';\nimport { createFeedServiceLayer, type Queue, type QueueAPI, type QueueFactory } from '@dxos/echo-db';\nimport type { DXN, QueueSubspaceTag } from '@dxos/keys';\n\n/**\n * Gives access to all queues.\n * @deprecated Use FeedService instead.\n */\nexport class QueueService extends Context.Tag('@dxos/functions/QueueService')<\n QueueService,\n {\n /**\n * API to access the queues.\n */\n readonly queues: QueueAPI;\n\n /**\n * The queue that is used to store the context of the current research.\n * @deprecated Use `ContextQueueService` instead.\n */\n readonly queue: Queue | undefined;\n }\n>() {\n static notAvailable = Layer.succeed(QueueService, {\n queues: {\n get(_dxn) {\n throw new Error('Queues not available');\n },\n create() {\n throw new Error('Queues not available');\n },\n },\n queue: undefined,\n });\n\n static make = (queues: QueueFactory, queue?: Queue): Context.Tag.Service<QueueService> => {\n return {\n queues,\n queue,\n };\n };\n\n static layer = (queues: QueueFactory, queue?: Queue): Layer.Layer<QueueService> =>\n Layer.succeed(QueueService, QueueService.make(queues, queue));\n\n /**\n * Gets a queue by its DXN.\n */\n static getQueue = <T extends Entity.Unknown = Entity.Unknown>(\n dxn: DXN,\n ): Effect.Effect<Queue<T>, never, QueueService> => QueueService.pipe(Effect.map(({ queues }) => queues.get<T>(dxn)));\n\n /**\n * Creates a new queue.\n */\n static createQueue = <T extends Entity.Unknown = Entity.Unknown>(options?: {\n subspaceTag?: QueueSubspaceTag;\n }): Effect.Effect<Queue<T>, never, QueueService> =>\n QueueService.pipe(Effect.map(({ queues }) => queues.create<T>(options)));\n\n static append = <T extends Entity.Unknown = Entity.Unknown>(queue: Queue<T>, objects: T[]): Effect.Effect<void> =>\n Effect.promise(() => queue.append(objects));\n}\n\n/**\n * Gives access to a specific queue passed as a context.\n */\nexport class ContextQueueService extends Context.Tag('@dxos/functions/ContextQueueService')<\n ContextQueueService,\n {\n readonly queue: Queue;\n }\n>() {\n static layer = (queue: Queue) => Layer.succeed(ContextQueueService, { queue });\n}\n\nexport const feedServiceFromQueueServiceLayer = Layer.unwrapEffect(\n Effect.gen(function* () {\n const { queues } = yield* QueueService;\n return createFeedServiceLayer(queues);\n }),\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, Obj, Ref, Type } from '@dxos/echo';\nimport { FormInputAnnotation } from '@dxos/echo/internal';\nimport { Text } from '@dxos/schema';\n\n/**\n * Source script.\n */\nexport const Script = Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n description: Schema.String.pipe(Schema.optional),\n // TODO(burdon): Change to hash of deployed content.\n // Whether source has changed since last deploy.\n changed: Schema.Boolean.pipe(FormInputAnnotation.set(false), Schema.optional),\n source: Ref.Ref(Text.Text).pipe(FormInputAnnotation.set(false)),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.script',\n version: '0.1.0',\n }),\n Annotation.LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({\n icon: 'ph--code--regular',\n hue: 'sky',\n }),\n);\n\nexport interface Script extends Schema.Schema.Type<typeof Script> {}\n\ntype Props = Omit<Obj.MakeProps<typeof Script>, 'source'> & { source?: string };\n\nexport const make = ({ source = '', ...props }: Props = {}): Script =>\n Obj.make(Script, { ...props, source: Ref.make(Text.make({ content: source })) });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { Annotation, Obj, QueryAST, Ref, Type } from '@dxos/echo';\nimport { OptionsAnnotationId, SystemTypeAnnotation } from '@dxos/echo/internal';\nimport { DXN } from '@dxos/keys';\n\n/**\n * Type discriminator for TriggerType.\n * Every spec has a type field of type TriggerKind that we can use to understand which type we're working with.\n * https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions\n */\nexport const Kinds = ['email', 'queue', 'subscription', 'timer', 'webhook'] as const;\nexport type Kind = (typeof Kinds)[number];\n\nconst kindLiteralAnnotations = { title: 'Kind' };\n\nexport const EmailSpec = Schema.Struct({\n kind: Schema.Literal('email').annotations(kindLiteralAnnotations),\n});\nexport type EmailSpec = Schema.Schema.Type<typeof EmailSpec>;\n\n// TODO(burdon): Change to Feed.\n// TODO(wittjosiah): Remove. Migrate to Subscription triggers once EDGE supports them for feed queries.\nexport const QueueSpec = Schema.Struct({\n kind: Schema.Literal('queue').annotations(kindLiteralAnnotations),\n\n // TODO(dmaretskyi): Rename to `feed` and change to a reference.\n queue: DXN.Schema,\n});\nexport type QueueSpec = Schema.Schema.Type<typeof QueueSpec>;\n\n/**\n * Subscription.\n */\nexport const SubscriptionSpec = Schema.Struct({\n kind: Schema.Literal('subscription').annotations(kindLiteralAnnotations),\n query: Schema.Struct({\n raw: Schema.optional(Schema.String.annotations({ title: 'Query' })),\n ast: QueryAST.Query,\n }),\n options: Schema.optional(\n Schema.Struct({\n // Watch changes to object (not just creation).\n deep: Schema.optional(Schema.Boolean.annotations({ title: 'Nested' })),\n // Debounce changes (delay in ms).\n delay: Schema.optional(Schema.Number.annotations({ title: 'Delay' })),\n }).annotations({ title: 'Options' }),\n ),\n});\nexport type SubscriptionSpec = Schema.Schema.Type<typeof SubscriptionSpec>;\n\n/**\n * Cron timer.\n */\nexport const TimerSpec = Schema.Struct({\n kind: Schema.Literal('timer').annotations(kindLiteralAnnotations),\n cron: Schema.String.annotations({\n title: 'Cron',\n [SchemaAST.ExamplesAnnotationId]: ['0 0 * * *'],\n }),\n});\nexport type TimerSpec = Schema.Schema.Type<typeof TimerSpec>;\n\n/**\n * Webhook.\n */\nexport const WebhookSpec = Schema.Struct({\n kind: Schema.Literal('webhook').annotations(kindLiteralAnnotations),\n method: Schema.optional(\n Schema.String.annotations({\n title: 'Method',\n [OptionsAnnotationId]: ['GET', 'POST'],\n }),\n ),\n port: Schema.optional(\n Schema.Number.annotations({\n title: 'Port',\n }),\n ),\n});\nexport type WebhookSpec = Schema.Schema.Type<typeof WebhookSpec>;\n\n/**\n * Trigger schema.\n */\nexport const Spec = Schema.Union(EmailSpec, QueueSpec, SubscriptionSpec, TimerSpec, WebhookSpec).annotations({\n title: 'Trigger',\n});\nexport type Spec = Schema.Schema.Type<typeof Spec>;\n\n/**\n * Function trigger.\n * Function is invoked with the `payload` passed as input data.\n * The event that triggers the function is available in the function context.\n */\nconst TriggerSchema = Schema.Struct({\n /**\n * Function or workflow to invoke.\n */\n // TODO(dmaretskyi): Can be a Ref(FunctionType) or Ref(ComputeGraphType).\n function: Schema.optional(Ref.Ref(Obj.Unknown).annotations({ title: 'Function' })),\n\n /**\n * Only used for workflowSchema.\n * Specifies the input node in the circuit.\n * @deprecated Remove and enforce a single input node in all compute graphSchema.\n */\n inputNodeId: Schema.optional(Schema.String.annotations({ title: 'Input Node ID' })),\n\n // TODO(burdon): NO BOOLEAN PROPERTIES (enabld/disabled/paused, etc.)\n // Need lint rule; or agent rule to require PR review for \"boolean\" key word.\n enabled: Schema.optional(Schema.Boolean.annotations({ title: 'Enabled' })),\n\n spec: Schema.optional(Spec),\n\n concurrency: Schema.optional(\n Schema.Number.annotations({\n title: 'Concurrency',\n default: 1,\n description:\n 'Maximum number of concurrent invocations of the trigger. For Feed triggers, this will process Feed items in parallel.',\n }),\n ),\n\n /**\n * Passed as the input data to the function.\n * Must match the function's input schema.\n *\n * @example\n * {\n * item: '{{event.item}}',\n * instructions: 'Summarize and perform entity-extraction'\n * mailbox: { '/': 'dxn:echo:AAA:ZZZ' }\n * }\n */\n input: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.trigger',\n version: '0.1.0',\n }),\n Annotation.IconAnnotation.set({ icon: 'ph--lightning--regular', hue: 'yellow' }),\n SystemTypeAnnotation.set(true),\n);\n\nexport interface Trigger extends Schema.Schema.Type<typeof TriggerSchema> {}\nexport const Trigger: Type.Obj<Trigger> = TriggerSchema as any;\n\nexport const make = (props: Obj.MakeProps<typeof Trigger>) => Obj.make(Trigger, props);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { DXN, Obj, Ref } from '@dxos/echo';\n\n// TODO(wittjosiah): Review this type.\n// - Should be discriminated union.\n// - Should be more consistent (e.g. subject vs item).\n// - Should re-use schemas if possible.\n\n// TODO(burdon): Reuse trigger schema from @dxos/functions (TriggerType).\nexport const EmailEvent = Schema.Struct({\n from: Schema.String,\n to: Schema.String,\n subject: Schema.String,\n created: Schema.String,\n body: Schema.String,\n});\nexport type EmailEvent = Schema.Schema.Type<typeof EmailEvent>;\n\nexport const QueueEvent = Schema.Struct({\n queue: DXN.Schema,\n item: Schema.Any,\n cursor: Schema.String,\n});\nexport type QueueEvent = Schema.Schema.Type<typeof QueueEvent>;\n\nexport const SubscriptionEvent = Schema.Struct({\n /**\n * Type of the mutation.\n */\n // TODO(dmaretskyi): Specify enum.\n type: Schema.String,\n\n /**\n * Reference to the object that was changed or created.\n */\n subject: Ref.Ref(Obj.Unknown),\n\n /**\n * @deprecated\n */\n changedObjectId: Schema.optional(Schema.String),\n});\nexport type SubscriptionEvent = Schema.Schema.Type<typeof SubscriptionEvent>;\n\nexport const TimerEvent = Schema.Struct({ tick: Schema.Number });\nexport type TimerEvent = Schema.Schema.Type<typeof TimerEvent>;\n\nexport const WebhookEvent = Schema.Struct({\n url: Schema.String,\n method: Schema.Literal('GET', 'POST'),\n headers: Schema.Record({ key: Schema.String, value: Schema.String }),\n bodyText: Schema.String,\n});\nexport type WebhookEvent = Schema.Schema.Type<typeof WebhookEvent>;\n\nexport const TriggerEvent = Schema.Union(EmailEvent, QueueEvent, SubscriptionEvent, TimerEvent, WebhookEvent);\nexport type TriggerEvent = Schema.Schema.Type<typeof TriggerEvent>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Obj } from '@dxos/echo';\n\n// TODO: use URL scheme for source?\nexport const FUNCTIONS_META_KEY = 'org.dxos.service.function';\n\nexport const FUNCTIONS_PRESET_META_KEY = 'org.dxos.service.function-preset';\n\n/**\n * NOTE: functionId is backend ID, not ECHO object id.\n */\nexport const getUserFunctionIdInMetadata = (meta: Obj.ReadonlyMeta) => {\n return meta.keys.find((key) => key.source === FUNCTIONS_META_KEY)?.id;\n};\n\n/**\n * NOTE: functionId is backend ID, not ECHO object id.\n * Must be called inside Obj.changeMeta() since it mutates the meta.\n */\nexport const setUserFunctionIdInMetadata = (meta: Obj.Meta, functionId: string) => {\n const key = meta.keys.find((key) => key.source === FUNCTIONS_META_KEY);\n if (key) {\n if (key.id !== functionId) {\n throw new Error('Metadata mismatch');\n }\n } else {\n meta.keys.push({ source: FUNCTIONS_META_KEY, id: functionId });\n }\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as AnthropicClient from '@effect/ai-anthropic/AnthropicClient';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { AiModelResolver, AiService } from '@dxos/ai';\nimport { AnthropicResolver } from '@dxos/ai/resolvers';\nimport { LifecycleState, Resource } from '@dxos/context';\nimport { Database, Feed, JsonSchema, Ref, type Type } from '@dxos/echo';\nimport { refFromEncodedReference } from '@dxos/echo/internal';\nimport { EchoClient, type EchoDatabaseImpl, type QueueFactory, createFeedServiceLayer } from '@dxos/echo-db';\nimport { runAndForwardErrors } from '@dxos/effect';\nimport { assertState, failedInvariant, invariant } from '@dxos/invariant';\nimport { PublicKey } from '@dxos/keys';\nimport { type FunctionProtocol } from '@dxos/protocols';\n\nimport { FunctionError } from '../errors';\nimport { type FunctionServices } from '../sdk';\nimport { CredentialsService, FunctionInvocationService, QueueService, TracingService } from '../services';\nimport * as Trace from '../Trace';\nimport { Operation } from '@dxos/operation';\n\nimport { FunctionsAiHttpClient } from './functions-ai-http-client';\n\n/**\n * Wraps a function handler made with `defineFunction` to a protocol that the functions-runtime expects.\n */\nexport const wrapFunctionHandler = (func: Operation.WithHandler<Operation.Definition.Any>): FunctionProtocol.Func => {\n if (!Operation.isOperationWithHandler(func)) {\n throw new TypeError('Expected operation with handler');\n }\n\n const serviceTags = func.services.map((service) => service.key);\n\n return {\n meta: {\n key: func.meta.key,\n name: func.meta.name,\n description: func.meta.description,\n inputSchema: JsonSchema.toJsonSchema(func.input),\n outputSchema: func.output === undefined ? undefined : JsonSchema.toJsonSchema(func.output),\n services: func.services.map((service) => service.key),\n },\n handler: async ({ data, context }) => {\n if (\n (serviceTags.includes(Database.Service.key) ||\n serviceTags.includes(QueueService.key) ||\n serviceTags.includes(Feed.Service.key)) &&\n (!context.services.dataService || !context.services.queryService)\n ) {\n throw new FunctionError({\n message: 'Services not provided: dataService, queryService',\n });\n }\n\n // eslint-disable-next-line no-useless-catch\n try {\n if (!SchemaAST.isAnyKeyword(func.input.ast)) {\n try {\n Schema.validateSync(func.input)(data);\n } catch (error) {\n throw new FunctionError({ message: 'Invalid input schema', cause: error });\n }\n }\n\n await using funcContext = await new FunctionContext(context).open();\n\n if (func.types.length > 0) {\n invariant(funcContext.db, 'Database is required for functions with types');\n await funcContext.db.graph.schemaRegistry.register(func.types as Type.AnyEntity[]);\n }\n\n const dataWithDecodedRefs =\n funcContext.db && !SchemaAST.isAnyKeyword(func.input.ast)\n ? decodeRefsFromSchema(func.input.ast, data, funcContext.db)\n : data;\n\n let result: any = await func.handler(dataWithDecodedRefs);\n\n if (Effect.isEffect(result)) {\n result = await runAndForwardErrors(\n (result as Effect.Effect<unknown, unknown, FunctionServices>).pipe(\n Effect.orDie,\n Effect.provide(funcContext.createLayer()),\n ),\n );\n }\n\n if (func.output && !SchemaAST.isAnyKeyword(func.output.ast)) {\n Schema.validateSync(func.output)(result);\n }\n\n return result;\n } catch (error) {\n // TODO(dmaretskyi): We might do error wrapping here and add extra context.\n throw error;\n }\n },\n };\n};\n\n/**\n * Container for services and context for a function.\n */\nclass FunctionContext extends Resource {\n readonly context: FunctionProtocol.Context;\n readonly client: EchoClient | undefined;\n db: EchoDatabaseImpl | undefined;\n queues: QueueFactory | undefined;\n\n constructor(context: FunctionProtocol.Context) {\n super();\n this.context = context;\n if (context.services.dataService && context.services.queryService) {\n this.client = new EchoClient().connectToService({\n dataService: context.services.dataService,\n queryService: context.services.queryService,\n queueService: context.services.queueService,\n });\n }\n }\n\n override async _open() {\n await this.client?.open();\n this.db =\n this.client && this.context.spaceId\n ? this.client.constructDatabase({\n spaceId: this.context.spaceId ?? failedInvariant(),\n spaceKey: PublicKey.fromHex(this.context.spaceKey ?? failedInvariant('spaceKey missing in context')),\n reactiveSchemaQuery: false,\n preloadSchemaOnOpen: false,\n })\n : undefined;\n\n await this.db?.setSpaceRoot(this.context.spaceRootUrl ?? failedInvariant('spaceRootUrl missing in context'));\n await this.db?.open();\n this.queues =\n this.client && this.context.spaceId ? this.client.constructQueueFactory(this.context.spaceId) : undefined;\n }\n\n override async _close() {\n await this.db?.close();\n await this.client?.close();\n }\n\n createLayer(): Layer.Layer<FunctionServices> {\n assertState(this._lifecycleState === LifecycleState.OPEN, 'FunctionContext is not open');\n\n const dbLayer = this.db ? Database.layer(this.db) : Database.notAvailable;\n const queuesLayer = this.queues ? QueueService.layer(this.queues) : QueueService.notAvailable;\n const feedLayer = this.queues ? createFeedServiceLayer(this.queues) : Feed.notAvailable;\n const credentials = dbLayer\n ? CredentialsService.layerFromDatabase({ caching: true }).pipe(Layer.provide(dbLayer))\n : CredentialsService.configuredLayer([]);\n const functionInvocationService = MockedFunctionInvocationService;\n const tracing = TracingService.layerNoop;\n\n const aiLayer = this.context.services.functionsAiService\n ? AiModelResolver.AiModelResolver.buildAiService.pipe(\n Layer.provide(\n AnthropicResolver.make().pipe(\n Layer.provide(\n AnthropicClient.layer({\n // Note: It doesn't matter what is base url here, it will be proxied to ai gateway in edge.\n apiUrl: 'http://internal/provider/anthropic',\n }).pipe(Layer.provide(FunctionsAiHttpClient.layer(this.context.services.functionsAiService))),\n ),\n ),\n ),\n )\n : AiService.notAvailable;\n\n return Layer.mergeAll(\n dbLayer,\n queuesLayer,\n feedLayer,\n credentials,\n functionInvocationService,\n aiLayer,\n tracing,\n // TODO(dmaretskyi): Forward trace events.\n Trace.writerLayerNoop,\n );\n }\n}\n\nconst MockedFunctionInvocationService = Layer.succeed(FunctionInvocationService, {\n invokeFunction: () => Effect.die('Calling functions from functions is not implemented yet.'),\n resolveFunction: () => Effect.die('Not implemented.'),\n});\n\nconst decodeRefsFromSchema = (ast: SchemaAST.AST, value: unknown, db: EchoDatabaseImpl): unknown => {\n if (value == null) {\n return value;\n }\n\n const encoded = SchemaAST.encodedBoundAST(ast);\n if (Ref.isRefType(encoded)) {\n if (Ref.isRef(value)) {\n return value;\n }\n\n if (typeof value === 'object' && value !== null && typeof (value as any)['/'] === 'string') {\n const resolver = db.graph.createRefResolver({ context: { space: db.spaceId } });\n return refFromEncodedReference(value as any, resolver);\n }\n\n return value;\n }\n\n switch (encoded._tag) {\n case 'TypeLiteral': {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n return value;\n }\n const result: Record<string, unknown> = { ...(value as any) };\n for (const prop of SchemaAST.getPropertySignatures(encoded)) {\n const key = prop.name.toString();\n if (key in result) {\n result[key] = decodeRefsFromSchema(prop.type, (result as any)[key], db);\n }\n }\n return result;\n }\n\n case 'TupleType': {\n if (!Array.isArray(value)) {\n return value;\n }\n\n // For arrays, effect uses TupleType with empty elements and a single rest element.\n if (encoded.elements.length === 0 && encoded.rest.length === 1) {\n const elementType = encoded.rest[0].type;\n return (value as unknown[]).map((item) => decodeRefsFromSchema(elementType, item, db));\n }\n\n return value;\n }\n\n case 'Union': {\n // Optional values are represented as union with undefined.\n const nonUndefined = encoded.types.filter((t) => !SchemaAST.isUndefinedKeyword(t));\n if (nonUndefined.length === 1) {\n return decodeRefsFromSchema(nonUndefined[0], value, db);\n }\n\n // For other unions we can't safely pick a branch without validating.\n return value;\n }\n\n case 'Suspend': {\n return decodeRefsFromSchema(encoded.f(), value, db);\n }\n\n case 'Refinement': {\n return decodeRefsFromSchema(encoded.from, value, db);\n }\n\n default: {\n return value;\n }\n }\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Headers from '@effect/platform/Headers';\nimport * as HttpClient from '@effect/platform/HttpClient';\nimport * as HttpClientError from '@effect/platform/HttpClientError';\nimport * as HttpClientResponse from '@effect/platform/HttpClientResponse';\nimport * as Effect from 'effect/Effect';\nimport * as FiberRef from 'effect/FiberRef';\nimport * as Layer from 'effect/Layer';\nimport * as Stream from 'effect/Stream';\n\nimport { log } from '@dxos/log';\nimport { type EdgeFunctionEnv, ErrorCodec } from '@dxos/protocols';\n/**\n * Copy pasted from https://github.com/Effect-TS/effect/blob/main/packages/platform/src/internal/fetchHttpClient.ts\n */\nexport const requestInitTagKey = '@effect/platform/FetchHttpClient/FetchOptions';\n\nexport class FunctionsAiHttpClient {\n static make = (service: EdgeFunctionEnv.FunctionsAiService) =>\n HttpClient.make((request, url, signal, fiber) => {\n const context = fiber.getFiberRef(FiberRef.currentContext);\n const options: RequestInit = context.unsafeMap.get(requestInitTagKey) ?? {};\n const headers = options.headers\n ? Headers.merge(Headers.fromInput(options.headers), request.headers)\n : request.headers;\n\n const send = (body: BodyInit | undefined) =>\n Effect.tryPromise({\n try: () =>\n service.fetch(\n new Request(url, {\n ...options,\n method: request.method,\n headers,\n body,\n // Note: Don't pass signal - it can't be serialized through RPC\n }),\n ),\n catch: (cause) => {\n log.error('Failed to fetch', { errorSerialized: ErrorCodec.encode(cause as Error) });\n return new HttpClientError.RequestError({\n request,\n reason: 'Transport',\n cause,\n });\n },\n }).pipe(Effect.map((response) => HttpClientResponse.fromWeb(request, response)));\n\n switch (request.body._tag) {\n case 'Raw':\n case 'Uint8Array':\n return send(request.body.body as any);\n case 'FormData':\n return send(request.body.formData);\n case 'Stream':\n return Stream.toReadableStreamEffect(request.body.stream).pipe(Effect.flatMap(send));\n }\n\n return send(undefined);\n });\n\n static layer = (service: EdgeFunctionEnv.FunctionsAiService) =>\n Layer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OAAO,CAACC,MAAM,CAAWC,8BAAmBD,CAAAA,CAAAA;AAC/E,UAAIF,aAAa5F,WAAW,GAAG;AAC7B,eAAOO,qBAAqBqF,aAAa,CAAA,GAAIrB,QAAOrE,EAAAA;MACtD;AAGA,aAAOqE;IACT;IAEA,KAAK,WAAW;AACd,aAAOhE,qBAAqBiE,QAAQwB,EAAC,GAAIzB,QAAOrE,EAAAA;IAClD;IAEA,KAAK,cAAc;AACjB,aAAOK,qBAAqBiE,QAAQyB,MAAM1B,QAAOrE,EAAAA;IACnD;IAEA,SAAS;AACP,aAAOqE;IACT;EACF;AACF;",
6
+ "names": ["BaseError", "ServiceNotAvailableError", "BaseError", "extend", "service", "options", "context", "message", "FunctionNotFoundError", "functionKey", "function", "FunctionError", "TriggerStateNotFoundError", "OperationHandlerSet", "ExampleHandlers", "OperationHandlerSet", "lazy", "Effect", "Schema", "Context", "OperationHandlerSet", "assertArgument", "ID", "String", "pipe", "brand", "ProcessTypeId", "isProcess", "executable", "make", "opts", "create", "assertArgument", "test", "key", "ctx", "map", "partial", "onSpawn", "void", "onInput", "onAlarm", "onChildEvent", "fromOperation", "op", "handler", "meta", "input", "output", "services", "gen", "semaphore", "makeSemaphore", "opHandler", "OperationHandlerSet", "getHandler", "orDie", "submitOutput", "succeed", "withPermits", "State", "ProcessMonitorService", "Tag", "SpawnedEvent", "EventType", "schema", "Void", "isEphemeral", "ExitedEvent", "Struct", "outcome", "Literal", "prettyProcessTree", "tree", "length", "pidSet", "Set", "node", "pid", "childrenByParent", "Map", "roots", "parent", "parentPid", "has", "push", "siblings", "get", "set", "byPid", "a", "b", "localeCompare", "sort", "values", "formatLabel", "idShort", "slice", "parts", "state", "params", "name", "error", "inputCount", "outputCount", "wallTime", "metrics", "Math", "round", "join", "lines", "walk", "prefix", "isLast", "isRoot", "branch", "children", "nextPrefix", "forEach", "child", "index", "root", "empty", "make", "Context", "Effect", "Layer", "Option", "Either", "ServiceResolverTypeId", "ServiceResolver", "GenericTag", "resolve", "serviceFunctionEffect", "_", "resolveAll", "tags", "context", "gen", "services", "forEach", "tag", "pipe", "map", "service", "make", "mergeAll", "succeed", "getService", "tag1", "key", "fail", "ServiceNotAvailableError", "String", "resolveFn", "fromContext", "ctx", "getOption", "isNone", "value", "fromRequirements", "contextWith", "parentCtx", "available", "Set", "result", "empty", "has", "layerRequirements", "effect", "compose", "resolvers", "resolver", "single", "either", "isRight", "right", "Pipeable", "Context", "Effect", "Option", "StorageService", "Tag", "get", "serviceFunctionEffect", "_", "set", "deleteKey", "delete", "list", "clear", "key", "schema", "value", "pipe", "args", "pipeArguments", "arguments", "withDefault", "getDefault", "map", "getOrElse", "HttpClient", "HttpClientRequest", "Context", "Effect", "Layer", "Redacted", "Query", "Database", "AccessToken", "CredentialsService", "Tag", "getCredential", "query", "gen", "credentials", "promise", "getApiKey", "credential", "apiKey", "Error", "service", "make", "configuredLayer", "succeed", "ConfiguredCredentialsService", "layerConfig", "effect", "serviceCredentials", "forEach", "value", "layerFromDatabase", "caching", "dbService", "Database", "Service", "cache", "Map", "queryCredentials", "cacheKey", "JSON", "stringify", "has", "get", "accessTokens", "db", "Query", "type", "AccessToken", "run", "filter", "accessToken", "source", "map", "token", "set", "length", "addCredentials", "push", "find", "withAuthorization", "kind", "mapRequest", "request", "authorization", "setHeader", "Context", "Effect", "Layer", "Schema", "Obj", "Type", "invariant", "LogLevel", "log", "Context", "Effect", "Layer", "AgentStatus", "Obj", "ObjectId", "Message", "TracingService", "Tag", "noop", "getTraceContext", "write", "ephemeral", "traceInvocationStart", "sync", "invocationId", "ObjectId", "random", "invocationTraceQueue", "undefined", "traceInvocationEnd", "layerNoop", "succeed", "layerSubframe", "mapContext", "effect", "gen", "tracing", "context", "event", "die", "layerInvocation", "data", "currentInvocation", "emitStatus", "fnUntraced", "Obj", "make", "AgentStatus", "parentMessage", "toolCallId", "created", "Date", "toISOString", "emitConverationMessage", "Message", "properties", "MESSAGE_PROPERTY_TOOL_CALL_ID", "emitEphemeralMessage", "ComputeEventPayload", "Union", "Struct", "type", "Literal", "nodeId", "String", "inputs", "Array", "outputs", "property", "value", "Any", "event", "ComputeEvent", "payload", "pipe", "Type", "object", "typename", "version", "ComputeEventLogger", "Tag", "noop", "log", "undefined", "layerFromTracing", "effect", "gen", "tracing", "TracingService", "write", "Obj", "make", "getTraceContext", "logCustomEvent", "data", "logger", "Error", "createDefectLogger", "catchAll", "error", "createEventLogger", "level", "message", "logFunction", "LogLevel", "WARN", "warn", "VERBOSE", "verbose", "DEBUG", "debug", "INFO", "info", "ERROR", "invariant", "Context", "Effect", "Layer", "FunctionInvocationService", "Tag", "layerNotAvailable", "succeed", "invokeFunction", "die", "resolveFunction", "functionDef", "input", "serviceFunctionEffect", "service", "key", "Context", "Effect", "Layer", "createFeedServiceLayer", "QueueService", "Tag", "notAvailable", "succeed", "queues", "get", "_dxn", "Error", "create", "queue", "undefined", "make", "layer", "getQueue", "dxn", "pipe", "map", "createQueue", "options", "append", "objects", "promise", "ContextQueueService", "feedServiceFromQueueServiceLayer", "unwrapEffect", "gen", "createFeedServiceLayer", "make", "Schema", "Annotation", "Obj", "Ref", "Type", "FormInputAnnotation", "Text", "Script", "Struct", "name", "String", "pipe", "optional", "description", "changed", "Boolean", "FormInputAnnotation", "set", "source", "Ref", "Text", "Type", "object", "typename", "version", "Annotation", "LabelAnnotation", "IconAnnotation", "icon", "hue", "make", "props", "Obj", "content", "make", "Schema", "SchemaAST", "Annotation", "Obj", "QueryAST", "Ref", "Type", "OptionsAnnotationId", "SystemTypeAnnotation", "DXN", "Kinds", "kindLiteralAnnotations", "title", "EmailSpec", "Struct", "kind", "Literal", "annotations", "QueueSpec", "queue", "DXN", "Schema", "SubscriptionSpec", "query", "raw", "optional", "String", "ast", "QueryAST", "Query", "options", "deep", "Boolean", "delay", "Number", "TimerSpec", "cron", "ExamplesAnnotationId", "WebhookSpec", "method", "OptionsAnnotationId", "port", "Spec", "Union", "TriggerSchema", "function", "Ref", "Obj", "Unknown", "inputNodeId", "enabled", "spec", "concurrency", "default", "description", "input", "Record", "key", "value", "Any", "pipe", "Type", "object", "typename", "version", "Annotation", "IconAnnotation", "set", "icon", "hue", "SystemTypeAnnotation", "Trigger", "make", "props", "Schema", "DXN", "Obj", "Ref", "EmailEvent", "Struct", "from", "String", "to", "subject", "created", "body", "QueueEvent", "queue", "DXN", "Schema", "item", "Any", "cursor", "SubscriptionEvent", "type", "Ref", "Obj", "Unknown", "changedObjectId", "optional", "TimerEvent", "tick", "Number", "WebhookEvent", "url", "method", "Literal", "headers", "Record", "key", "value", "bodyText", "TriggerEvent", "Union", "FUNCTIONS_META_KEY", "FUNCTIONS_PRESET_META_KEY", "getUserFunctionIdInMetadata", "meta", "keys", "find", "key", "source", "id", "setUserFunctionIdInMetadata", "functionId", "Error", "push", "AnthropicClient", "Effect", "Layer", "Schema", "SchemaAST", "AiModelResolver", "AiService", "AnthropicResolver", "LifecycleState", "Resource", "Database", "Feed", "JsonSchema", "Ref", "refFromEncodedReference", "EchoClient", "createFeedServiceLayer", "runAndForwardErrors", "assertState", "failedInvariant", "invariant", "PublicKey", "Operation", "Headers", "HttpClient", "HttpClientError", "HttpClientResponse", "Effect", "FiberRef", "Layer", "Stream", "log", "ErrorCodec", "requestInitTagKey", "FunctionsAiHttpClient", "make", "service", "request", "url", "signal", "fiber", "context", "getFiberRef", "currentContext", "options", "unsafeMap", "get", "headers", "merge", "fromInput", "send", "body", "tryPromise", "try", "fetch", "Request", "method", "catch", "cause", "error", "errorSerialized", "encode", "RequestError", "reason", "pipe", "map", "response", "fromWeb", "_tag", "formData", "toReadableStreamEffect", "stream", "flatMap", "undefined", "layer", "succeed", "wrapFunctionHandler", "func", "Operation", "isOperationWithHandler", "TypeError", "serviceTags", "services", "map", "service", "key", "meta", "name", "description", "inputSchema", "JsonSchema", "toJsonSchema", "input", "outputSchema", "output", "undefined", "handler", "data", "context", "includes", "Database", "Service", "QueueService", "Feed", "dataService", "queryService", "FunctionError", "message", "isAnyKeyword", "ast", "Schema", "validateSync", "error", "cause", "funcContext", "FunctionContext", "open", "types", "length", "invariant", "db", "graph", "schemaRegistry", "register", "dataWithDecodedRefs", "decodeRefsFromSchema", "result", "isEffect", "runAndForwardErrors", "pipe", "orDie", "provide", "createLayer", "Resource", "client", "queues", "EchoClient", "connectToService", "queueService", "_open", "spaceId", "constructDatabase", "failedInvariant", "spaceKey", "PublicKey", "fromHex", "reactiveSchemaQuery", "preloadSchemaOnOpen", "setSpaceRoot", "spaceRootUrl", "constructQueueFactory", "_close", "close", "assertState", "_lifecycleState", "LifecycleState", "OPEN", "dbLayer", "layer", "notAvailable", "queuesLayer", "feedLayer", "createFeedServiceLayer", "credentials", "CredentialsService", "layerFromDatabase", "caching", "configuredLayer", "functionInvocationService", "MockedFunctionInvocationService", "tracing", "TracingService", "layerNoop", "aiLayer", "functionsAiService", "AiModelResolver", "buildAiService", "AnthropicResolver", "make", "apiUrl", "FunctionsAiHttpClient", "AiService", "mergeAll", "writerLayerNoop", "succeed", "FunctionInvocationService", "invokeFunction", "die", "resolveFunction", "value", "encoded", "encodedBoundAST", "Ref", "isRefType", "isRef", "resolver", "createRefResolver", "space", "refFromEncodedReference", "_tag", "Array", "isArray", "prop", "getPropertySignatures", "toString", "type", "elements", "rest", "elementType", "item", "nonUndefined", "filter", "t", "isUndefinedKeyword", "f", "from"]
7
+ }
@@ -0,0 +1 @@
1
+ {"inputs":{"src/errors.ts":{"bytes":3251,"imports":[{"path":"@dxos/errors","kind":"import-statement","external":true}],"format":"esm"},"src/example/definitions.ts":{"bytes":4309,"imports":[{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true}],"format":"esm"},"src/example/fib.ts":{"bytes":1942,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/example/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/example/reply.ts":{"bytes":1599,"imports":[{"path":"effect/Console","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/example/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/example/sleep.ts":{"bytes":1402,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"src/example/definitions.ts","kind":"import-statement","original":"./definitions"},{"path":"@dxos/operation","kind":"import-statement","external":true}],"format":"esm"},"src/example/index.ts":{"bytes":1160,"imports":[{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/example/definitions.ts","kind":"import-statement","original":"./definitions"},{"path":"src/example/fib.ts","kind":"dynamic-import","original":"./fib"},{"path":"src/example/reply.ts","kind":"dynamic-import","original":"./reply"},{"path":"src/example/sleep.ts","kind":"dynamic-import","original":"./sleep"}],"format":"esm"},"src/Trace.ts":{"bytes":12960,"imports":[{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true}],"format":"esm"},"src/process/Process.ts":{"bytes":29116,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/Trace.ts","kind":"import-statement","original":"../Trace"}],"format":"esm"},"src/process/ServiceResolver.ts":{"bytes":15670,"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/Option","kind":"import-statement","external":true},{"path":"src/errors.ts","kind":"import-statement","original":"../errors"},{"path":"effect/Either","kind":"import-statement","external":true}],"format":"esm"},"src/process/StorageService.ts":{"bytes":8288,"imports":[{"path":"effect/Pipeable","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true}],"format":"esm"},"src/sdk.ts":{"bytes":1916,"imports":[],"format":"esm"},"src/services/credentials.ts":{"bytes":16035,"imports":[{"path":"@effect/platform/HttpClient","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClientRequest","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Redacted","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true}],"format":"esm"},"src/services/tracing.ts":{"bytes":14683,"imports":[{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true}],"format":"esm"},"src/services/event-logger.ts":{"bytes":12035,"imports":[{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/services/tracing.ts","kind":"import-statement","original":"./tracing"}],"format":"esm"},"src/services/function-invocation-service.ts":{"bytes":4050,"imports":[{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true}],"format":"esm"},"src/services/queues.ts":{"bytes":7388,"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/echo-db","kind":"import-statement","external":true}],"format":"esm"},"src/services/index.ts":{"bytes":1416,"imports":[{"path":"src/services/credentials.ts","kind":"import-statement","original":"./credentials"},{"path":"src/services/credentials.ts","kind":"import-statement","original":"./credentials"},{"path":"src/services/event-logger.ts","kind":"import-statement","original":"./event-logger"},{"path":"src/services/event-logger.ts","kind":"import-statement","original":"./event-logger"},{"path":"src/services/function-invocation-service.ts","kind":"import-statement","original":"./function-invocation-service"},{"path":"src/services/queues.ts","kind":"import-statement","original":"./queues"},{"path":"src/services/tracing.ts","kind":"import-statement","original":"./tracing"}],"format":"esm"},"src/types/Script.ts":{"bytes":4453,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"src/types/Trigger.ts":{"bytes":16164,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true}],"format":"esm"},"src/types/TriggerEvent.ts":{"bytes":5983,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"format":"esm"},"src/types/url.ts":{"bytes":3375,"imports":[],"format":"esm"},"src/types/index.ts":{"bytes":909,"imports":[{"path":"src/types/Script.ts","kind":"import-statement","original":"./Script"},{"path":"src/types/Trigger.ts","kind":"import-statement","original":"./Trigger"},{"path":"src/types/TriggerEvent.ts","kind":"import-statement","original":"./TriggerEvent"},{"path":"src/types/url.ts","kind":"import-statement","original":"./url"}],"format":"esm"},"src/protocol/functions-ai-http-client.ts":{"bytes":9111,"imports":[{"path":"@effect/platform/Headers","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClient","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClientError","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClientResponse","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/FiberRef","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true}],"format":"esm"},"src/protocol/protocol.ts":{"bytes":37023,"imports":[{"path":"@effect/ai-anthropic/AnthropicClient","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/ai/resolvers","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"src/errors.ts","kind":"import-statement","original":"../errors"},{"path":"src/services/index.ts","kind":"import-statement","original":"../services"},{"path":"src/Trace.ts","kind":"import-statement","original":"../Trace"},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/protocol/functions-ai-http-client.ts","kind":"import-statement","original":"./functions-ai-http-client"}],"format":"esm"},"src/protocol/index.ts":{"bytes":459,"imports":[{"path":"src/protocol/protocol.ts","kind":"import-statement","original":"./protocol"}],"format":"esm"},"src/index.ts":{"bytes":1503,"imports":[{"path":"src/errors.ts","kind":"import-statement","original":"./errors"},{"path":"src/example/index.ts","kind":"import-statement","original":"./example"},{"path":"src/process/Process.ts","kind":"import-statement","original":"./process/Process"},{"path":"src/process/ServiceResolver.ts","kind":"import-statement","original":"./process/ServiceResolver"},{"path":"src/process/StorageService.ts","kind":"import-statement","original":"./process/StorageService"},{"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"},{"path":"src/Trace.ts","kind":"import-statement","original":"./Trace"}],"format":"esm"}},"outputs":{"dist/lib/neutral/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":97803},"dist/lib/neutral/index.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-BHLSCAA2.mjs","kind":"import-statement"},{"path":"dist/lib/neutral/chunk-Z2XDJJVH.mjs","kind":"import-statement"},{"path":"dist/lib/neutral/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"dist/lib/neutral/fib-S6PPI4UW.mjs","kind":"dynamic-import"},{"path":"dist/lib/neutral/reply-TOHXEG7V.mjs","kind":"dynamic-import"},{"path":"dist/lib/neutral/sleep-QPSZDPEH.mjs","kind":"dynamic-import"},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/invariant","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/Option","kind":"import-statement","external":true},{"path":"effect/Either","kind":"import-statement","external":true},{"path":"effect/Pipeable","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Option","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","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@effect/ai-anthropic/AnthropicClient","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/ai/resolvers","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@effect/platform/Headers","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClient","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClientError","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClientResponse","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/FiberRef","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Stream","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true}],"exports":["ComputeEvent","ComputeEventLogger","ComputeEventPayload","ConfiguredCredentialsService","ContextQueueService","CredentialsService","ExampleHandlers","FUNCTIONS_META_KEY","FUNCTIONS_PRESET_META_KEY","Fibonacci","FunctionError","FunctionInvocationService","FunctionNotFoundError","MESSAGE_PROPERTY_TOOL_CALL_ID","Process","QueueService","Reply","Script","ServiceNotAvailableError","ServiceResolver","Sleep","StorageService","Trace","TracingService","Trigger","TriggerEvent","TriggerStateNotFoundError","clear","createDefectLogger","createEventLogger","deleteKey","feedServiceFromQueueServiceLayer","get","getUserFunctionIdInMetadata","key","list","logCustomEvent","set","setUserFunctionIdInMetadata","withAuthorization","withDefault","wrapFunctionHandler"],"entryPoint":"src/index.ts","inputs":{"src/errors.ts":{"bytesInOutput":788},"src/index.ts":{"bytesInOutput":0},"src/example/index.ts":{"bytesInOutput":215},"src/process/Process.ts":{"bytesInOutput":4393},"src/process/ServiceResolver.ts":{"bytesInOutput":2893},"src/process/StorageService.ts":{"bytesInOutput":1199},"src/services/credentials.ts":{"bytesInOutput":3578},"src/services/index.ts":{"bytesInOutput":0},"src/services/event-logger.ts":{"bytesInOutput":2940},"src/services/tracing.ts":{"bytesInOutput":2794},"src/services/function-invocation-service.ts":{"bytesInOutput":822},"src/services/queues.ts":{"bytesInOutput":1463},"src/types/Script.ts":{"bytesInOutput":1046},"src/types/index.ts":{"bytesInOutput":0},"src/types/Trigger.ts":{"bytesInOutput":4050},"src/types/TriggerEvent.ts":{"bytesInOutput":1364},"src/types/url.ts":{"bytesInOutput":581},"src/protocol/protocol.ts":{"bytesInOutput":10560},"src/protocol/functions-ai-http-client.ts":{"bytesInOutput":2183}},"bytes":42588},"dist/lib/neutral/Trace.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/neutral/Trace.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-BHLSCAA2.mjs","kind":"import-statement"},{"path":"dist/lib/neutral/chunk-J5LGTIGS.mjs","kind":"import-statement"}],"exports":["Event","EventType","Message","MessageData","Meta","TraceService","TraceSink","isOfType","layerConsole","layerNoop","noopWriter","testTraceService","write","writerLayerNoop"],"entryPoint":"src/Trace.ts","inputs":{},"bytes":492},"dist/lib/neutral/chunk-BHLSCAA2.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6937},"dist/lib/neutral/chunk-BHLSCAA2.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true}],"exports":["Event","EventType","Message","MessageData","Meta","TraceService","TraceSink","Trace_exports","isOfType","layerConsole","layerNoop","noopWriter","testTraceService","write","writerLayerNoop"],"inputs":{"src/Trace.ts":{"bytesInOutput":2633}},"bytes":2962},"dist/lib/neutral/fib-S6PPI4UW.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1007},"dist/lib/neutral/fib-S6PPI4UW.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-Z2XDJJVH.mjs","kind":"import-statement"},{"path":"dist/lib/neutral/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/example/fib.ts","inputs":{"src/example/fib.ts":{"bytesInOutput":333}},"bytes":518},"dist/lib/neutral/reply-TOHXEG7V.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":802},"dist/lib/neutral/reply-TOHXEG7V.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-Z2XDJJVH.mjs","kind":"import-statement"},{"path":"dist/lib/neutral/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"effect/Console","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/example/reply.ts","inputs":{"src/example/reply.ts":{"bytesInOutput":282}},"bytes":469},"dist/lib/neutral/sleep-QPSZDPEH.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":710},"dist/lib/neutral/sleep-QPSZDPEH.mjs":{"imports":[{"path":"dist/lib/neutral/chunk-Z2XDJJVH.mjs","kind":"import-statement"},{"path":"dist/lib/neutral/chunk-J5LGTIGS.mjs","kind":"import-statement"},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/example/sleep.ts","inputs":{"src/example/sleep.ts":{"bytesInOutput":221}},"bytes":408},"dist/lib/neutral/chunk-Z2XDJJVH.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2122},"dist/lib/neutral/chunk-Z2XDJJVH.mjs":{"imports":[{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true}],"exports":["Fibonacci","Reply","Sleep"],"inputs":{"src/example/definitions.ts":{"bytesInOutput":1032}},"bytes":1149},"dist/lib/neutral/chunk-J5LGTIGS.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/neutral/chunk-J5LGTIGS.mjs":{"imports":[],"exports":["__export"],"inputs":{},"bytes":235}}}
@@ -0,0 +1,19 @@
1
+ import {
2
+ Reply
3
+ } from "./chunk-Z2XDJJVH.mjs";
4
+ import "./chunk-J5LGTIGS.mjs";
5
+
6
+ // src/example/reply.ts
7
+ import * as Console from "effect/Console";
8
+ import * as Effect from "effect/Effect";
9
+ import { Operation } from "@dxos/operation";
10
+ var reply_default = Reply.pipe(Operation.withHandler(Effect.fn(function* (input) {
11
+ yield* Console.log("reply", {
12
+ input
13
+ });
14
+ return input;
15
+ })));
16
+ export {
17
+ reply_default as default
18
+ };
19
+ //# sourceMappingURL=reply-TOHXEG7V.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/example/reply.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Console from 'effect/Console';\nimport * as Effect from 'effect/Effect';\n\nimport { Operation } from '@dxos/operation';\nimport { Reply } from './definitions';\n\nexport default Reply.pipe(\n Operation.withHandler(\n Effect.fn(function* (input) {\n yield* Console.log('reply', { input });\n return input;\n }),\n ),\n);\n"],
5
+ "mappings": ";;;;;;AAIA,YAAYA,aAAa;AACzB,YAAYC,YAAY;AAExB,SAASC,iBAAiB;AAG1B,IAAA,gBAAeC,MAAMC,KACnBC,UAAUC,YACDC,UAAG,WAAWC,OAAK;AACxB,SAAeC,YAAI,SAAS;IAAED;EAAM,CAAA;AACpC,SAAOA;AACT,CAAA,CAAA,CAAA;",
6
+ "names": ["Console", "Effect", "Operation", "Reply", "pipe", "Operation", "withHandler", "fn", "input", "log"]
7
+ }
@@ -0,0 +1,15 @@
1
+ import {
2
+ Sleep
3
+ } from "./chunk-Z2XDJJVH.mjs";
4
+ import "./chunk-J5LGTIGS.mjs";
5
+
6
+ // src/example/sleep.ts
7
+ import * as Effect from "effect/Effect";
8
+ import { Operation } from "@dxos/operation";
9
+ var sleep_default = Sleep.pipe(Operation.withHandler(Effect.fn(function* ({ duration = 1e5 }) {
10
+ yield* Effect.sleep(duration);
11
+ })));
12
+ export {
13
+ sleep_default as default
14
+ };
15
+ //# sourceMappingURL=sleep-QPSZDPEH.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/example/sleep.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport { Sleep } from './definitions';\nimport { Operation } from '@dxos/operation';\n\nexport default Sleep.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ duration = 100_000 }) {\n yield* Effect.sleep(duration);\n }),\n ),\n);\n"],
5
+ "mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,iBAAiB;AAE1B,IAAA,gBAAeC,MAAMC,KACnBC,UAAUC,YACDC,UAAG,WAAW,EAAEC,WAAW,IAAO,GAAE;AACzC,SAAcC,aAAMD,QAAAA;AACtB,CAAA,CAAA,CAAA;",
6
+ "names": ["Effect", "Operation", "Sleep", "pipe", "Operation", "withHandler", "fn", "duration", "sleep"]
7
+ }
@@ -0,0 +1,135 @@
1
+ import { Type } from '@dxos/echo';
2
+ import * as Layer from 'effect/Layer';
3
+ import * as Context from 'effect/Context';
4
+ import * as Effect from 'effect/Effect';
5
+ import * as Schema from 'effect/Schema';
6
+ /**
7
+ * Writes ephemeral or persistent events to the trace.
8
+ * Exposed to processes and operations to record events to the trace.
9
+ */
10
+ export interface TraceWriter {
11
+ write<T>(eventType: EventType<T>, payload: NoInfer<T>): void;
12
+ }
13
+ declare const TraceService_base: Context.TagClass<TraceService, "@dxos/functions/TraceService", TraceWriter>;
14
+ /**
15
+ * Service that writes events to the trace.
16
+ * Exposed to processes and operations to record events to the trace.
17
+ */
18
+ export declare class TraceService extends TraceService_base {
19
+ }
20
+ /**
21
+ * Writes an event to the trace.
22
+ */
23
+ export declare const write: <T>(eventType: EventType<T>, payload: NoInfer<T>) => Effect.Effect<void, never, TraceService>;
24
+ /**
25
+ * Defines an event type for the trace.
26
+ */
27
+ export interface EventType<T> {
28
+ readonly key: string;
29
+ readonly schema: Schema.Schema<T, any>;
30
+ readonly isEphemeral: boolean;
31
+ }
32
+ export declare const EventType: <T>(key: string, opts: {
33
+ schema: Schema.Schema<T, any>;
34
+ isEphemeral: boolean;
35
+ }) => EventType<T>;
36
+ /**
37
+ * Extracts the payload type from an event type.
38
+ */
39
+ export type PayloadType<E extends EventType<any>> = E extends EventType<infer T> ? T : never;
40
+ export declare const Event: Schema.Struct<{
41
+ timestamp: typeof Schema.Number;
42
+ type: typeof Schema.String;
43
+ data: typeof Schema.Unknown;
44
+ }>;
45
+ export interface Event extends Schema.Schema.Type<typeof Event> {
46
+ }
47
+ /**
48
+ * Checks if an event is of a given type.
49
+ */
50
+ export declare const isOfType: <T, E extends Event>(eventType: EventType<T>, event: E) => event is E & {
51
+ data: T;
52
+ };
53
+ /**
54
+ * Metadata on the context of a trace message.
55
+ */
56
+ export declare const Meta: Schema.Struct<{
57
+ pid: Schema.optional<typeof Schema.String>;
58
+ parentPid: Schema.optional<typeof Schema.String>;
59
+ processName: Schema.optional<typeof Schema.String>;
60
+ /**
61
+ * ID of the conversation feed object if present.
62
+ */
63
+ conversationId: Schema.optional<import("@dxos/keys").ObjectIdClass>;
64
+ /**
65
+ * ID of the trigger object if invocation resulted from a trigger.
66
+ */
67
+ triggerId: Schema.optional<import("@dxos/keys").ObjectIdClass>;
68
+ }>;
69
+ export interface Meta extends Schema.Schema.Type<typeof Meta> {
70
+ }
71
+ /**
72
+ * Envelope for a set of events.
73
+ */
74
+ export declare const MessageData: Schema.Struct<{
75
+ meta: Schema.Struct<{
76
+ pid: Schema.optional<typeof Schema.String>;
77
+ parentPid: Schema.optional<typeof Schema.String>;
78
+ processName: Schema.optional<typeof Schema.String>;
79
+ /**
80
+ * ID of the conversation feed object if present.
81
+ */
82
+ conversationId: Schema.optional<import("@dxos/keys").ObjectIdClass>;
83
+ /**
84
+ * ID of the trigger object if invocation resulted from a trigger.
85
+ */
86
+ triggerId: Schema.optional<import("@dxos/keys").ObjectIdClass>;
87
+ }>;
88
+ isEphemeral: typeof Schema.Boolean;
89
+ events: Schema.Array$<Schema.Struct<{
90
+ timestamp: typeof Schema.Number;
91
+ type: typeof Schema.String;
92
+ data: typeof Schema.Unknown;
93
+ }>>;
94
+ }>;
95
+ export interface MessageData extends Schema.Schema.Type<typeof MessageData> {
96
+ }
97
+ export declare const Message: Type.Obj<{
98
+ readonly meta: {
99
+ readonly pid?: string | undefined;
100
+ readonly parentPid?: string | undefined;
101
+ readonly processName?: string | undefined;
102
+ readonly conversationId?: string | undefined;
103
+ readonly triggerId?: string | undefined;
104
+ };
105
+ readonly isEphemeral: boolean;
106
+ readonly events: readonly {
107
+ readonly timestamp: number;
108
+ readonly type: string;
109
+ readonly data: unknown;
110
+ }[];
111
+ }, Schema.Struct.Fields>;
112
+ export interface Message extends Schema.Schema.Type<typeof Message> {
113
+ }
114
+ /**
115
+ * Sink for complete trace messages.
116
+ */
117
+ export interface Sink {
118
+ write(message: Message): void;
119
+ }
120
+ declare const TraceSink_base: Context.TagClass<TraceSink, "@dxos/functions/TraceSink", Sink>;
121
+ /**
122
+ * Sink for complete trace messages.
123
+ * The Process Manager forwards trace messages to it.
124
+ */
125
+ export declare class TraceSink extends TraceSink_base {
126
+ }
127
+ export declare const noopWriter: TraceWriter;
128
+ export declare const writerLayerNoop: Layer.Layer<TraceService>;
129
+ export declare const layerNoop: Layer.Layer<TraceSink>;
130
+ export declare const layerConsole: Layer.Layer<TraceSink>;
131
+ export declare const testTraceService: (opts?: {
132
+ meta?: Meta;
133
+ }) => Layer.Layer<TraceService, never, TraceSink>;
134
+ export {};
135
+ //# sourceMappingURL=Trace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Trace.d.ts","sourceRoot":"","sources":["../../../src/Trace.ts"],"names":[],"mappings":"AAMA,OAAO,EAAmB,IAAI,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;CAC9D;;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,iBAAwE;CAAG;AAE7G;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,YAAY,CAC1D,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACvC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,SAAS,GAAI,CAAC,EACzB,KAAK,M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errors.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;;;;;;;;;;;;;qBAiB8L,CAAC;;;;;;;;;;;;;;;AAf/P,qBAAa,wBAAyB,SAAQ,6BAAgE;gBAChG,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC;CAGzE;;;;;;;;;;;;;qBAW6P,CAAC;;;;;;;;;;;;;;;AAT/P,qBAAa,qBAAsB,SAAQ,0BAA0D;gBACvF,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC;CAG7E;;;;;;;;;;;;;qBAK6P,CAAC;;;;;;;;;;;;;;;AAH/P,qBAAa,aAAc,SAAQ,kBAA8D;CAAG;;;;;;;;;;;;;qBAG0J,CAAC;;;;;;;;;;;;;;;AAD/P,qBAAa,yBAA0B,SAAQ,8BAAmE;CAAG"}
@@ -0,0 +1,11 @@
1
+ import { Operation } from '@dxos/operation';
2
+ export declare const Fibonacci: Operation.Definition<{
3
+ readonly iterations?: number | undefined;
4
+ }, {
5
+ readonly result: string;
6
+ }, never>;
7
+ export declare const Reply: Operation.Definition<any, any, never>;
8
+ export declare const Sleep: Operation.Definition<{
9
+ readonly duration?: number | undefined;
10
+ }, void, never>;
11
+ //# sourceMappingURL=definitions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../../../src/example/definitions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,eAAO,MAAM,SAAS;;;;SAepB,CAAC;AAEH,eAAO,MAAM,KAAK,uCAQhB,CAAC;AAEH,eAAO,MAAM,KAAK;;eAahB,CAAC"}
@@ -1,7 +1,8 @@
1
- declare const _default: import("..").FunctionDefinition<{
1
+ import { Operation } from '@dxos/operation';
2
+ declare const _default: Operation.WithHandler<Operation.Definition<{
2
3
  readonly iterations?: number | undefined;
3
4
  }, {
4
5
  readonly result: string;
5
- }, import("..").FunctionServices>;
6
+ }, never>>;
6
7
  export default _default;
7
8
  //# sourceMappingURL=fib.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fib.d.ts","sourceRoot":"","sources":["../../../../src/example/fib.ts"],"names":[],"mappings":";;;;;AASA,wBAsBG"}
1
+ {"version":3,"file":"fib.d.ts","sourceRoot":"","sources":["../../../../src/example/fib.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;;;;;;AAG5C,wBAYE"}