@dxos/compute 0.8.4-main.c85a9c8dae → 0.8.4-main.cb12b3f963

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/README.md +36 -1
  2. package/dist/lib/neutral/StorageService.mjs +22 -0
  3. package/dist/lib/neutral/StorageService.mjs.map +7 -0
  4. package/dist/lib/neutral/chunk-4N4JAXCP.mjs +17 -0
  5. package/dist/lib/neutral/chunk-4N4JAXCP.mjs.map +7 -0
  6. package/dist/lib/neutral/chunk-DDEBBRCI.mjs +62 -0
  7. package/dist/lib/neutral/chunk-DDEBBRCI.mjs.map +7 -0
  8. package/dist/lib/neutral/chunk-FEABF5XY.mjs +25 -0
  9. package/dist/lib/neutral/chunk-FEABF5XY.mjs.map +7 -0
  10. package/dist/lib/neutral/chunk-H6EHIVDN.mjs +21 -0
  11. package/dist/lib/neutral/chunk-H6EHIVDN.mjs.map +7 -0
  12. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  13. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  14. package/dist/lib/neutral/chunk-N462A6NO.mjs +138 -0
  15. package/dist/lib/neutral/chunk-N462A6NO.mjs.map +7 -0
  16. package/dist/lib/neutral/chunk-QPCDM7MF.mjs +179 -0
  17. package/dist/lib/neutral/chunk-QPCDM7MF.mjs.map +7 -0
  18. package/dist/lib/neutral/chunk-S24LL2D5.mjs +52 -0
  19. package/dist/lib/neutral/chunk-S24LL2D5.mjs.map +7 -0
  20. package/dist/lib/neutral/fib-HDHBZHPE.mjs +10 -0
  21. package/dist/lib/neutral/fib-HDHBZHPE.mjs.map +7 -0
  22. package/dist/lib/neutral/index.mjs +1030 -51
  23. package/dist/lib/neutral/index.mjs.map +4 -4
  24. package/dist/lib/neutral/meta.json +1 -1
  25. package/dist/lib/neutral/reply-XSQMXAPX.mjs +10 -0
  26. package/dist/lib/neutral/reply-XSQMXAPX.mjs.map +7 -0
  27. package/dist/lib/neutral/sleep-WHTJQ56P.mjs +10 -0
  28. package/dist/lib/neutral/sleep-WHTJQ56P.mjs.map +7 -0
  29. package/dist/lib/neutral/testing/index.mjs +27 -193
  30. package/dist/lib/neutral/testing/index.mjs.map +4 -4
  31. package/dist/types/src/Blueprint.d.ts +148 -0
  32. package/dist/types/src/Blueprint.d.ts.map +1 -0
  33. package/dist/types/src/Credential.d.ts +27 -0
  34. package/dist/types/src/Credential.d.ts.map +1 -0
  35. package/dist/types/src/Operation.d.ts +303 -0
  36. package/dist/types/src/Operation.d.ts.map +1 -0
  37. package/dist/types/src/OperationHandlerSet.d.ts +60 -0
  38. package/dist/types/src/OperationHandlerSet.d.ts.map +1 -0
  39. package/dist/types/src/OperationRegistry.d.ts +23 -0
  40. package/dist/types/src/OperationRegistry.d.ts.map +1 -0
  41. package/dist/types/src/Process.d.ts +247 -0
  42. package/dist/types/src/Process.d.ts.map +1 -0
  43. package/dist/types/src/Routine.d.ts +61 -0
  44. package/dist/types/src/Routine.d.ts.map +1 -0
  45. package/dist/types/src/Script.d.ts +22 -0
  46. package/dist/types/src/Script.d.ts.map +1 -0
  47. package/dist/types/src/ServiceResolver.d.ts +74 -0
  48. package/dist/types/src/ServiceResolver.d.ts.map +1 -0
  49. package/dist/types/src/StorageService.d.ts +58 -0
  50. package/dist/types/src/StorageService.d.ts.map +1 -0
  51. package/dist/types/src/Template.d.ts +56 -0
  52. package/dist/types/src/Template.d.ts.map +1 -0
  53. package/dist/types/src/Trace.d.ts +174 -0
  54. package/dist/types/src/Trace.d.ts.map +1 -0
  55. package/dist/types/src/Trigger.d.ts +150 -0
  56. package/dist/types/src/Trigger.d.ts.map +1 -0
  57. package/dist/types/src/TriggerEvent.d.ts +75 -0
  58. package/dist/types/src/TriggerEvent.d.ts.map +1 -0
  59. package/dist/types/src/errors.d.ts +239 -0
  60. package/dist/types/src/errors.d.ts.map +1 -0
  61. package/dist/types/src/index.d.ts +15 -5
  62. package/dist/types/src/index.d.ts.map +1 -1
  63. package/dist/types/src/testing/definitions.d.ts +11 -0
  64. package/dist/types/src/testing/definitions.d.ts.map +1 -0
  65. package/dist/types/src/testing/fib.d.ts +8 -0
  66. package/dist/types/src/testing/fib.d.ts.map +1 -0
  67. package/dist/types/src/testing/index.d.ts +6 -4
  68. package/dist/types/src/testing/index.d.ts.map +1 -1
  69. package/dist/types/src/testing/reply.d.ts +4 -0
  70. package/dist/types/src/testing/reply.d.ts.map +1 -0
  71. package/dist/types/src/testing/sleep.d.ts +6 -0
  72. package/dist/types/src/testing/sleep.d.ts.map +1 -0
  73. package/dist/types/src/umbrella.test.d.ts +2 -0
  74. package/dist/types/src/umbrella.test.d.ts.map +1 -0
  75. package/dist/types/tsconfig.tsbuildinfo +1 -1
  76. package/package.json +21 -34
  77. package/src/Blueprint.ts +221 -0
  78. package/src/Credential.ts +51 -0
  79. package/src/Operation.ts +513 -0
  80. package/src/OperationHandlerSet.ts +132 -0
  81. package/src/OperationRegistry.ts +48 -0
  82. package/src/Process.ts +490 -0
  83. package/src/Routine.ts +84 -0
  84. package/src/Script.ts +38 -0
  85. package/src/ServiceResolver.ts +174 -0
  86. package/src/StorageService.ts +99 -0
  87. package/src/Template.ts +105 -0
  88. package/src/Trace.ts +231 -0
  89. package/src/Trigger.ts +207 -0
  90. package/src/TriggerEvent.ts +62 -0
  91. package/src/errors.ts +50 -0
  92. package/src/index.ts +16 -6
  93. package/src/testing/definitions.ts +49 -0
  94. package/src/testing/fib.ts +22 -0
  95. package/src/testing/index.ts +13 -5
  96. package/src/testing/reply.ts +18 -0
  97. package/src/testing/sleep.ts +16 -0
  98. package/src/umbrella.test.ts +51 -0
  99. package/dist/lib/neutral/chunk-KGBGT4NT.mjs +0 -3106
  100. package/dist/lib/neutral/chunk-KGBGT4NT.mjs.map +0 -7
  101. package/dist/types/src/compute-graph-registry.d.ts +0 -37
  102. package/dist/types/src/compute-graph-registry.d.ts.map +0 -1
  103. package/dist/types/src/compute-graph-registry.test.d.ts +0 -2
  104. package/dist/types/src/compute-graph-registry.test.d.ts.map +0 -1
  105. package/dist/types/src/compute-graph.d.ts +0 -67
  106. package/dist/types/src/compute-graph.d.ts.map +0 -1
  107. package/dist/types/src/compute-graph.test.d.ts +0 -2
  108. package/dist/types/src/compute-graph.test.d.ts.map +0 -1
  109. package/dist/types/src/compute-node.d.ts +0 -24
  110. package/dist/types/src/compute-node.d.ts.map +0 -1
  111. package/dist/types/src/functions/async-function.d.ts +0 -68
  112. package/dist/types/src/functions/async-function.d.ts.map +0 -1
  113. package/dist/types/src/functions/edge-function.d.ts +0 -20
  114. package/dist/types/src/functions/edge-function.d.ts.map +0 -1
  115. package/dist/types/src/functions/function-defs.d.ts +0 -11
  116. package/dist/types/src/functions/function-defs.d.ts.map +0 -1
  117. package/dist/types/src/functions/index.d.ts +0 -4
  118. package/dist/types/src/functions/index.d.ts.map +0 -1
  119. package/dist/types/src/hyperformula.test.d.ts +0 -2
  120. package/dist/types/src/hyperformula.test.d.ts.map +0 -1
  121. package/dist/types/src/testing/test-builder.d.ts +0 -15
  122. package/dist/types/src/testing/test-builder.d.ts.map +0 -1
  123. package/dist/types/src/testing/test-plugin.d.ts +0 -35
  124. package/dist/types/src/testing/test-plugin.d.ts.map +0 -1
  125. package/dist/types/src/testing/test-runtime.d.ts +0 -10
  126. package/dist/types/src/testing/test-runtime.d.ts.map +0 -1
  127. package/dist/types/src/testing/util.d.ts +0 -2
  128. package/dist/types/src/testing/util.d.ts.map +0 -1
  129. package/dist/types/src/types/hyperformula.d.ts +0 -8
  130. package/dist/types/src/types/hyperformula.d.ts.map +0 -1
  131. package/dist/types/src/types/index.d.ts +0 -3
  132. package/dist/types/src/types/index.d.ts.map +0 -1
  133. package/dist/types/src/types/types.d.ts +0 -20
  134. package/dist/types/src/types/types.d.ts.map +0 -1
  135. package/dist/types/src/types/types.test.d.ts +0 -2
  136. package/dist/types/src/types/types.test.d.ts.map +0 -1
  137. package/dist/types/src/util.d.ts +0 -2
  138. package/dist/types/src/util.d.ts.map +0 -1
  139. package/src/compute-graph-registry.test.ts +0 -158
  140. package/src/compute-graph-registry.ts +0 -97
  141. package/src/compute-graph.test.ts +0 -107
  142. package/src/compute-graph.ts +0 -264
  143. package/src/compute-node.ts +0 -59
  144. package/src/functions/async-function.ts +0 -184
  145. package/src/functions/edge-function.ts +0 -113
  146. package/src/functions/function-defs.ts +0 -2427
  147. package/src/functions/index.ts +0 -7
  148. package/src/hyperformula.test.ts +0 -14
  149. package/src/testing/test-builder.ts +0 -60
  150. package/src/testing/test-plugin.ts +0 -98
  151. package/src/testing/test-runtime.ts +0 -35
  152. package/src/testing/util.ts +0 -9
  153. package/src/types/hyperformula.ts +0 -19
  154. package/src/types/index.ts +0 -6
  155. package/src/types/types.test.ts +0 -91
  156. package/src/types/types.ts +0 -80
  157. package/src/util.ts +0 -8
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../src/testing/test-builder.ts", "../../../../src/testing/test-runtime.ts", "../../../../src/testing/test-plugin.ts", "../../../../src/util.ts", "../../../../src/testing/util.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Client, type ClientOptions } from '@dxos/client';\nimport { type Context, Resource } from '@dxos/context';\nimport { invariant } from '@dxos/invariant';\n\nimport { type ComputeGraphOptions, ComputeGraphRegistry } from '../compute-graph-registry';\n\nimport { createMockedComputeRuntimeProvider } from './test-runtime';\n\nexport type TestBuilderOptions = ClientOptions & Partial<ComputeGraphOptions>;\n\n// TODO(burdon): Reconcile with @dxos/client/testing.\nexport class TestBuilder extends Resource {\n private _client?: Client;\n private _registry?: ComputeGraphRegistry;\n\n constructor(private readonly _options: TestBuilderOptions = {}) {\n super();\n }\n\n get ctx(): Context {\n return this._ctx;\n }\n\n get client(): Client {\n invariant(this._client);\n return this._client;\n }\n\n get registry(): ComputeGraphRegistry {\n invariant(this._registry);\n return this._registry;\n }\n\n override async _open(): Promise<void> {\n const client = new Client(this._options);\n await client.initialize();\n await client.halo.createIdentity();\n this._client = client;\n this._ctx.onDispose(async () => {\n await client.destroy();\n this._client = undefined;\n });\n\n const registry = new ComputeGraphRegistry({\n ...this._options,\n // Provide a default runtime provider for tests if not supplied.\n computeRuntime: this._options.computeRuntime ?? createMockedComputeRuntimeProvider(),\n });\n await registry.open();\n this._registry = registry;\n this._ctx.onDispose(async () => {\n await registry.close();\n this._registry = undefined;\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Layer from 'effect/Layer';\nimport * as ManagedRuntime from 'effect/ManagedRuntime';\n\nimport { AiService } from '@dxos/ai';\nimport { type SpaceId } from '@dxos/client/echo';\nimport { Database, Feed } from '@dxos/echo';\nimport { CredentialsService, type FunctionDefinition, QueueService } from '@dxos/functions';\nimport { FunctionInvocationServiceLayerTest } from '@dxos/functions-runtime/testing';\n\nimport { type FunctionsRuntimeProvider } from '../compute-graph-registry';\n\n/**\n * Minimal compute runtime provider for tests and Storybook.\n * Will cause errors if used for actual runtime.\n */\nexport const createMockedComputeRuntimeProvider = ({\n functions,\n}: { functions?: FunctionDefinition.Any[] } = {}): FunctionsRuntimeProvider => {\n return {\n getRuntime: (_spaceId: SpaceId) =>\n ManagedRuntime.make(\n FunctionInvocationServiceLayerTest({ functions }).pipe(\n Layer.provide(AiService.notAvailable),\n Layer.provide(CredentialsService.configuredLayer([])),\n Layer.provide(Database.notAvailable),\n Layer.provide(QueueService.notAvailable),\n Layer.provide(Feed.notAvailable),\n ),\n ),\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { getDeep } from '@dxos/util';\nimport { type InterpreterState, type ProcedureAst } from '@dxos/vendor-hyperformula';\nimport { FunctionArgumentType } from '@dxos/vendor-hyperformula';\n\nimport { type ComputeGraphPlugin } from '../compute-graph-registry';\nimport { type AsyncFunction, AsyncFunctionPlugin } from '../functions';\nimport { parseNumberString } from '../util';\n\n/**\n * Testing functions run locally (not run via EDGE).\n * https://hyperformula.handsontable.com/guide/custom-functions.html#add-a-simple-custom-function\n */\nexport class TestPlugin extends AsyncFunctionPlugin {\n /**\n * Simple local function returns input value.\n */\n test(ast: ProcedureAst, state: InterpreterState) {\n const handler: AsyncFunction = async (_value) => {\n return _value;\n };\n\n return this.runAsyncFunction(ast, state, handler);\n }\n\n /**\n * Simple local function returns random number.\n */\n random(ast: ProcedureAst, state: InterpreterState) {\n const handler: AsyncFunction = async () => {\n return Math.random();\n };\n\n return this.runAsyncFunction(ast, state, handler);\n }\n\n /**\n * Async HTTP function.\n */\n crypto(ast: ProcedureAst, state: InterpreterState) {\n const handler: AsyncFunction = async (_currency) => {\n const currency = (_currency || 'USD').toUpperCase();\n const result = await fetch(`https://api.coindesk.com/v1/bpi/currentprice/${currency}.json`);\n const data = await result.json();\n const rate = getDeep<string>(data, ['bpi', currency, 'rate']);\n if (!rate) {\n return NaN;\n }\n\n return parseNumberString(rate);\n };\n\n return this.runAsyncFunction(ast, state, handler, { ttl: 10_000 });\n }\n}\n\nTestPlugin.implementedFunctions = {\n TEST: {\n method: 'test',\n parameters: [{ argumentType: FunctionArgumentType.NUMBER, optionalArg: false }],\n isVolatile: true,\n },\n\n RANDOM: {\n method: 'random',\n parameters: [],\n isVolatile: true,\n },\n\n CRYPTO: {\n method: 'crypto',\n parameters: [{ argumentType: FunctionArgumentType.STRING, optionalArg: true }],\n isVolatile: true,\n },\n};\n\nexport const TestPluginTranslations = {\n enGB: {\n TEST: 'Returns input value',\n RANDOM: 'Random number',\n CRYPTO: 'Crypto token value',\n },\n enUS: {\n TEST: 'Returns input value',\n RANDOM: 'Random number',\n CRYPTO: 'Crypto token value',\n },\n};\n\nexport const testFunctionPlugins: ComputeGraphPlugin[] = [\n {\n plugin: TestPlugin,\n translations: TestPluginTranslations,\n },\n];\n", "//\n// Copyright 2024 DXOS.org\n//\n\n// TODO(burdon): Factor out.\nexport const parseNumberString = (str: string): number => {\n return parseFloat(str.replace(/[^\\d.]/g, ''));\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { HyperFormula } from '@dxos/vendor-hyperformula';\n\nexport const getRegisteredFunctionNames = () => {\n return HyperFormula.buildEmpty({ licenseKey: 'gpl-v3' }).getRegisteredFunctionNames();\n};\n"],
5
- "mappings": ";;;;;;AAIA,SAASA,cAAkC;AAC3C,SAAuBC,gBAAgB;AACvC,SAASC,iBAAiB;;;ACF1B,YAAYC,WAAW;AACvB,YAAYC,oBAAoB;AAEhC,SAASC,iBAAiB;AAE1B,SAASC,UAAUC,YAAY;AAC/B,SAASC,oBAA6CC,oBAAoB;AAC1E,SAASC,0CAA0C;AAQ5C,IAAMC,qCAAqC,CAAC,EACjDC,UAAS,IACmC,CAAC,MAAC;AAC9C,SAAO;IACLC,YAAY,CAACC,aACIC,oBACbC,mCAAmC;MAAEJ;IAAU,CAAA,EAAGK,KAC1CC,cAAQC,UAAUC,YAAY,GAC9BF,cAAQG,mBAAmBC,gBAAgB,CAAA,CAAE,CAAA,GAC7CJ,cAAQK,SAASH,YAAY,GAC7BF,cAAQM,aAAaJ,YAAY,GACjCF,cAAQO,KAAKL,YAAY,CAAA,CAAA;EAGvC;AACF;;;;ADnBO,IAAMM,cAAN,cAA0BC,SAAAA;;EACvBC;EACAC;EAER,YAA6BC,WAA+B,CAAC,GAAG;AAC9D,UAAK,GAAA,KADsBA,WAAAA;EAE7B;EAEA,IAAIC,MAAe;AACjB,WAAO,KAAKC;EACd;EAEA,IAAIC,SAAiB;AACnBC,cAAU,KAAKN,SAAO,QAAA;;;;;;;;;AACtB,WAAO,KAAKA;EACd;EAEA,IAAIO,WAAiC;AACnCD,cAAU,KAAKL,WAAS,QAAA;;;;;;;;;AACxB,WAAO,KAAKA;EACd;EAEA,MAAeO,QAAuB;AACpC,UAAMH,SAAS,IAAII,OAAO,KAAKP,QAAQ;AACvC,UAAMG,OAAOK,WAAU;AACvB,UAAML,OAAOM,KAAKC,eAAc;AAChC,SAAKZ,UAAUK;AACf,SAAKD,KAAKS,UAAU,YAAA;AAClB,YAAMR,OA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B,uBAAuB;EAChCC,MAAM;IACJC,QAAQ;IACRC,YAAY;MAAC;QAAEC,cAAcC,qBAAqBC;QAAQC,aAAa;MAAM;;IAC7EC,YAAY;EACd;EAEAC,QAAQ;IACNP,QAAQ;IACRC,YAAY,CAAA;IACZK,YAAY;EACd;EAEAE,QAAQ;IACNR,QAAQ;IACRC,YAAY;MAAC;QAAEC,cAAcC,qBAAqBM;QAAQJ,aAAa;MAAK;;IAC5EC,YAAY;EACd;AACF;AAEO,IAAMI,yBAAyB;EACpCC,MAAM;IACJZ,MAAM;IACNQ,QAAQ;IACRC,QAAQ;EACV;EACAI,MAAM;IACJb,MAAM;IACNQ,QAAQ;IACRC,QAAQ;EACV;AACF;AAEO,IAAMK,sBAA4C;EACvD;IACEC,QAAQvC;IACRwC,cAAcL;EAChB;;;;AE5FF,SAASM,oBAAoB;AAEtB,IAAMC,6BAA6B,MAAA;AACxC,SAAOC,aAAaC,WAAW;IAAEC,YAAY;EAAS,CAAA,EAAGH,2BAA0B;AACrF;",
6
- "names": ["Client", "Resource", "invariant", "Layer", "ManagedRuntime", "AiService", "Database", "Feed", "CredentialsService", "QueueService", "FunctionInvocationServiceLayerTest", "createMockedComputeRuntimeProvider", "functions", "getRuntime", "_spaceId", "make", "FunctionInvocationServiceLayerTest", "pipe", "provide", "AiService", "notAvailable", "CredentialsService", "configuredLayer", "Database", "QueueService", "Feed", "TestBuilder", "Resource", "_client", "_registry", "_options", "ctx", "_ctx", "client", "invariant", "registry", "_open", "Client", "initialize", "halo", "createIdentity", "onDispose", "destroy", "undefined", "ComputeGraphRegistry", "computeRuntime", "createMockedComputeRuntimeProvider", "open", "close", "getDeep", "FunctionArgumentType", "parseNumberString", "str", "parseFloat", "replace", "TestPlugin", "AsyncFunctionPlugin", "test", "ast", "state", "handler", "_value", "runAsyncFunction", "random", "Math", "crypto", "_currency", "currency", "toUpperCase", "result", "fetch", "data", "json", "rate", "getDeep", "NaN", "parseNumberString", "ttl", "implementedFunctions", "TEST", "method", "parameters", "argumentType", "FunctionArgumentType", "NUMBER", "optionalArg", "isVolatile", "RANDOM", "CRYPTO", "STRING", "TestPluginTranslations", "enGB", "enUS", "testFunctionPlugins", "plugin", "translations", "HyperFormula", "getRegisteredFunctionNames", "HyperFormula", "buildEmpty", "licenseKey"]
3
+ "sources": ["../../../../src/testing/index.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as OperationHandlerSet from '../OperationHandlerSet';\n\nexport { Fibonacci, Reply, Sleep } from './definitions';\nexport { default as FibonacciHandler } from './fib';\nexport { default as ReplyHandler } from './reply';\nexport { default as SleepHandler } from './sleep';\n\nexport const ExampleHandlers = OperationHandlerSet.lazy(\n () => import('./fib'),\n () => import('./reply'),\n () => import('./sleep'),\n);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAWO,IAAMA,kBAAsCC,KACjD,MAAM,OAAO,qBAAA,GACb,MAAM,OAAO,uBAAA,GACb,MAAM,OAAO,uBAAA,CAAA;",
6
+ "names": ["ExampleHandlers", "lazy"]
7
7
  }
