@dxos/functions 0.8.3 → 0.8.4-main.1068cf700f
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.
- package/dist/lib/neutral/index.mjs +1229 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/types/src/errors.d.ts +121 -0
- package/dist/types/src/errors.d.ts.map +1 -0
- package/dist/types/src/example/fib.d.ts +7 -0
- package/dist/types/src/example/fib.d.ts.map +1 -0
- package/dist/types/src/example/forex-effect.d.ts +3 -0
- package/dist/types/src/example/forex-effect.d.ts.map +1 -0
- package/dist/types/src/example/index.d.ts +12 -0
- package/dist/types/src/example/index.d.ts.map +1 -0
- package/dist/types/src/example/reply.d.ts +3 -0
- package/dist/types/src/example/reply.d.ts.map +1 -0
- package/dist/types/src/example/sleep.d.ts +5 -0
- package/dist/types/src/example/sleep.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +5 -6
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operation-compatibility.test.d.ts +2 -0
- package/dist/types/src/operation-compatibility.test.d.ts.map +1 -0
- package/dist/types/src/protocol/functions-ai-http-client.d.ts +12 -0
- package/dist/types/src/protocol/functions-ai-http-client.d.ts.map +1 -0
- package/dist/types/src/protocol/index.d.ts +2 -0
- package/dist/types/src/protocol/index.d.ts.map +1 -0
- package/dist/types/src/protocol/protocol.d.ts +7 -0
- package/dist/types/src/protocol/protocol.d.ts.map +1 -0
- package/dist/types/src/protocol/protocol.test.d.ts +2 -0
- package/dist/types/src/protocol/protocol.test.d.ts.map +1 -0
- package/dist/types/src/sdk.d.ts +114 -0
- package/dist/types/src/sdk.d.ts.map +1 -0
- package/dist/types/src/services/credentials.d.ts +24 -4
- package/dist/types/src/services/credentials.d.ts.map +1 -1
- package/dist/types/src/services/event-logger.d.ts +74 -30
- package/dist/types/src/services/event-logger.d.ts.map +1 -1
- package/dist/types/src/services/function-invocation-service.d.ts +16 -0
- package/dist/types/src/services/function-invocation-service.d.ts.map +1 -0
- package/dist/types/src/services/index.d.ts +5 -6
- package/dist/types/src/services/index.d.ts.map +1 -1
- package/dist/types/src/services/queues.d.ts +35 -6
- package/dist/types/src/services/queues.d.ts.map +1 -1
- package/dist/types/src/services/tracing.d.ts +78 -5
- package/dist/types/src/services/tracing.d.ts.map +1 -1
- package/dist/types/src/types/Function.d.ts +52 -0
- package/dist/types/src/types/Function.d.ts.map +1 -0
- package/dist/types/src/types/Script.d.ts +21 -0
- package/dist/types/src/types/Script.d.ts.map +1 -0
- package/dist/types/src/types/Trigger.d.ts +121 -0
- package/dist/types/src/types/Trigger.d.ts.map +1 -0
- package/dist/types/src/types/TriggerEvent.d.ts +74 -0
- package/dist/types/src/types/TriggerEvent.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +6 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/url.d.ts +13 -0
- package/dist/types/src/types/url.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +27 -65
- package/src/errors.ts +21 -0
- package/src/example/fib.ts +32 -0
- package/src/example/forex-effect.ts +40 -0
- package/src/example/index.ts +13 -0
- package/src/example/reply.ts +21 -0
- package/src/example/sleep.ts +24 -0
- package/src/index.ts +5 -8
- package/src/operation-compatibility.test.ts +185 -0
- package/src/protocol/functions-ai-http-client.ts +67 -0
- package/src/{executor → protocol}/index.ts +1 -1
- package/src/protocol/protocol.test.ts +59 -0
- package/src/protocol/protocol.ts +262 -0
- package/src/sdk.ts +289 -0
- package/src/services/credentials.ts +109 -5
- package/src/services/event-logger.ts +77 -37
- package/src/services/function-invocation-service.ts +37 -0
- package/src/services/index.ts +5 -6
- package/src/services/queues.ts +56 -11
- package/src/services/tracing.ts +151 -11
- package/src/types/Function.ts +82 -0
- package/src/types/Script.ts +34 -0
- package/src/types/Trigger.ts +143 -0
- package/src/types/TriggerEvent.ts +62 -0
- package/src/types/index.ts +9 -0
- package/src/types/url.ts +32 -0
- package/dist/lib/browser/bundler/index.mjs +0 -236
- package/dist/lib/browser/bundler/index.mjs.map +0 -7
- package/dist/lib/browser/chunk-WEFZUEL2.mjs +0 -300
- package/dist/lib/browser/chunk-WEFZUEL2.mjs.map +0 -7
- package/dist/lib/browser/edge/index.mjs +0 -69
- package/dist/lib/browser/edge/index.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -486
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/testing/index.mjs +0 -28
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node/bundler/index.cjs +0 -260
- package/dist/lib/node/bundler/index.cjs.map +0 -7
- package/dist/lib/node/chunk-IJAE7FZK.cjs +0 -320
- package/dist/lib/node/chunk-IJAE7FZK.cjs.map +0 -7
- package/dist/lib/node/edge/index.cjs +0 -94
- package/dist/lib/node/edge/index.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -522
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/testing/index.cjs +0 -43
- package/dist/lib/node/testing/index.cjs.map +0 -7
- package/dist/lib/node-esm/bundler/index.mjs +0 -238
- package/dist/lib/node-esm/bundler/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LIYPMWNQ.mjs +0 -302
- package/dist/lib/node-esm/chunk-LIYPMWNQ.mjs.map +0 -7
- package/dist/lib/node-esm/edge/index.mjs +0 -71
- package/dist/lib/node-esm/edge/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -487
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/testing/index.mjs +0 -29
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/bundler/bundler.d.ts +0 -51
- package/dist/types/src/bundler/bundler.d.ts.map +0 -1
- package/dist/types/src/bundler/bundler.test.d.ts +0 -2
- package/dist/types/src/bundler/bundler.test.d.ts.map +0 -1
- package/dist/types/src/bundler/index.d.ts +0 -2
- package/dist/types/src/bundler/index.d.ts.map +0 -1
- package/dist/types/src/edge/functions.d.ts +0 -16
- package/dist/types/src/edge/functions.d.ts.map +0 -1
- package/dist/types/src/edge/index.d.ts +0 -2
- package/dist/types/src/edge/index.d.ts.map +0 -1
- package/dist/types/src/executor/executor.d.ts +0 -8
- package/dist/types/src/executor/executor.d.ts.map +0 -1
- package/dist/types/src/executor/index.d.ts +0 -2
- package/dist/types/src/executor/index.d.ts.map +0 -1
- package/dist/types/src/handler.d.ts +0 -64
- package/dist/types/src/handler.d.ts.map +0 -1
- package/dist/types/src/schema.d.ts +0 -38
- package/dist/types/src/schema.d.ts.map +0 -1
- package/dist/types/src/services/ai.d.ts +0 -12
- package/dist/types/src/services/ai.d.ts.map +0 -1
- package/dist/types/src/services/database.d.ts +0 -11
- package/dist/types/src/services/database.d.ts.map +0 -1
- package/dist/types/src/services/function-call-service.d.ts +0 -16
- package/dist/types/src/services/function-call-service.d.ts.map +0 -1
- package/dist/types/src/services/service-container.d.ts +0 -44
- package/dist/types/src/services/service-container.d.ts.map +0 -1
- package/dist/types/src/testing/index.d.ts +0 -2
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/dist/types/src/testing/logger.d.ts +0 -5
- package/dist/types/src/testing/logger.d.ts.map +0 -1
- package/dist/types/src/testing/services.d.ts +0 -13
- package/dist/types/src/testing/services.d.ts.map +0 -1
- package/dist/types/src/trace.d.ts +0 -124
- package/dist/types/src/trace.d.ts.map +0 -1
- package/dist/types/src/translations.d.ts +0 -12
- package/dist/types/src/translations.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -411
- package/dist/types/src/types.d.ts.map +0 -1
- package/dist/types/src/url.d.ts +0 -17
- package/dist/types/src/url.d.ts.map +0 -1
- package/src/bundler/bundler.test.ts +0 -59
- package/src/bundler/bundler.ts +0 -270
- package/src/bundler/index.ts +0 -5
- package/src/edge/functions.ts +0 -64
- package/src/edge/index.ts +0 -9
- package/src/executor/executor.ts +0 -47
- package/src/handler.ts +0 -113
- package/src/schema.ts +0 -57
- package/src/services/ai.ts +0 -32
- package/src/services/database.ts +0 -28
- package/src/services/function-call-service.ts +0 -64
- package/src/services/service-container.ts +0 -109
- package/src/testing/index.ts +0 -5
- package/src/testing/logger.ts +0 -16
- package/src/testing/services.ts +0 -32
- package/src/trace.ts +0 -180
- package/src/translations.ts +0 -20
- package/src/types.ts +0 -211
- package/src/url.ts +0 -52
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/errors.ts", "../../../src/example/fib.ts", "../../../src/sdk.ts", "../../../src/types/Function.ts", "../../../src/types/Script.ts", "../../../src/types/Trigger.ts", "../../../src/types/TriggerEvent.ts", "../../../src/types/url.ts", "../../../src/example/reply.ts", "../../../src/example/sleep.ts", "../../../src/example/index.ts", "../../../src/services/credentials.ts", "../../../src/services/event-logger.ts", "../../../src/services/tracing.ts", "../../../src/services/function-invocation-service.ts", "../../../src/services/queues.ts", "../../../src/protocol/protocol.ts", "../../../src/protocol/functions-ai-http-client.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { BaseError, type BaseErrorOptions } from '@dxos/errors';\n\nexport class ServiceNotAvailableError extends BaseError.extend('ServiceNotAvailable', 'Service not available') {\n constructor(service: string, options?: Omit<BaseErrorOptions, 'context'>) {\n super({ context: { service }, ...options });\n }\n}\n\nexport class FunctionNotFoundError extends BaseError.extend('FunctionNotFound', 'Function not found') {\n constructor(functionKey: string, options?: Omit<BaseErrorOptions, 'context'>) {\n super({ context: { function: functionKey }, ...options });\n }\n}\n\nexport class FunctionError extends BaseError.extend('FunctionError', 'Function invocation error') {}\n\nexport class TriggerStateNotFoundError extends BaseError.extend('TriggerStateNotFound', 'Trigger state not found') {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { defineFunction } from '../sdk';\n\nexport default defineFunction({\n key: 'example.org/function/fib',\n name: 'Fibonacci',\n description: 'Function that calculates a Fibonacci number',\n inputSchema: Schema.Struct({\n iterations: Schema.optional(Schema.Number).annotations({\n description: 'Number of iterations',\n default: 100_000,\n }),\n }),\n outputSchema: Schema.Struct({\n result: Schema.String,\n }),\n handler: Effect.fn(function* ({ data: { iterations = 100_000 } }) {\n let a = 0n;\n let b = 1n;\n for (let i = 0; i < iterations; i++) {\n a += b;\n b = a - b;\n }\n return { result: a.toString() };\n }),\n});\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { type AiService } from '@dxos/ai';\nimport { Obj, Type } from '@dxos/echo';\nimport { type Database } from '@dxos/echo';\nimport { assertArgument, failedInvariant } from '@dxos/invariant';\nimport { Operation } from '@dxos/operation';\n\nimport {\n type CredentialsService,\n type FunctionInvocationService,\n type QueueService,\n type TracingService,\n} from './services';\nimport { Function } from './types';\nimport { getUserFunctionIdInMetadata, setUserFunctionIdInMetadata } from './types';\n\n// TODO(burdon): Model after http request. Ref Lambda/OpenFaaS.\n// https://docs.aws.amazon.com/lambda/latest/dg/typescript-handler.html\n// https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/#functions\n// https://www.npmjs.com/package/aws-lambda\n\n/**\n * Services that are provided at the function call site by the caller.\n */\nexport type InvocationServices = TracingService;\n\n/**\n * Services that are available to invoked functions.\n */\nexport type FunctionServices =\n | InvocationServices\n | AiService.AiService\n | CredentialsService\n | Database.Service\n | QueueService\n | FunctionInvocationService;\n\n/**\n * Function handler.\n */\nexport type FunctionHandler<TData = {}, TOutput = any, S extends FunctionServices = FunctionServices> = (params: {\n /**\n * Context available to the function.\n */\n context: FunctionContext;\n\n /**\n * Data passed as the input to the function.\n * Must match the function's input schema.\n * This will be the payload from the trigger or other data passed into the function in a workflow.\n */\n data: TData;\n}) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any, S>;\n\n/**\n * Function context.\n */\nexport interface FunctionContext {\n // TODO(dmaretskyi): Consider what we should put into context.\n}\n\nconst typeId = Symbol.for('@dxos/functions/FunctionDefinition');\n\nexport type FunctionDefinition<T = any, O = any, S extends FunctionServices = FunctionServices> = {\n [typeId]: true;\n key: string;\n name: string;\n description?: string;\n inputSchema: Schema.Schema<T, any>;\n outputSchema?: Schema.Schema<O, any>;\n\n /**\n * List of types the function uses.\n * This is used to ensure that the types are available when the function is executed.\n */\n types: readonly Type.Entity.Any[];\n\n /**\n * Keys of the required services.\n */\n services: readonly string[];\n\n handler: FunctionHandler<T, O, S>;\n meta?: {\n /**\n * Tools that are projected from functions have this annotation.\n *\n * deployedFunctionId:\n * - Backend deployment ID assigned by the EDGE function service (typically a UUID).\n * - Used for remote invocation via `FunctionInvocationService` → `RemoteFunctionExecutionService`.\n * - Persisted on the corresponding ECHO `Function.Function` object's metadata under the\n * `FUNCTIONS_META_KEY` and retrieved with `getUserFunctionIdInMetadata`.\n */\n deployedFunctionId?: string;\n };\n};\n\nexport declare namespace FunctionDefinition {\n export type Any = FunctionDefinition<any, any, any>;\n export type Input<T extends Any> = T extends FunctionDefinition<infer I, infer _O, infer _S> ? I : never;\n export type Output<T extends Any> = T extends FunctionDefinition<infer _I, infer O, infer _S> ? O : never;\n export type Services<T extends Any> = T extends FunctionDefinition<infer _I, infer _O, infer S> ? S : never;\n}\n\nexport type FunctionProps<T, O> = {\n key: string;\n name: string;\n description?: string;\n inputSchema: Schema.Schema<T, any>;\n outputSchema?: Schema.Schema<O, any>;\n\n /**\n * List of types the function uses.\n * This is used to ensure that the types are available when the function is executed.\n */\n types?: readonly Type.Entity.Any[];\n // TODO(dmaretskyi): This currently doesn't cause a compile-time error if the handler requests a service that is not specified\n services?: readonly Context.Tag<any, any>[];\n\n handler: FunctionHandler<T, O, FunctionServices>;\n};\n\n// TODO(dmaretskyi): Output type doesn't get typechecked.\nexport const defineFunction: {\n <I, O>(params: FunctionProps<I, O>): FunctionDefinition<I, O, FunctionServices>;\n} = ({ key, name, description, inputSchema, outputSchema = Schema.Any, handler, types, services }) => {\n if (!Schema.isSchema(inputSchema)) {\n throw new Error('Input schema must be a valid schema');\n }\n if (typeof handler !== 'function') {\n throw new Error('Handler must be a function');\n }\n\n // Captures the function definition location.\n const limit = Error.stackTraceLimit;\n Error.stackTraceLimit = 2;\n const traceError = new Error();\n Error.stackTraceLimit = limit;\n let cache: false | string = false;\n const captureStackTrace = () => {\n if (cache !== false) {\n return cache;\n }\n if (traceError.stack !== undefined) {\n const stack = traceError.stack.split('\\n');\n if (stack[2] !== undefined) {\n cache = stack[2].trim();\n return cache;\n }\n }\n };\n\n const handlerWithSpan = (...args: any[]) => {\n const result = (handler as any)(...args);\n if (Effect.isEffect(result)) {\n return Effect.withSpan(result, `${key ?? name}`, {\n captureStackTrace,\n });\n }\n return result;\n };\n\n return {\n [typeId]: true,\n key,\n name,\n description,\n inputSchema,\n outputSchema,\n handler: handlerWithSpan,\n types: types ?? [],\n services: !services ? [] : getServiceKeys(services),\n } satisfies FunctionDefinition.Any;\n};\n\nconst getServiceKeys = (services: readonly Context.Tag<any, any>[]) => {\n return services.map((tag: any) => {\n if (typeof tag.key === 'string') {\n return tag.key;\n }\n failedInvariant();\n });\n};\n\n/**\n * Converts a FunctionDefinition to an OperationDefinition with handler.\n * The function handler is adapted to the OperationHandler format.\n *\n * Note: FunctionDefinition stores service keys as strings, not Tag types,\n * so we can't use Operation.withHandler's type inference here.\n */\nexport const toOperation = <T, O, S extends FunctionServices = FunctionServices>(\n functionDef: FunctionDefinition<T, O, S>,\n): Operation.Definition<T, O> & { handler: Operation.Handler<T, O, any, S> } => {\n const op = Operation.make({\n schema: {\n input: functionDef.inputSchema,\n output: functionDef.outputSchema ?? Schema.Any,\n },\n meta: {\n key: functionDef.key,\n name: functionDef.name,\n description: functionDef.description,\n },\n });\n\n // Adapt FunctionHandler signature to OperationHandler format.\n // FunctionHandler expects { context, data }, OperationHandler expects just input.\n const operationHandler: Operation.Handler<T, O, any, S> = (input: T) => {\n const result = functionDef.handler({\n context: {} as FunctionContext,\n data: input,\n });\n\n // Convert Promise or plain value to Effect.\n if (Effect.isEffect(result)) {\n return result;\n }\n if (result instanceof Promise) {\n return Effect.tryPromise(() => result);\n }\n return Effect.succeed(result as O);\n };\n\n // Manually attach handler since FunctionDefinition stores service keys as strings,\n // not Tag types, so withHandler's type inference doesn't apply.\n return {\n ...op,\n handler: operationHandler,\n };\n};\n\nexport const FunctionDefinition = {\n make: defineFunction,\n isFunction: (value: unknown): value is FunctionDefinition.Any => {\n return typeof value === 'object' && value !== null && Symbol.for('@dxos/functions/FunctionDefinition') in value;\n },\n serialize: (functionDef: FunctionDefinition.Any): Function.Function => {\n assertArgument(FunctionDefinition.isFunction(functionDef), 'functionDef');\n return serializeFunction(functionDef);\n },\n deserialize: (functionObj: Function.Function): FunctionDefinition.Any => {\n assertArgument(Obj.instanceOf(Function.Function, functionObj), 'functionObj');\n return deserializeFunction(functionObj);\n },\n toOperation,\n};\n\nexport const serializeFunction = (functionDef: FunctionDefinition.Any): Function.Function => {\n const fn = Function.make({\n key: functionDef.key,\n name: functionDef.name,\n version: '0.1.0',\n description: functionDef.description,\n inputSchema: Type.toJsonSchema(functionDef.inputSchema),\n outputSchema: !functionDef.outputSchema ? undefined : Type.toJsonSchema(functionDef.outputSchema),\n services: functionDef.services,\n });\n if (functionDef.meta?.deployedFunctionId) {\n Obj.change(fn, (fn) => setUserFunctionIdInMetadata(Obj.getMeta(fn), functionDef.meta!.deployedFunctionId!));\n }\n return fn;\n};\n\nexport const deserializeFunction = (functionObj: Function.Function): FunctionDefinition<unknown, unknown> => {\n return {\n [typeId]: true,\n // TODO(dmaretskyi): Fix key.\n key: functionObj.key ?? functionObj.name,\n name: functionObj.name,\n description: functionObj.description,\n inputSchema: !functionObj.inputSchema ? Schema.Unknown : Type.toEffectSchema(functionObj.inputSchema),\n outputSchema: !functionObj.outputSchema ? undefined : Type.toEffectSchema(functionObj.outputSchema),\n // TODO(dmaretskyi): This should throw error.\n handler: () => {},\n services: functionObj.services ?? [],\n types: [],\n meta: {\n deployedFunctionId: getUserFunctionIdInMetadata(Obj.getMeta(functionObj)),\n },\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, JsonSchema, Obj, Type } from '@dxos/echo';\nimport { SystemTypeAnnotation } from '@dxos/echo/internal';\n\nimport { Script } from './Script';\n\n/**\n * Function deployment.\n */\nexport const Function = Schema.Struct({\n /**\n * Global registry ID.\n * NOTE: The `key` property refers to the original registry entry.\n */\n // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.\n // TODO(dmaretskyi): Consider making it part of ECHO meta.\n // TODO(dmaretskyi): Make required.\n key: Schema.optional(Schema.String).annotations({\n description: 'Unique registration key for the blueprint',\n }),\n\n name: Schema.NonEmptyString,\n version: Schema.String,\n\n description: Schema.optional(Schema.String),\n\n /**\n * ISO date string of the last deployment.\n */\n updated: Schema.optional(Schema.String),\n\n // Reference to a source script if it exists within ECHO.\n // TODO(burdon): Don't ref ScriptType directly (core).\n source: Schema.optional(Type.Ref(Script)),\n\n inputSchema: Schema.optional(JsonSchema.JsonSchema),\n outputSchema: Schema.optional(JsonSchema.JsonSchema),\n\n /**\n * List of required services.\n * Match the Context.Tag keys of the FunctionServices variants.\n */\n services: Schema.optional(Schema.Array(Schema.String)),\n\n // Local binding to a function name.\n binding: Schema.optional(Schema.String),\n}).pipe(\n Type.object({\n typename: 'dxos.org/type/Function',\n version: '0.1.0',\n }),\n Annotation.LabelAnnotation.set(['name']),\n SystemTypeAnnotation.set(true),\n);\n\nexport interface Function extends Schema.Schema.Type<typeof Function> {}\n\nexport const make = (props: Obj.MakeProps<typeof Function>) => Obj.make(Function, props);\n\n/**\n * Copies properties from source to target.\n * @param target - Target object to copy properties to.\n * @param source - Source object to copy properties from.\n */\nexport const setFrom = (target: Function, source: Function) => {\n Obj.change(target, (t) => {\n t.key = source.key ?? target.key;\n t.name = source.name ?? target.name;\n t.version = source.version;\n t.description = source.description;\n t.updated = source.updated;\n // TODO(dmaretskyi): A workaround for an ECHO bug.\n t.inputSchema = source.inputSchema ? JSON.parse(JSON.stringify(source.inputSchema)) : undefined;\n t.outputSchema = source.outputSchema ? JSON.parse(JSON.stringify(source.outputSchema)) : undefined;\n Obj.getMeta(t).keys = JSON.parse(JSON.stringify(Obj.getMeta(source).keys));\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: Type.Ref(Text.Text).pipe(FormInputAnnotation.set(false)),\n}).pipe(\n Type.object({\n typename: 'dxos.org/type/Script',\n version: '0.1.0',\n }),\n Annotation.LabelAnnotation.set(['name']),\n);\n\nexport interface Script extends Schema.Schema.Type<typeof Script> {}\n\ntype Props = Omit<Obj.MakeProps<typeof Script>, 'source'> & { source?: string };\n\nexport const make = ({ source = '', ...props }: Props = {}): Script =>\n Obj.make(Script, { ...props, source: Ref.make(Text.make(source)) });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { Obj, QueryAST, Type } from '@dxos/echo';\nimport { OptionsAnnotationId, SystemTypeAnnotation } from '@dxos/echo/internal';\nimport { DXN } from '@dxos/keys';\nimport { Expando } from '@dxos/schema';\n\n/**\n * Type discriminator for TriggerType.\n * Every spec has a type field of type TriggerKind that we can use to understand which type we're working with.\n * https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions\n */\nexport 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\nexport const QueueSpec = Schema.Struct({\n kind: Schema.Literal('queue').annotations(kindLiteralAnnotations),\n\n // TODO(dmaretskyi): Change to a reference.\n queue: DXN.Schema,\n});\nexport type QueueSpec = Schema.Schema.Type<typeof QueueSpec>;\n\n/**\n * Subscription.\n */\nexport const SubscriptionSpec = Schema.Struct({\n kind: Schema.Literal('subscription').annotations(kindLiteralAnnotations),\n query: Schema.Struct({\n raw: Schema.optional(Schema.String.annotations({ title: 'Query' })),\n ast: QueryAST.Query,\n }),\n options: Schema.optional(\n Schema.Struct({\n // Watch changes to object (not just creation).\n deep: Schema.optional(Schema.Boolean.annotations({ title: 'Nested' })),\n // Debounce changes (delay in ms).\n delay: Schema.optional(Schema.Number.annotations({ title: 'Delay' })),\n }).annotations({ title: 'Options' }),\n ),\n});\nexport type SubscriptionSpec = Schema.Schema.Type<typeof SubscriptionSpec>;\n\n/**\n * Cron timer.\n */\nexport const TimerSpec = Schema.Struct({\n kind: Schema.Literal('timer').annotations(kindLiteralAnnotations),\n cron: Schema.String.annotations({\n title: 'Cron',\n [SchemaAST.ExamplesAnnotationId]: ['0 0 * * *'],\n }),\n});\nexport type TimerSpec = Schema.Schema.Type<typeof TimerSpec>;\n\n/**\n * Webhook.\n */\nexport const WebhookSpec = Schema.Struct({\n kind: Schema.Literal('webhook').annotations(kindLiteralAnnotations),\n method: Schema.optional(\n Schema.String.annotations({\n title: 'Method',\n [OptionsAnnotationId]: ['GET', 'POST'],\n }),\n ),\n port: Schema.optional(\n Schema.Number.annotations({\n title: 'Port',\n }),\n ),\n});\nexport type WebhookSpec = Schema.Schema.Type<typeof WebhookSpec>;\n\n/**\n * Trigger schema.\n */\nexport const Spec = Schema.Union(EmailSpec, QueueSpec, SubscriptionSpec, TimerSpec, WebhookSpec).annotations({\n title: 'Trigger',\n});\nexport type Spec = Schema.Schema.Type<typeof Spec>;\n\n/**\n * Function trigger.\n * Function is invoked with the `payload` passed as input data.\n * The event that triggers the function is available in the function context.\n */\nconst TriggerSchema = Schema.Struct({\n /**\n * Function or workflow to invoke.\n */\n // TODO(dmaretskyi): Can be a Ref(FunctionType) or Ref(ComputeGraphType).\n function: Schema.optional(Type.Ref(Expando.Expando).annotations({ title: 'Function' })),\n\n /**\n * Only used for workflowSchema.\n * Specifies the input node in the circuit.\n * @deprecated Remove and enforce a single input node in all compute graphSchema.\n */\n inputNodeId: Schema.optional(Schema.String.annotations({ title: 'Input Node ID' })),\n\n // 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 /**\n * Passed as the input data to the function.\n * Must match the function's input schema.\n *\n * @example\n * {\n * item: '{{$.trigger.event}}',\n * instructions: 'Summarize and perform entity-extraction'\n * mailbox: { '/': 'dxn:echo:AAA:ZZZ' }\n * }\n */\n input: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),\n}).pipe(\n Type.object({\n typename: 'dxos.org/type/Trigger',\n version: '0.1.0',\n }),\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, Type } 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: Type.Ref(Type.Obj),\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 = 'dxos.org/service/function';\n\nexport const FUNCTIONS_PRESET_META_KEY = 'dxos.org/service/function-preset';\n\n/**\n * NOTE: functionId is backend ID, not ECHO object id.\n */\nexport const getUserFunctionIdInMetadata = (meta: 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 Console from 'effect/Console';\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { defineFunction } from '../sdk';\n\nexport default defineFunction({\n key: 'example.org/function/reply',\n name: 'Reply',\n description: 'Function that echoes the input',\n inputSchema: Schema.Any,\n outputSchema: Schema.Any,\n handler: Effect.fn(function* ({ data }) {\n yield* Console.log('reply', { data });\n return data;\n }),\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { defineFunction } from '../sdk';\n\nexport default defineFunction({\n key: 'example.org/function/sleep',\n name: 'Sleep',\n description: 'Function that sleeps for a given amount of time',\n inputSchema: Schema.Struct({\n duration: Schema.optional(Schema.Number).annotations({\n description: 'Milliseconds to sleep',\n default: 100_000,\n }),\n }),\n outputSchema: Schema.Void,\n handler: Effect.fn(function* ({ data: { duration = 100_000 } }) {\n yield* Effect.sleep(duration);\n }),\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { default as fib$ } from './fib';\nimport { default as reply$ } from './reply';\nimport { default as sleep$ } from './sleep';\n\nexport namespace Example {\n export const fib = fib$;\n export const reply = reply$;\n export const sleep = sleep$;\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\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: 'dxos.org/type/ComputeEvent', version: '0.1.0' }));\n\n/**\n * Logs event for the compute workflows.\n */\nexport class ComputeEventLogger extends Context.Tag('@dxos/functions/ComputeEventLogger')<\n ComputeEventLogger,\n { readonly log: (event: ComputeEventPayload) => void; readonly nodeId: string | undefined }\n>() {\n static noop: Context.Tag.Service<ComputeEventLogger> = {\n log: () => {},\n nodeId: undefined,\n };\n\n /**\n * Implements ComputeEventLogger using TracingService.\n */\n static layerFromTracing = Layer.effect(\n ComputeEventLogger,\n Effect.gen(function* () {\n const tracing = yield* TracingService;\n return {\n log: (event: ComputeEventPayload) => {\n tracing.write(Obj.make(ComputeEvent, { payload: event }), 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 } from '@dxos/echo';\nimport { ObjectId } from '@dxos/keys';\nimport { Message } from '@dxos/types';\n\nimport type { Trigger } from '../types';\n\n/**\n * Provides a way for compute primitives (functions, workflows, tools)\n * to emit an execution trace as a series of structured ECHO objects.\n */\nexport class TracingService extends Context.Tag('@dxos/functions/TracingService')<\n TracingService,\n {\n /**\n * Gets the parent message ID.\n */\n getTraceContext: () => TracingService.TraceContext;\n\n /**\n * Write an event to the tracing queue.\n * @param event - The event to write. Must be an a typed object.\n */\n write: (event: Obj.Unknown, traceContext: TracingService.TraceContext) => void;\n\n traceInvocationStart({\n payload,\n target,\n }: {\n payload: TracingService.FunctionInvocationPayload;\n target?: DXN;\n }): Effect.Effect<TracingService.InvocationTraceData>;\n\n traceInvocationEnd({\n trace,\n exception,\n }: {\n trace: TracingService.InvocationTraceData;\n exception?: any;\n }): Effect.Effect<void>;\n }\n>() {\n static noop: Context.Tag.Service<TracingService> = {\n getTraceContext: () => ({}),\n write: () => {},\n traceInvocationStart: () =>\n Effect.sync(() => ({ invocationId: ObjectId.random(), invocationTraceQueue: undefined })),\n traceInvocationEnd: () => Effect.sync(() => {}),\n };\n\n static layerNoop: Layer.Layer<TracingService> = Layer.succeed(TracingService, TracingService.noop);\n\n /**\n * Creates a TracingService layer that emits events to the parent tracing service.\n */\n static layerSubframe = (mapContext: (currentContext: TracingService.TraceContext) => TracingService.TraceContext) =>\n Layer.effect(\n TracingService,\n Effect.gen(function* () {\n const tracing = yield* TracingService;\n const context = mapContext(tracing.getTraceContext());\n return {\n write: (event, context) => tracing.write(event, context),\n getTraceContext: () => context,\n traceInvocationStart: () => Effect.die('Tracing invocation inside another invocation is not supported.'),\n traceInvocationEnd: () => Effect.die('Tracing invocation inside another invocation is not supported.'),\n };\n }),\n );\n\n /**\n * Create sublayer to trace an invocation.\n * @param data\n * @returns\n */\n static layerInvocation = (data: TracingService.InvocationTraceData) =>\n TracingService.layerSubframe((context) => ({\n ...context,\n currentInvocation: data,\n }));\n\n /**\n * Emit the current human-readable execution status.\n */\n static emitStatus: (\n data: Omit<Obj.MakeProps<typeof AgentStatus>, 'created'>,\n ) => Effect.Effect<void, never, TracingService> = Effect.fnUntraced(function* (data) {\n const tracing = yield* TracingService;\n tracing.write(\n Obj.make(AgentStatus, {\n parentMessage: tracing.getTraceContext().parentMessage,\n toolCallId: tracing.getTraceContext().toolCallId,\n created: new Date().toISOString(),\n ...data,\n }),\n tracing.getTraceContext(),\n );\n });\n\n static emitConverationMessage: (\n data: Obj.MakeProps<typeof Message.Message>,\n ) => Effect.Effect<void, never, TracingService> = Effect.fnUntraced(function* (data) {\n const tracing = yield* TracingService;\n tracing.write(\n Obj.make(Message.Message, {\n parentMessage: tracing.getTraceContext().parentMessage,\n ...data,\n properties: {\n [MESSAGE_PROPERTY_TOOL_CALL_ID]: tracing.getTraceContext().toolCallId,\n ...data.properties,\n },\n }),\n tracing.getTraceContext(),\n );\n });\n}\n\nexport namespace TracingService {\n export interface TraceContext {\n currentInvocation?: InvocationTraceData;\n\n /**\n * If this thread sprung from a tool call, this is the ID of the message containing the tool call.\n */\n parentMessage?: ObjectId;\n\n /**\n * If the current thread is a byproduct of a tool call, this is the ID of the tool call.\n */\n toolCallId?: string;\n\n debugInfo?: unknown;\n }\n\n /**\n * Trace data for a function/trigger invocation.\n */\n export interface InvocationTraceData {\n invocationId: ObjectId;\n invocationTraceQueue?: DXN.String;\n }\n\n /**\n * Payload for a function/trigger invocation.\n */\n export interface FunctionInvocationPayload {\n data?: any;\n inputNodeId?: string;\n trigger?: {\n id: string;\n kind: Trigger.Kind;\n };\n }\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 FunctionDefinition, type InvocationServices } from '../sdk';\n\nexport class FunctionInvocationService extends Context.Tag('@dxos/functions/FunctionInvocationService')<\n FunctionInvocationService,\n {\n invokeFunction<I, O>(\n functionDef: FunctionDefinition<I, O, any>,\n input: I,\n ): Effect.Effect<O, never, InvocationServices>;\n\n resolveFunction(key: string): Effect.Effect<FunctionDefinition.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: FunctionDefinition<I, O, any>,\n input: I,\n ): Effect.Effect<O, never, FunctionInvocationService | InvocationServices> =>\n Effect.serviceFunctionEffect(FunctionInvocationService, (service) => service.invokeFunction)(functionDef, input);\n\n static resolveFunction = (\n key: string,\n ): Effect.Effect<FunctionDefinition.Any, FunctionNotFoundError, FunctionInvocationService> =>\n Effect.serviceFunctionEffect(FunctionInvocationService, (service) => service.resolveFunction)(key);\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nimport type { Entity } from '@dxos/echo';\nimport type { Queue, QueueAPI, QueueFactory } from '@dxos/echo-db';\nimport type { DXN, QueueSubspaceTag } from '@dxos/keys';\n\n/**\n * Gives access to all queues.\n */\nexport class QueueService extends Context.Tag('@dxos/functions/QueueService')<\n QueueService,\n {\n /**\n * API to access the queues.\n */\n readonly queues: QueueAPI;\n\n /**\n * The queue that is used to store the context of the current research.\n * @deprecated Use `ContextQueueService` instead.\n */\n readonly queue: Queue | undefined;\n }\n>() {\n static notAvailable = Layer.succeed(QueueService, {\n queues: {\n get(_dxn) {\n throw new Error('Queues not available');\n },\n create() {\n throw new Error('Queues not available');\n },\n },\n queue: undefined,\n });\n\n static make = (queues: QueueFactory, queue?: Queue): Context.Tag.Service<QueueService> => {\n return {\n queues,\n queue,\n };\n };\n\n static layer = (queues: QueueFactory, queue?: Queue): Layer.Layer<QueueService> =>\n Layer.succeed(QueueService, QueueService.make(queues, queue));\n\n /**\n * Gets a queue by its DXN.\n */\n static getQueue = <T extends Entity.Unknown = Entity.Unknown>(\n dxn: DXN,\n ): Effect.Effect<Queue<T>, never, QueueService> => QueueService.pipe(Effect.map(({ queues }) => queues.get<T>(dxn)));\n\n /**\n * Creates a new queue.\n */\n static createQueue = <T extends Entity.Unknown = Entity.Unknown>(options?: {\n subspaceTag?: QueueSubspaceTag;\n }): Effect.Effect<Queue<T>, never, QueueService> =>\n QueueService.pipe(Effect.map(({ queues }) => queues.create<T>(options)));\n\n static append = <T extends Entity.Unknown = Entity.Unknown>(queue: Queue<T>, objects: T[]): Effect.Effect<void> =>\n Effect.promise(() => queue.append(objects));\n}\n\n/**\n * Gives access to a specific queue passed as a context.\n */\nexport class ContextQueueService extends Context.Tag('@dxos/functions/ContextQueueService')<\n ContextQueueService,\n {\n readonly queue: Queue;\n }\n>() {\n static layer = (queue: Queue) => Layer.succeed(ContextQueueService, { queue });\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as 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, Ref, Type } from '@dxos/echo';\nimport { refFromEncodedReference } from '@dxos/echo/internal';\nimport { EchoClient, type EchoDatabaseImpl, type QueueFactory } 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 { FunctionDefinition, type FunctionServices } from '../sdk';\nimport { CredentialsService, FunctionInvocationService, QueueService, TracingService } from '../services';\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: FunctionDefinition): FunctionProtocol.Func => {\n if (!FunctionDefinition.isFunction(func)) {\n throw new TypeError('Invalid function definition');\n }\n\n return {\n meta: {\n key: func.key,\n name: func.name,\n description: func.description,\n inputSchema: Type.toJsonSchema(func.inputSchema),\n outputSchema: func.outputSchema === undefined ? undefined : Type.toJsonSchema(func.outputSchema),\n services: func.services,\n },\n handler: async ({ data, context }) => {\n if (\n (func.services.includes(Database.Service.key) || func.services.includes(QueueService.key)) &&\n (!context.services.dataService || !context.services.queryService)\n ) {\n throw new FunctionError({\n message: 'Services not provided: dataService, queryService',\n });\n }\n\n // eslint-disable-next-line no-useless-catch\n try {\n if (!SchemaAST.isAnyKeyword(func.inputSchema.ast)) {\n try {\n Schema.validateSync(func.inputSchema)(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.Entity.Any[]);\n }\n\n const dataWithDecodedRefs =\n funcContext.db && !SchemaAST.isAnyKeyword(func.inputSchema.ast)\n ? decodeRefsFromSchema(func.inputSchema.ast, data, funcContext.db)\n : data;\n\n let result = await func.handler({\n // TODO(dmaretskyi): Fix the types.\n context: context as any,\n data: dataWithDecodedRefs,\n });\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.outputSchema && !SchemaAST.isAnyKeyword(func.outputSchema.ast)) {\n Schema.validateSync(func.outputSchema)(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 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 credentials,\n functionInvocationService,\n aiLayer,\n tracing,\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.succeed(HttpClient.HttpClient, FunctionsAiHttpClient.make(service));\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAIA,SAASA,iBAAwC;AAE1C,IAAMC,2BAAN,cAAuCC,UAAUC,OAAO,uBAAuB,uBAAA,EAAA;EACpF,YAAYC,SAAiBC,SAA6C;AACxE,UAAM;MAAEC,SAAS;QAAEF;MAAQ;MAAG,GAAGC;IAAQ,CAAA;EAC3C;AACF;AAEO,IAAME,wBAAN,cAAoCL,UAAUC,OAAO,oBAAoB,oBAAA,EAAA;EAC9E,YAAYK,aAAqBH,SAA6C;AAC5E,UAAM;MAAEC,SAAS;QAAEG,UAAUD;MAAY;MAAG,GAAGH;IAAQ,CAAA;EACzD;AACF;AAEO,IAAMK,gBAAN,cAA4BR,UAAUC,OAAO,iBAAiB,2BAAA,EAAA;AAA8B;AAE5F,IAAMQ,4BAAN,cAAwCT,UAAUC,OAAO,wBAAwB,yBAAA,EAAA;AA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;AACd,aAAO7D,qBAAqB8D,QAAQyB,EAAC,GAAI1B,QAAOlE,EAAAA;IAClD;IAEA,KAAK,cAAc;AACjB,aAAOK,qBAAqB8D,QAAQ0B,MAAM3B,QAAOlE,EAAAA;IACnD;IAEA,SAAS;AACP,aAAOkE;IACT;EACF;AACF;",
|
|
6
|
+
"names": ["BaseError", "ServiceNotAvailableError", "BaseError", "extend", "service", "options", "context", "FunctionNotFoundError", "functionKey", "function", "FunctionError", "TriggerStateNotFoundError", "Effect", "Schema", "Effect", "Schema", "Obj", "Type", "assertArgument", "failedInvariant", "Operation", "make", "Schema", "Annotation", "JsonSchema", "Obj", "Type", "SystemTypeAnnotation", "Schema", "Annotation", "Obj", "Ref", "Type", "FormInputAnnotation", "Text", "Script", "Struct", "name", "String", "pipe", "optional", "description", "changed", "Boolean", "FormInputAnnotation", "set", "source", "Type", "Ref", "Text", "object", "typename", "version", "Annotation", "LabelAnnotation", "make", "props", "Obj", "Function", "Struct", "key", "optional", "String", "annotations", "description", "name", "NonEmptyString", "version", "updated", "source", "Type", "Ref", "Script", "inputSchema", "JsonSchema", "outputSchema", "services", "Array", "binding", "pipe", "object", "typename", "Annotation", "LabelAnnotation", "set", "SystemTypeAnnotation", "make", "props", "Obj", "setFrom", "target", "change", "t", "JSON", "parse", "stringify", "undefined", "getMeta", "keys", "make", "Schema", "SchemaAST", "Obj", "QueryAST", "Type", "OptionsAnnotationId", "SystemTypeAnnotation", "DXN", "Expando", "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", "Type", "Ref", "Expando", "inputNodeId", "enabled", "spec", "input", "Record", "key", "value", "Any", "pipe", "object", "typename", "version", "SystemTypeAnnotation", "set", "Trigger", "make", "props", "Obj", "Schema", "DXN", "Type", "EmailEvent", "Struct", "from", "String", "to", "subject", "created", "body", "QueueEvent", "queue", "DXN", "Schema", "item", "Any", "cursor", "SubscriptionEvent", "type", "Type", "Ref", "Obj", "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", "typeId", "Symbol", "for", "defineFunction", "key", "name", "description", "inputSchema", "outputSchema", "Any", "handler", "types", "services", "isSchema", "Error", "limit", "stackTraceLimit", "traceError", "cache", "captureStackTrace", "stack", "undefined", "split", "trim", "handlerWithSpan", "args", "result", "isEffect", "withSpan", "getServiceKeys", "map", "tag", "failedInvariant", "toOperation", "functionDef", "op", "Operation", "make", "schema", "input", "output", "meta", "operationHandler", "context", "data", "Promise", "tryPromise", "succeed", "FunctionDefinition", "isFunction", "value", "serialize", "assertArgument", "serializeFunction", "deserialize", "functionObj", "Obj", "instanceOf", "Function", "deserializeFunction", "fn", "version", "Type", "toJsonSchema", "deployedFunctionId", "change", "setUserFunctionIdInMetadata", "getMeta", "Unknown", "toEffectSchema", "getUserFunctionIdInMetadata", "defineFunction", "key", "name", "description", "inputSchema", "Struct", "iterations", "optional", "Number", "annotations", "default", "outputSchema", "result", "String", "handler", "fn", "data", "a", "b", "i", "toString", "Console", "Effect", "Schema", "defineFunction", "key", "name", "description", "inputSchema", "Any", "outputSchema", "handler", "fn", "data", "log", "Effect", "Schema", "defineFunction", "key", "name", "description", "inputSchema", "Struct", "duration", "optional", "Number", "annotations", "default", "outputSchema", "Void", "handler", "fn", "data", "sleep", "Example", "fib", "fib$", "reply", "reply$", "sleep", "sleep$", "HttpClient", "HttpClientRequest", "Context", "Effect", "Layer", "Redacted", "Query", "Database", "AccessToken", "CredentialsService", "Tag", "getCredential", "query", "gen", "credentials", "promise", "getApiKey", "credential", "apiKey", "Error", "service", "make", "configuredLayer", "succeed", "ConfiguredCredentialsService", "layerConfig", "effect", "serviceCredentials", "forEach", "value", "layerFromDatabase", "caching", "dbService", "Database", "Service", "cache", "Map", "queryCredentials", "cacheKey", "JSON", "stringify", "has", "get", "accessTokens", "db", "Query", "type", "AccessToken", "run", "filter", "accessToken", "source", "map", "token", "set", "length", "addCredentials", "push", "find", "withAuthorization", "kind", "mapRequest", "request", "authorization", "setHeader", "Context", "Effect", "Layer", "Schema", "Obj", "Type", "invariant", "LogLevel", "log", "Context", "Effect", "Layer", "AgentStatus", "Obj", "ObjectId", "Message", "TracingService", "Tag", "noop", "getTraceContext", "write", "traceInvocationStart", "sync", "invocationId", "ObjectId", "random", "invocationTraceQueue", "undefined", "traceInvocationEnd", "layerNoop", "succeed", "layerSubframe", "mapContext", "effect", "gen", "tracing", "context", "event", "die", "layerInvocation", "data", "currentInvocation", "emitStatus", "fnUntraced", "Obj", "make", "AgentStatus", "parentMessage", "toolCallId", "created", "Date", "toISOString", "emitConverationMessage", "Message", "properties", "MESSAGE_PROPERTY_TOOL_CALL_ID", "ComputeEventPayload", "Union", "Struct", "type", "Literal", "nodeId", "String", "inputs", "Array", "outputs", "property", "value", "Any", "event", "ComputeEvent", "payload", "pipe", "Type", "object", "typename", "version", "ComputeEventLogger", "Tag", "noop", "log", "undefined", "layerFromTracing", "effect", "gen", "tracing", "TracingService", "write", "Obj", "make", "getTraceContext", "logCustomEvent", "data", "logger", "Error", "createDefectLogger", "catchAll", "error", "createEventLogger", "level", "message", "logFunction", "LogLevel", "WARN", "warn", "VERBOSE", "verbose", "DEBUG", "debug", "INFO", "info", "ERROR", "invariant", "Context", "Effect", "Layer", "FunctionInvocationService", "Tag", "layerNotAvailable", "succeed", "invokeFunction", "die", "resolveFunction", "functionDef", "input", "serviceFunctionEffect", "service", "key", "Context", "Effect", "Layer", "QueueService", "Tag", "notAvailable", "succeed", "queues", "get", "_dxn", "Error", "create", "queue", "undefined", "make", "layer", "getQueue", "dxn", "pipe", "map", "createQueue", "options", "append", "objects", "promise", "ContextQueueService", "AnthropicClient", "Effect", "Layer", "Schema", "SchemaAST", "AiModelResolver", "AiService", "AnthropicResolver", "LifecycleState", "Resource", "Database", "Ref", "Type", "refFromEncodedReference", "EchoClient", "runAndForwardErrors", "assertState", "failedInvariant", "invariant", "PublicKey", "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", "FunctionDefinition", "isFunction", "TypeError", "meta", "key", "name", "description", "inputSchema", "Type", "toJsonSchema", "outputSchema", "undefined", "services", "handler", "data", "context", "includes", "Database", "Service", "QueueService", "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", "credentials", "CredentialsService", "layerFromDatabase", "caching", "configuredLayer", "functionInvocationService", "MockedFunctionInvocationService", "tracing", "TracingService", "layerNoop", "aiLayer", "functionsAiService", "AiModelResolver", "buildAiService", "AnthropicResolver", "make", "apiUrl", "FunctionsAiHttpClient", "AiService", "mergeAll", "succeed", "FunctionInvocationService", "invokeFunction", "die", "resolveFunction", "value", "encoded", "encodedBoundAST", "Ref", "isRefType", "isRef", "resolver", "createRefResolver", "space", "refFromEncodedReference", "_tag", "Array", "isArray", "prop", "getPropertySignatures", "toString", "type", "elements", "rest", "elementType", "map", "item", "nonUndefined", "filter", "t", "isUndefinedKeyword", "f", "from"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/errors.ts":{"bytes":3073,"imports":[{"path":"@dxos/errors","kind":"import-statement","external":true}],"format":"esm"},"src/types/Script.ts":{"bytes":4043,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"src/types/Function.ts":{"bytes":9044,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"src/types/Script.ts","kind":"import-statement","original":"./Script"}],"format":"esm"},"src/types/Trigger.ts":{"bytes":14668,"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},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"src/types/TriggerEvent.ts":{"bytes":5953,"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":1061,"imports":[{"path":"src/types/Function.ts","kind":"import-statement","original":"./Function"},{"path":"src/types/Script.ts","kind":"import-statement","original":"./Script"},{"path":"src/types/Trigger.ts","kind":"import-statement","original":"./Trigger"},{"path":"src/types/TriggerEvent.ts","kind":"import-statement","original":"./TriggerEvent"},{"path":"src/types/url.ts","kind":"import-statement","original":"./url"}],"format":"esm"},"src/sdk.ts":{"bytes":24340,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/example/fib.ts":{"bytes":3247,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"src/sdk.ts","kind":"import-statement","original":"../sdk"}],"format":"esm"},"src/example/reply.ts":{"bytes":2136,"imports":[{"path":"effect/Console","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"src/sdk.ts","kind":"import-statement","original":"../sdk"}],"format":"esm"},"src/example/sleep.ts":{"bytes":2579,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"src/sdk.ts","kind":"import-statement","original":"../sdk"}],"format":"esm"},"src/example/index.ts":{"bytes":1301,"imports":[{"path":"src/example/fib.ts","kind":"import-statement","original":"./fib"},{"path":"src/example/reply.ts","kind":"import-statement","original":"./reply"},{"path":"src/example/sleep.ts","kind":"import-statement","original":"./sleep"}],"format":"esm"},"src/services/credentials.ts":{"bytes":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":12776,"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":4010,"imports":[{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true}],"format":"esm"},"src/services/queues.ts":{"bytes":6416,"imports":[{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true}],"format":"esm"},"src/services/index.ts":{"bytes":1416,"imports":[{"path":"src/services/credentials.ts","kind":"import-statement","original":"./credentials"},{"path":"src/services/credentials.ts","kind":"import-statement","original":"./credentials"},{"path":"src/services/event-logger.ts","kind":"import-statement","original":"./event-logger"},{"path":"src/services/event-logger.ts","kind":"import-statement","original":"./event-logger"},{"path":"src/services/function-invocation-service.ts","kind":"import-statement","original":"./function-invocation-service"},{"path":"src/services/queues.ts","kind":"import-statement","original":"./queues"},{"path":"src/services/tracing.ts","kind":"import-statement","original":"./tracing"}],"format":"esm"},"src/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":35783,"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/sdk.ts","kind":"import-statement","original":"../sdk"},{"path":"src/services/index.ts","kind":"import-statement","original":"../services"},{"path":"src/protocol/functions-ai-http-client.ts","kind":"import-statement","original":"./functions-ai-http-client"}],"format":"esm"},"src/protocol/index.ts":{"bytes":459,"imports":[{"path":"src/protocol/protocol.ts","kind":"import-statement","original":"./protocol"}],"format":"esm"},"src/index.ts":{"bytes":867,"imports":[{"path":"src/errors.ts","kind":"import-statement","original":"./errors"},{"path":"src/example/index.ts","kind":"import-statement","original":"./example"},{"path":"src/sdk.ts","kind":"import-statement","original":"./sdk"},{"path":"src/services/index.ts","kind":"import-statement","original":"./services"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"},{"path":"src/protocol/index.ts","kind":"import-statement","original":"./protocol"}],"format":"esm"}},"outputs":{"dist/lib/neutral/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":85726},"dist/lib/neutral/index.mjs":{"imports":[{"path":"@dxos/errors","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"effect/Console","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClient","kind":"import-statement","external":true},{"path":"@effect/platform/HttpClientRequest","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Redacted","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"@dxos/ai","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/types","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"@effect/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":"@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","Example","FUNCTIONS_META_KEY","FUNCTIONS_PRESET_META_KEY","Function","FunctionDefinition","FunctionError","FunctionInvocationService","FunctionNotFoundError","MESSAGE_PROPERTY_TOOL_CALL_ID","QueueService","Script","ServiceNotAvailableError","TracingService","Trigger","TriggerEvent","TriggerStateNotFoundError","createDefectLogger","createEventLogger","defineFunction","deserializeFunction","getUserFunctionIdInMetadata","logCustomEvent","serializeFunction","setUserFunctionIdInMetadata","toOperation","withAuthorization","wrapFunctionHandler"],"entryPoint":"src/index.ts","inputs":{"src/errors.ts":{"bytesInOutput":736},"src/index.ts":{"bytesInOutput":0},"src/example/fib.ts":{"bytesInOutput":708},"src/sdk.ts":{"bytesInOutput":4205},"src/types/Function.ts":{"bytesInOutput":2264},"src/types/Script.ts":{"bytesInOutput":921},"src/types/index.ts":{"bytesInOutput":0},"src/types/Trigger.ts":{"bytesInOutput":3730},"src/types/TriggerEvent.ts":{"bytesInOutput":1351},"src/types/url.ts":{"bytesInOutput":576},"src/example/reply.ts":{"bytesInOutput":448},"src/example/sleep.ts":{"bytesInOutput":550},"src/example/index.ts":{"bytesInOutput":164},"src/services/credentials.ts":{"bytesInOutput":3572},"src/services/index.ts":{"bytesInOutput":0},"src/services/event-logger.ts":{"bytesInOutput":2964},"src/services/tracing.ts":{"bytesInOutput":2524},"src/services/function-invocation-service.ts":{"bytesInOutput":820},"src/services/queues.ts":{"bytesInOutput":1233},"src/protocol/protocol.ts":{"bytesInOutput":10298},"src/protocol/functions-ai-http-client.ts":{"bytesInOutput":2187}},"bytes":40880}}}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { BaseError, type BaseErrorOptions } from '@dxos/errors';
|
|
2
|
+
declare const ServiceNotAvailableError_base: {
|
|
3
|
+
new (options?: BaseErrorOptions): {
|
|
4
|
+
name: "ServiceNotAvailable";
|
|
5
|
+
context: Record<string, unknown>;
|
|
6
|
+
readonly message: string;
|
|
7
|
+
readonly _tag: "ServiceNotAvailable";
|
|
8
|
+
stack?: string;
|
|
9
|
+
cause?: unknown;
|
|
10
|
+
};
|
|
11
|
+
name: "ServiceNotAvailable";
|
|
12
|
+
is(error: unknown): error is BaseError;
|
|
13
|
+
wrap(options?: Omit<BaseErrorOptions, "cause"> & {
|
|
14
|
+
ifTypeDiffers?: boolean;
|
|
15
|
+
}): (error: unknown) => {
|
|
16
|
+
name: "ServiceNotAvailable";
|
|
17
|
+
context: Record<string, unknown>;
|
|
18
|
+
readonly message: string;
|
|
19
|
+
readonly _tag: "ServiceNotAvailable";
|
|
20
|
+
stack?: string;
|
|
21
|
+
cause?: unknown;
|
|
22
|
+
};
|
|
23
|
+
extend<Name extends string = string>(name: Name, message?: string): any;
|
|
24
|
+
isError(error: unknown): error is Error;
|
|
25
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
26
|
+
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
27
|
+
stackTraceLimit: number;
|
|
28
|
+
};
|
|
29
|
+
export declare class ServiceNotAvailableError extends ServiceNotAvailableError_base {
|
|
30
|
+
constructor(service: string, options?: Omit<BaseErrorOptions, 'context'>);
|
|
31
|
+
}
|
|
32
|
+
declare const FunctionNotFoundError_base: {
|
|
33
|
+
new (options?: BaseErrorOptions): {
|
|
34
|
+
name: "FunctionNotFound";
|
|
35
|
+
context: Record<string, unknown>;
|
|
36
|
+
readonly message: string;
|
|
37
|
+
readonly _tag: "FunctionNotFound";
|
|
38
|
+
stack?: string;
|
|
39
|
+
cause?: unknown;
|
|
40
|
+
};
|
|
41
|
+
name: "FunctionNotFound";
|
|
42
|
+
is(error: unknown): error is BaseError;
|
|
43
|
+
wrap(options?: Omit<BaseErrorOptions, "cause"> & {
|
|
44
|
+
ifTypeDiffers?: boolean;
|
|
45
|
+
}): (error: unknown) => {
|
|
46
|
+
name: "FunctionNotFound";
|
|
47
|
+
context: Record<string, unknown>;
|
|
48
|
+
readonly message: string;
|
|
49
|
+
readonly _tag: "FunctionNotFound";
|
|
50
|
+
stack?: string;
|
|
51
|
+
cause?: unknown;
|
|
52
|
+
};
|
|
53
|
+
extend<Name extends string = string>(name: Name, message?: string): any;
|
|
54
|
+
isError(error: unknown): error is Error;
|
|
55
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
56
|
+
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
57
|
+
stackTraceLimit: number;
|
|
58
|
+
};
|
|
59
|
+
export declare class FunctionNotFoundError extends FunctionNotFoundError_base {
|
|
60
|
+
constructor(functionKey: string, options?: Omit<BaseErrorOptions, 'context'>);
|
|
61
|
+
}
|
|
62
|
+
declare const FunctionError_base: {
|
|
63
|
+
new (options?: BaseErrorOptions): {
|
|
64
|
+
name: "FunctionError";
|
|
65
|
+
context: Record<string, unknown>;
|
|
66
|
+
readonly message: string;
|
|
67
|
+
readonly _tag: "FunctionError";
|
|
68
|
+
stack?: string;
|
|
69
|
+
cause?: unknown;
|
|
70
|
+
};
|
|
71
|
+
name: "FunctionError";
|
|
72
|
+
is(error: unknown): error is BaseError;
|
|
73
|
+
wrap(options?: Omit<BaseErrorOptions, "cause"> & {
|
|
74
|
+
ifTypeDiffers?: boolean;
|
|
75
|
+
}): (error: unknown) => {
|
|
76
|
+
name: "FunctionError";
|
|
77
|
+
context: Record<string, unknown>;
|
|
78
|
+
readonly message: string;
|
|
79
|
+
readonly _tag: "FunctionError";
|
|
80
|
+
stack?: string;
|
|
81
|
+
cause?: unknown;
|
|
82
|
+
};
|
|
83
|
+
extend<Name extends string = string>(name: Name, message?: string): any;
|
|
84
|
+
isError(error: unknown): error is Error;
|
|
85
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
86
|
+
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
87
|
+
stackTraceLimit: number;
|
|
88
|
+
};
|
|
89
|
+
export declare class FunctionError extends FunctionError_base {
|
|
90
|
+
}
|
|
91
|
+
declare const TriggerStateNotFoundError_base: {
|
|
92
|
+
new (options?: BaseErrorOptions): {
|
|
93
|
+
name: "TriggerStateNotFound";
|
|
94
|
+
context: Record<string, unknown>;
|
|
95
|
+
readonly message: string;
|
|
96
|
+
readonly _tag: "TriggerStateNotFound";
|
|
97
|
+
stack?: string;
|
|
98
|
+
cause?: unknown;
|
|
99
|
+
};
|
|
100
|
+
name: "TriggerStateNotFound";
|
|
101
|
+
is(error: unknown): error is BaseError;
|
|
102
|
+
wrap(options?: Omit<BaseErrorOptions, "cause"> & {
|
|
103
|
+
ifTypeDiffers?: boolean;
|
|
104
|
+
}): (error: unknown) => {
|
|
105
|
+
name: "TriggerStateNotFound";
|
|
106
|
+
context: Record<string, unknown>;
|
|
107
|
+
readonly message: string;
|
|
108
|
+
readonly _tag: "TriggerStateNotFound";
|
|
109
|
+
stack?: string;
|
|
110
|
+
cause?: unknown;
|
|
111
|
+
};
|
|
112
|
+
extend<Name extends string = string>(name: Name, message?: string): any;
|
|
113
|
+
isError(error: unknown): error is Error;
|
|
114
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
115
|
+
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
116
|
+
stackTraceLimit: number;
|
|
117
|
+
};
|
|
118
|
+
export declare class TriggerStateNotFoundError extends TriggerStateNotFoundError_base {
|
|
119
|
+
}
|
|
120
|
+
export {};
|
|
121
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;;;;;;;;;;;;;qBAiB4O,CAAC;;;;;;;;;;;;;;;AAf7S,qBAAa,wBAAyB,SAAQ,6BAAgE;gBAChG,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC;CAGzE;;;;;;;;;;;;;qBAW2S,CAAC;;;;;;;;;;;;;;;AAT7S,qBAAa,qBAAsB,SAAQ,0BAA0D;gBACvF,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC;CAG7E;;;;;;;;;;;;;qBAK2S,CAAC;;;;;;;;;;;;;;;AAH7S,qBAAa,aAAc,SAAQ,kBAA8D;CAAG;;;;;;;;;;;;;qBAGwM,CAAC;;;;;;;;;;;;;;;AAD7S,qBAAa,yBAA0B,SAAQ,8BAAmE;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fib.d.ts","sourceRoot":"","sources":["../../../../src/example/fib.ts"],"names":[],"mappings":";;;;;AASA,wBAsBG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forex-effect.d.ts","sourceRoot":"","sources":["../../../../src/example/forex-effect.ts"],"names":[],"mappings":";AAeA,wBAwBG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare namespace Example {
|
|
2
|
+
const fib: import("..").FunctionDefinition<{
|
|
3
|
+
readonly iterations?: number | undefined;
|
|
4
|
+
}, {
|
|
5
|
+
readonly result: string;
|
|
6
|
+
}, import("..").FunctionServices>;
|
|
7
|
+
const reply: import("..").FunctionDefinition<any, any, import("..").FunctionServices>;
|
|
8
|
+
const sleep: import("..").FunctionDefinition<{
|
|
9
|
+
readonly duration?: number | undefined;
|
|
10
|
+
}, void, import("..").FunctionServices>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/example/index.ts"],"names":[],"mappings":"AAQA,yBAAiB,OAAO,CAAC;IAChB,MAAM,GAAG;;;;qCAAO,CAAC;IACjB,MAAM,KAAK,0EAAS,CAAC;IACrB,MAAM,KAAK;;2CAAS,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../../../src/example/reply.ts"],"names":[],"mappings":";AAUA,wBAUG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../../../src/example/sleep.ts"],"names":[],"mappings":";;;AASA,wBAcG"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './types';
|
|
5
|
-
export * from './url';
|
|
1
|
+
export * from './errors';
|
|
2
|
+
export * from './example';
|
|
3
|
+
export * from './sdk';
|
|
6
4
|
export * from './services';
|
|
7
|
-
export * from './
|
|
5
|
+
export * from './types';
|
|
6
|
+
export * from './protocol';
|
|
8
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-compatibility.test.d.ts","sourceRoot":"","sources":["../../../src/operation-compatibility.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as HttpClient from '@effect/platform/HttpClient';
|
|
2
|
+
import * as Layer from 'effect/Layer';
|
|
3
|
+
import { type EdgeFunctionEnv } from '@dxos/protocols';
|
|
4
|
+
/**
|
|
5
|
+
* Copy pasted from https://github.com/Effect-TS/effect/blob/main/packages/platform/src/internal/fetchHttpClient.ts
|
|
6
|
+
*/
|
|
7
|
+
export declare const requestInitTagKey = "@effect/platform/FetchHttpClient/FetchOptions";
|
|
8
|
+
export declare class FunctionsAiHttpClient {
|
|
9
|
+
static make: (service: EdgeFunctionEnv.FunctionsAiService) => HttpClient.HttpClient;
|
|
10
|
+
static layer: (service: EdgeFunctionEnv.FunctionsAiService) => Layer.Layer<HttpClient.HttpClient, never, never>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=functions-ai-http-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions-ai-http-client.d.ts","sourceRoot":"","sources":["../../../../src/protocol/functions-ai-http-client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAK1D,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,OAAO,EAAE,KAAK,eAAe,EAAc,MAAM,iBAAiB,CAAC;AACnE;;GAEG;AACH,eAAO,MAAM,iBAAiB,kDAAkD,CAAC;AAEjF,qBAAa,qBAAqB;IAChC,MAAM,CAAC,IAAI,GAAI,SAAS,eAAe,CAAC,kBAAkB,2BAyCrD;IAEL,MAAM,CAAC,KAAK,GAAI,SAAS,eAAe,CAAC,kBAAkB,sDACiB;CAC7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/protocol/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type FunctionProtocol } from '@dxos/protocols';
|
|
2
|
+
import { FunctionDefinition } from '../sdk';
|
|
3
|
+
/**
|
|
4
|
+
* Wraps a function handler made with `defineFunction` to a protocol that the functions-runtime expects.
|
|
5
|
+
*/
|
|
6
|
+
export declare const wrapFunctionHandler: (func: FunctionDefinition) => FunctionProtocol.Func;
|
|
7
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../../src/protocol/protocol.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGxD,OAAO,EAAE,kBAAkB,EAAyB,MAAM,QAAQ,CAAC;AAKnE;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,kBAAkB,KAAG,gBAAgB,CAAC,IAwE/E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.test.d.ts","sourceRoot":"","sources":["../../../../src/protocol/protocol.test.ts"],"names":[],"mappings":""}
|