@@ -0,0 +1,148 @@
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ import * as Schema from 'effect/Schema';
4
+ import { Database, Obj, Type } from '@dxos/echo';
5
+ import { BaseError } from '@dxos/errors';
6
+ import * as Operation from './Operation';
7
+ /**
8
+ * MCP server definition.
9
+ */
10
+ export declare const McpServer: Schema.Struct<{
11
+ /**
12
+ * URL of the MCP server.
13
+ */
14
+ url: Schema.SchemaClass<string, string, never>;
15
+ protocol: Schema.Union<[Schema.Literal<["sse"]>, Schema.Literal<["http"]>]>;
16
+ }>;
17
+ export interface McpServer extends Schema.Schema.Type<typeof McpServer> {
18
+ }
19
+ /**
20
+ * Blueprint schema defines the structure for AI assistant blueprints.
21
+ * Blueprints contain instructions, tools, and artifacts that guide the AI's behavior.
22
+ * Blueprints may use tools to create and read artifacts, which are managed by the assistant.
23
+ */
24
+ export declare const Blueprint: Type.Obj<{
25
+ readonly key: string;
26
+ readonly name: string;
27
+ readonly description?: string | undefined;
28
+ readonly instructions: {
29
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
30
+ readonly name?: string | undefined;
31
+ readonly content: string;
32
+ }>;
33
+ readonly inputs?: readonly {
34
+ readonly name: string;
35
+ readonly kind?: "context" | "function" | "pass-through" | "query" | "resolver" | "retriever" | "schema" | "value" | undefined;
36
+ readonly default?: any;
37
+ readonly function?: string | undefined;
38
+ }[] | undefined;
39
+ };
40
+ readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
41
+ readonly agentCanEnable?: boolean | undefined;
42
+ readonly mcpServers?: readonly {
43
+ readonly url: string;
44
+ readonly protocol: "http" | "sse";
45
+ }[] | undefined;
46
+ }, Schema.Struct.Fields>;
47
+ /**
48
+ * TypeScript type for Blueprint.
49
+ */
50
+ export interface Blueprint extends Schema.Schema.Type<typeof Blueprint> {
51
+ }
52
+ type MakeProps = Pick<Blueprint, 'key' | 'name'> & Partial<Blueprint>;
53
+ /**
54
+ * Create a new Blueprint.
55
+ */
56
+ export declare const make: ({ tools, instructions, ...props }: MakeProps) => Obj.OfShape<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
57
+ readonly key: string;
58
+ readonly name: string;
59
+ readonly description?: string | undefined;
60
+ readonly instructions: {
61
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
62
+ readonly name?: string | undefined;
63
+ readonly content: string;
64
+ }>;
65
+ readonly inputs?: readonly {
66
+ readonly name: string;
67
+ readonly kind?: "context" | "function" | "pass-through" | "query" | "resolver" | "retriever" | "schema" | "value" | undefined;
68
+ readonly default?: any;
69
+ readonly function?: string | undefined;
70
+ }[] | undefined;
71
+ };
72
+ readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
73
+ readonly agentCanEnable?: boolean | undefined;
74
+ readonly mcpServers?: readonly {
75
+ readonly url: string;
76
+ readonly protocol: "http" | "sse";
77
+ }[] | undefined;
78
+ }>;
79
+ /**
80
+ * Util to create tool definitions for a blueprint.
81
+ */
82
+ export declare const toolDefinitions: ({ tools, operations, }: {
83
+ tools?: string[];
84
+ operations?: Operation.Definition.Any[];
85
+ }) => (string & import("effect/Brand").Brand<"ToolId">)[];
86
+ /**
87
+ * Factory for the blueprints.
88
+ */
89
+ export type Definition = {
90
+ key: string;
91
+ make: () => Blueprint;
92
+ };
93
+ /**
94
+ * Blueprint registry.
95
+ */
96
+ export declare class Registry {
97
+ private readonly _blueprints;
98
+ constructor(blueprints: Blueprint[]);
99
+ get blueprints(): Blueprint[];
100
+ getByKey(key: string): Blueprint | undefined;
101
+ query(): Blueprint[];
102
+ updateBlueprints(): Effect.Effect<void, never, Database.Service>;
103
+ }
104
+ declare const RegistryService_base: Context.TagClass<RegistryService, "@dxos/blueprints/RegistryService", Registry>;
105
+ export declare class RegistryService extends RegistryService_base {
106
+ }
107
+ /**
108
+ * Resolves a blueprint from the registry.
109
+ * Does not check the local database for the blueprint.
110
+ */
111
+ export declare const resolve: (key: string) => Effect.Effect<Blueprint, NotFoundError, RegistryService>;
112
+ /**
113
+ * Upserts a blueprint into the database.
114
+ * If the blueprint already exists in the database, local blueprint is returned.
115
+ * Otherwise, it will be added.
116
+ */
117
+ export declare const upsert: (key: string) => Effect.Effect<Blueprint, NotFoundError, RegistryService | Database.Service>;
118
+ declare const NotFoundError_base: {
119
+ new (options?: import("@dxos/errors").BaseErrorOptions): {
120
+ cause?: unknown;
121
+ stack?: string;
122
+ name: "BlueprintNotFound";
123
+ context: Record<string, unknown>;
124
+ readonly message: string;
125
+ readonly _tag: "BlueprintNotFound";
126
+ };
127
+ isError(error: unknown): error is Error;
128
+ name: "BlueprintNotFound";
129
+ is(error: unknown): error is BaseError;
130
+ wrap(options?: Omit<import("@dxos/errors").BaseErrorOptions, 'cause'> & {
131
+ ifTypeDiffers?: boolean;
132
+ }): (error: unknown) => {
133
+ cause?: unknown;
134
+ stack?: string;
135
+ name: "BlueprintNotFound";
136
+ context: Record<string, unknown>;
137
+ readonly message: string;
138
+ readonly _tag: "BlueprintNotFound";
139
+ };
140
+ extend<Name extends string = string>(name: Name, message?: string): any;
141
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
142
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
143
+ stackTraceLimit: number;
144
+ };
145
+ export declare class NotFoundError extends NotFoundError_base {
146
+ }
147
+ export {};
148
+ //# sourceMappingURL=Blueprint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Blueprint.d.ts","sourceRoot":"","sources":["../../../src/Blueprint.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAc,QAAQ,EAAU,GAAG,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAGzC;;GAEG;AACH,eAAO,MAAM,SAAS;IACpB;;OAEG;;;EAQH,CAAC;AACH,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC;CAAG;AAE1E;;;;GAIG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;wBA6DrB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC;CAAG;AAE1E,KAAK,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC,GAAG,OAAO,CAAC,SAA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 import * as Redacted from 'effect/Redacted';
4
+ export type CredentialQuery = {
5
+ service?: string;
6
+ };
7
+ export type ServiceCredential = {
8
+ service: string;
9
+ apiKey?: string;
10
+ };
11
+ declare const CredentialsService_base: Context.TagClass<CredentialsService, "@dxos/functions/CredentialsService", {
12
+ /**
13
+ * Query all.
14
+ */
15
+ queryCredentials: (query: CredentialQuery) => Promise<ServiceCredential[]>;
16
+ /**
17
+ * Get a single credential.
18
+ * @throws {Error} If no credential is found.
19
+ */
20
+ getCredential: (query: CredentialQuery) => Promise<ServiceCredential>;
21
+ }>;
22
+ export declare class CredentialsService extends CredentialsService_base {
23
+ static getCredential: (query: CredentialQuery) => Effect.Effect<ServiceCredential, never, CredentialsService>;
24
+ static getApiKey: (query: CredentialQuery) => Effect.Effect<Redacted.Redacted<string>, never, CredentialsService>;
25
+ }
26
+ export {};
27
+ //# sourceMappingURL=Credential.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Credential.d.ts","sourceRoot":"","sources":["../../../src/Credential.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAIF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAGhB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;;IAKE;;OAEG;sBACe,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAE1E;;;OAGG;mBACY,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,iBAAiB,CAAC;;AAZzE,qBAAa,kBAAmB,SAAQ,uBAcrC;IACD,MAAM,CAAC,aAAa,UAAW,eAAe,KAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAIvG;IAEL,MAAM,CAAC,SAAS,UAAW,eAAe,KAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAO3G;CACN"}
@@ -0,0 +1,303 @@
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ import * as Layer from 'effect/Layer';
4
+ import * as Pipeable from 'effect/Pipeable';
5
+ import * as Schema$ from 'effect/Schema';
6
+ import type * as Types from 'effect/Types';
7
+ import { Obj, Type, type DXN, type Key } from '@dxos/echo';
8
+ import type { NoHandlerError } from './errors';
9
+ import type { Operation } from './index';
10
+ /**
11
+ * Schema type that accepts any Encoded form but requires no Context.
12
+ * This allows ECHO object schemas where Type !== Encoded due to [KindId] symbol.
13
+ */
14
+ type Schema<T> = Schema$.Schema<T, any, never>;
15
+ export declare const DefinitionTypeId: '~@dxos/operation/OperationDefinition';
16
+ export type DefinitionTypeId = typeof DefinitionTypeId;
17
+ /**
18
+ * Serializable definition of an Operation.
19
+ * Contains schema and metadata, but no runtime logic.
20
+ */
21
+ export interface Definition<I, O, S = any> extends Pipeable.Pipeable, Definition.Variance<I, O, S> {
22
+ /**
23
+ * Input schema for the operation.
24
+ */
25
+ readonly input: Schema<I>;
26
+ /**
27
+ * Output schema for the operation.
28
+ */
29
+ readonly output: Schema<O>;
30
+ readonly meta: {
31
+ readonly key: string;
32
+ readonly name?: string;
33
+ readonly version?: string;
34
+ readonly description?: string;
35
+ /**
36
+ * Deployment ID for remote invocation.
37
+ * Assigned by the EDGE function service when deployed.
38
+ */
39
+ readonly deployedId?: string;
40
+ };
41
+ /**
42
+ * Execution mode for the operation.
43
+ * - 'sync': Operation completes synchronously (fast, UI-blocking acceptable).
44
+ * - 'async': Operation may take time (should not block UI).
45
+ */
46
+ readonly executionMode: 'sync' | 'async';
47
+ /**
48
+ * ECHO types the operation uses.
49
+ * Ensures types are available when the operation is executed remotely.
50
+ */
51
+ readonly types: readonly Type.AnyEntity[];
52
+ /**
53
+ * Effect services required by this operation.
54
+ * These services will be automatically provided to the handler at invocation time.
55
+ */
56
+ readonly services: readonly Context.Tag<any, any>[];
57
+ }
58
+ /**
59
+ * Namespace for OperationDefinition helper types.
60
+ */
61
+ export declare namespace Definition {
62
+ interface Variance<I, O, S> {
63
+ [DefinitionTypeId]: {
64
+ readonly _Input: Types.Contravariant<I>;
65
+ readonly _Output: Types.Covariant<O>;
66
+ readonly _Services: Types.Covariant<S>;
67
+ };
68
+ }
69
+ /**
70
+ * Any operation definition, regardless of input/output types.
71
+ */
72
+ type Any = Definition<any, any, any>;
73
+ /**
74
+ * Extract the input type from an operation definition.
75
+ */
76
+ type Input<T extends Any> = T extends Variance<infer I, infer _O, infer _S> ? I : never;
77
+ /**
78
+ * Extract the output type from an operation definition.
79
+ */
80
+ type Output<T extends Any> = T extends Variance<infer _I, infer O, infer _S> ? O : never;
81
+ /**
82
+ * Extract the service identifier types from an operation's services array.
83
+ * Returns `never` if the operation has no services declared.
84
+ */
85
+ type Services<T extends Any> = T extends Variance<infer _I, infer _O, infer S> ? S : never;
86
+ type HandlerType<T extends Any> = T extends Variance<infer I, infer O, infer S> ? Handler<I, O, any, S> : never;
87
+ }
88
+ /**
89
+ * Runtime handler for an Operation.
90
+ */
91
+ export type Handler<I, O, E = Error, R = never> = (input: I) => Effect.Effect<O, E, R>;
92
+ export type WithHandler<T extends Definition.Any> = T & {
93
+ handler: Definition.HandlerType<T>;
94
+ };
95
+ /**
96
+ * Checks if a value is an operation definition.
97
+ */
98
+ export declare const isOperationDefinition: (value: unknown) => value is Definition.Any;
99
+ /**
100
+ * Checks if a value is an operation with a handler.
101
+ */
102
+ export declare const isOperationWithHandler: (value: unknown) => value is WithHandler<Definition.Any>;
103
+ /**a
104
+ * Props for creating an Operation definition.
105
+ * Derived from OperationDefinition with executionMode made optional (defaults to 'async').
106
+ */
107
+ export type Props<I, O> = Omit<Definition<I, O>, DefinitionTypeId | 'pipe' | 'executionMode' | 'types' | 'services'> & {
108
+ readonly executionMode?: 'sync' | 'async';
109
+ readonly types?: Definition<I, O>['types'];
110
+ readonly services?: Definition<I, O>['services'];
111
+ };
112
+ /**
113
+ * Creates a new Operation definition.
114
+ * Applies default executionMode of 'async' if not specified.
115
+ * The returned type preserves the literal types of props (including services).
116
+ */
117
+ export declare const make: <const P extends Types.NoExcessProperties<Props<any, any>, P>>(props: P) => Definition<Schema$.Schema.Type<P['input']>, Schema$.Schema.Type<P['output']>, Context.Tag.Identifier<NonNullable<P['services']>[number]>>;
118
+ /**
119
+ * Attaches a handler to an Operation definition.
120
+ * The handler may use any services declared in the operation, plus Operation.Service (always available).
121
+ * Dual API: can be called directly or used in a pipe.
122
+ *
123
+ * @example
124
+ * ```ts
125
+ * const MyOp = Operation.make({
126
+ * input: Schema.Void,
127
+ * output: Schema.Void,
128
+ * meta: { key: 'my-op' },
129
+ * services: [DatabaseService],
130
+ * });
131
+ *
132
+ * // Direct call - handler can use DatabaseService
133
+ * const op = Operation.withHandler(MyOp, (input) =>
134
+ * Effect.gen(function* () {
135
+ * const db = yield* DatabaseService;
136
+ * return {};
137
+ * }),
138
+ * );
139
+ *
140
+ * // Piped call
141
+ * const op = MyOp.pipe(Operation.withHandler((input) => Effect.succeed({})));
142
+ * ```
143
+ */
144
+ export declare const withHandler: {
145
+ <Def extends Definition<any, any>, E = never>(handler: Handler<Definition.Input<Def>, Definition.Output<Def>, E, Definition.Services<Def> | Service>): (op: Def) => WithHandler<Def>;
146
+ <Def extends Definition<any, any>, E = never>(op: Def, handler: Handler<Definition.Input<Def>, Definition.Output<Def>, E, Definition.Services<Def> | Service>): WithHandler<Def>;
147
+ };
148
+ /**
149
+ * Helper to make the handler type opaque.
150
+ * Workaround for TypeScript's inability to infer the handler type from the operation definition:
151
+ * ```
152
+ * error TS2742: The inferred type of 'default' cannot be named without a reference.
153
+ * ```
154
+ *
155
+ * Most of the time the exact handler type is not needed.
156
+ *
157
+ * @example
158
+ * ```ts
159
+ * const MyOp = Operation.make({
160
+ * input: Schema.Void,
161
+ * output: Schema.Void,
162
+ * meta: { key: 'my-op' },
163
+ * services: [DatabaseService],
164
+ * });
165
+ *
166
+ * export default MyOp.pipe(
167
+ * Operation.withHandler(
168
+ * Effect.fn(function* (input) {
169
+ * return { result: 'ok' };
170
+ * }),
171
+ * ),
172
+ * Operation.opaqueHandler,
173
+ * );
174
+ * ```
175
+ */
176
+ export declare const opaqueHandler: <T extends Operation.Definition.Any>(handler: Operation.WithHandler<T>) => Operation.WithHandler<Operation.Definition.Any>;
177
+ /**
178
+ * Local invocation of an operation.
179
+ */
180
+ export type Invoke = <I, O, E>(op: Definition<I, O>, input: I) => Effect.Effect<O, E>;
181
+ /**
182
+ * Remote invocation of an operation.
183
+ */
184
+ export type InvokeRemote = <I, O, E>(op: Definition<I, O>, input: I, options?: {
185
+ timeout?: number;
186
+ }) => Effect.Effect<O, E>;
187
+ /**
188
+ * Database record of an operation.
189
+ */
190
+ export declare const PersistentOperation: Type.Obj<{
191
+ readonly key?: string | undefined;
192
+ readonly name: string;
193
+ readonly version: string;
194
+ readonly description?: string | undefined;
195
+ readonly updated?: string | undefined;
196
+ readonly source?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown> | undefined;
197
+ readonly inputSchema?: import("@dxos/echo/internal").JsonSchemaType | undefined;
198
+ readonly outputSchema?: import("@dxos/echo/internal").JsonSchemaType | undefined;
199
+ readonly services?: readonly string[] | undefined;
200
+ readonly binding?: string | undefined;
201
+ }, Schema$.Struct.Fields>;
202
+ export interface PersistentOperation extends Schema$.Schema.Type<typeof PersistentOperation> {
203
+ }
204
+ /**
205
+ * Serialize an operation definition to a persistent operation record.
206
+ */
207
+ export declare const serialize: (operation: Definition.Any) => PersistentOperation;
208
+ /**
209
+ * Deserialize a persistent operation record to an operation definition.
210
+ */
211
+ export declare const deserialize: (record: PersistentOperation) => Definition.Any;
212
+ /**
213
+ * Update properties on the target operation record from the source operation record.
214
+ */
215
+ export declare const setFrom: (target: PersistentOperation, source: PersistentOperation) => void;
216
+ /**
217
+ * Options for operation invocation.
218
+ */
219
+ export interface InvokeOptions {
220
+ /**
221
+ * Space ID to provide database context for the handler.
222
+ */
223
+ spaceId?: Key.SpaceId;
224
+ /**
225
+ * DXN string of the conversation feed (queue).
226
+ * Passed to the process environment so nested operations can resolve AiContextService and related services.
227
+ */
228
+ conversation?: DXN.String;
229
+ /**
230
+ * Optional process-runtime tracing metadata (consumed by `@dxos/functions-runtime` when wired).
231
+ */
232
+ tracing?: unknown;
233
+ }
234
+ /**
235
+ * Operation service interface - provides unified access to operation invocation and scheduling.
236
+ * This service is automatically provided to operation handlers.
237
+ */
238
+ export interface OperationService {
239
+ /**
240
+ * Invoke an operation as an Effect.
241
+ * Returns an Effect that resolves to the operation output.
242
+ */
243
+ invoke: <I, O>(op: Operation.Definition<I, O>, ...args: void extends I ? [input?: I, options?: InvokeOptions] : [input: I, options?: InvokeOptions]) => Effect.Effect<O, NoHandlerError>;
244
+ /**
245
+ * Schedule an operation to run as a followup.
246
+ * The followup is tracked and won't be cancelled when the parent operation completes.
247
+ * Returns an Effect that completes immediately after scheduling.
248
+ */
249
+ schedule: <I, O>(op: Operation.Definition<I, O>, ...args: void extends I ? [input?: I] : [input: I]) => Effect.Effect<void>;
250
+ /**
251
+ * Invoke an operation and return a Promise.
252
+ * Useful for async contexts where Effect is not available.
253
+ */
254
+ invokePromise: <I, O>(op: Operation.Definition<I, O>, ...args: void extends I ? [input?: I, options?: InvokeOptions] : [input: I, options?: InvokeOptions]) => Promise<{
255
+ data?: O;
256
+ error?: Error;
257
+ }>;
258
+ }
259
+ declare const Service_base: Context.TagClass<Service, "@dxos/operation/Service", OperationService>;
260
+ /**
261
+ * Context tag for the Operation service.
262
+ * Operation handlers can yield this to invoke other operations or schedule followups.
263
+ *
264
+ * @example
265
+ * ```ts
266
+ * const handler = (input) => Effect.gen(function* () {
267
+ * // Schedule a followup (fire and forget)
268
+ * yield* Operation.schedule(AnalyticsOperation, { event: 'completed' });
269
+ *
270
+ * // Invoke another operation
271
+ * return yield* Operation.invoke(OtherOperation, { data: input.data });
272
+ * });
273
+ * ```
274
+ */
275
+ export declare class Service extends Service_base {
276
+ }
277
+ /**
278
+ * Invoke an operation as an Effect.
279
+ * Yields the Operation.Service internally.
280
+ *
281
+ * @example
282
+ * ```ts
283
+ * yield* Operation.invoke(MyOperation, { data: 'test' });
284
+ * ```
285
+ */
286
+ export declare const invoke: <I, O>(op: Operation.Definition<I, O>, ...args: void extends I ? [input?: I, options?: InvokeOptions] : [input: I, options?: InvokeOptions]) => Effect.Effect<O, NoHandlerError, Service>;
287
+ /**
288
+ * Schedule an operation to run as a followup.
289
+ * Yields the Operation.Service internally.
290
+ *
291
+ * @example
292
+ * ```ts
293
+ * yield* Operation.schedule(AnalyticsOperation, { event: 'completed' });
294
+ * yield* Operation.schedule(VoidOperation); // input optional when void
295
+ * ```
296
+ */
297
+ export declare const schedule: <I, O>(op: Operation.Definition<I, O>, ...args: void extends I ? [input?: I] : [input: I]) => Effect.Effect<void, never, Service>;
298
+ /**
299
+ * Provides additional invocation options to all invocations.
300
+ */
301
+ export declare const withInvocationOptions: (options: InvokeOptions) => Layer.Layer<Service, never, Service>;
302
+ export {};
303
+ //# sourceMappingURL=Operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Operation.d.ts","sourceRoot":"","sources":["../../../src/Operation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,KAAK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CAAC,EAAE,CAAC,CAAC,WACrB,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,KACnG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,CAGxC,CAAC;AAEJ;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,CAAC,MACvB,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,WACrB,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,KACjD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CACyE,CAAC;AAE/G;;GAEG;AACH,eAAO,MAAM,qBAAqB,YAAa,aAAa,KAAG,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAa/F,CAAC"}
@@ -0,0 +1,60 @@
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ import * as Layer from 'effect/Layer';
4
+ import { NoHandlerError } from './errors';
5
+ import type * as Operation from './Operation';
6
+ export declare const TypeId: '~@dxos/operation/OperationHandlerSet';
7
+ export type TypeId = typeof TypeId;
8
+ export interface OperationHandlerSet {
9
+ [TypeId]: TypeId;
10
+ readonly handlers: Effect.Effect<Operation.WithHandler<Operation.Definition.Any>[]>;
11
+ getHandlers(): Promise<Operation.WithHandler<Operation.Definition.Any>[]>;
12
+ }
13
+ export declare const isOperationHandlerSet: (value: unknown) => value is OperationHandlerSet;
14
+ export declare const empty: OperationHandlerSet;
15
+ /**
16
+ * Creates a new operation handler set from a list of handlers.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const set = OperationHandlerSet.make(
21
+ * Operation.withHandler(Operation.make({ input: Schema.Void, output: Schema.Void }), (input) => Effect.succeed({})),
22
+ * Operation.withHandler(Operation.make({ input: Schema.Void, output: Schema.Void }), (input) => Effect.succeed({})),
23
+ * );
24
+ * ```
25
+ */
26
+ export declare const make: (...handlers: Operation.WithHandler<Operation.Definition.Any>[]) => OperationHandlerSet;
27
+ export declare const async: (getHandlers: () => Promise<Operation.WithHandler<Operation.Definition.Any>[]>) => OperationHandlerSet;
28
+ /**
29
+ * Merges multiple operation handler sets into a single set.
30
+ *
31
+ */
32
+ export declare const merge: (...sets: OperationHandlerSet[]) => OperationHandlerSet;
33
+ /**
34
+ * Creates a new operation handler set from a list of lazy-loaded modules.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const set = OperationHandlerSet.lazy(
39
+ * () => import('./my-handler'),
40
+ * () => import('./my-other-handler'),
41
+ * );
42
+ * ```
43
+ */
44
+ export declare const lazy: (...modules: (() => Promise<{
45
+ default: Operation.WithHandler<Operation.Definition.Any>;
46
+ }>)[]) => OperationHandlerSet;
47
+ /**
48
+ * Gets a handler for an operation by definition.
49
+ */
50
+ export declare const getHandler: <const Op extends Operation.Definition.Any>(set: OperationHandlerSet, definition: Op) => Effect.Effect<Operation.WithHandler<Op>, NoHandlerError>;
51
+ /**
52
+ * Gets a handler for an operation by key.
53
+ */
54
+ export declare const getHandlerByKey: (set: OperationHandlerSet, key: string) => Effect.Effect<Operation.WithHandler<Operation.Definition.Any>, NoHandlerError>;
55
+ declare const OperationHandlerProvider_base: Context.TagClass<OperationHandlerProvider, "@dxos/operation/OperationHandlerProvider", OperationHandlerSet>;
56
+ export declare class OperationHandlerProvider extends OperationHandlerProvider_base {
57
+ }
58
+ export declare const provide: (handlers: OperationHandlerSet) => Layer.Layer<OperationHandlerProvider, never, never>;
59
+ export {};
60
+ //# sourceMappingURL=OperationHandlerSet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OperationHandlerSet.d.ts","sourceRoot":"","sources":["../../../src/OperationHandlerSet.ts"],"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WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;CAAE,CAAC,CAAC,EAAE,KAC1F,mBAEF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,CAAC,EAAE,SAAS,SAAS,CAAC,UAAU,CAAC,GAAG,OAC7D,mBAAmB,cACZ,EAAE,KACb,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,cAAc,CAQtD,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,eAAe,QACrB,mBAAmB,OACnB,MAAM,KACV,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,cAAc,CAQ5E,CAAC;;AAEL,qBAAa,wBAAyB,SAAQ,6BAG3C;CAAG;AAEN,eAAO,MAAM,OAAO,aAAc,mBAAmB,KAAG,KAAK,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,EAAE,KAAK,CACvD,CAAC"}
@@ -0,0 +1,23 @@
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ import * as Layer from 'effect/Layer';
4
+ import * as Option from 'effect/Option';
5
+ import { Database } from '@dxos/echo';
6
+ import * as Operation from './Operation';
7
+ import * as OperationHandlerSet from './OperationHandlerSet';
8
+ export interface OperationRegistry {
9
+ /**
10
+ * Resolve an operation by key.
11
+ */
12
+ resolve(key: string): Effect.Effect<Option.Option<Operation.Definition.Any>>;
13
+ }
14
+ declare const Service_base: Context.TagClass<Service, "@dxos/operation/OperationRegistry", OperationRegistry>;
15
+ export declare class Service extends Service_base {
16
+ }
17
+ /**
18
+ * Resolve an operation by key.
19
+ */
20
+ export declare const resolve: (key: string) => Effect.Effect<Option.Option<Operation.Definition.Any>, never, Service>;
21
+ export declare const layer: Layer.Layer<Service, never, Database.Service | OperationHandlerSet.OperationHandlerProvider>;
22
+ export {};
23
+ //# sourceMappingURL=OperationRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OperationRegistry.d.ts","sourceRoot":"","sources":["../../../src/OperationRegistry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAS,MAAM,YAAY,CAAC;AAE7C,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,mBAAmB,MAAM,uBAAuB,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;CAC9E;;AAED,qBAAa,OAAQ,SAAQ,YAA8E;CAAG;AAE9G;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,CACvC,CAAC;AAEtE,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,mBAAmB,CAAC,wBAAwB,CAkB5G,CAAC"}