@dxos/compute 0.8.4-main.dedc0f3 → 0.8.4-main.dfabb4ec29

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 (167) hide show
  1. package/README.md +36 -1
  2. package/dist/lib/neutral/StorageService.mjs +22 -0
  3. package/dist/lib/neutral/chunk-CXDV2FPU.mjs +53 -0
  4. package/dist/lib/neutral/chunk-CXDV2FPU.mjs.map +7 -0
  5. package/dist/lib/neutral/chunk-EG7VLX2F.mjs +25 -0
  6. package/dist/lib/neutral/chunk-EG7VLX2F.mjs.map +7 -0
  7. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  8. package/dist/lib/neutral/chunk-JTZYM2QW.mjs +144 -0
  9. package/dist/lib/neutral/chunk-JTZYM2QW.mjs.map +7 -0
  10. package/dist/lib/neutral/chunk-OA7JMLJK.mjs +17 -0
  11. package/dist/lib/neutral/chunk-OA7JMLJK.mjs.map +7 -0
  12. package/dist/lib/neutral/chunk-VIRNEVFD.mjs +199 -0
  13. package/dist/lib/neutral/chunk-VIRNEVFD.mjs.map +7 -0
  14. package/dist/lib/neutral/chunk-XEVFBI6S.mjs +62 -0
  15. package/dist/lib/neutral/chunk-XEVFBI6S.mjs.map +7 -0
  16. package/dist/lib/neutral/chunk-YEDUHFRC.mjs +21 -0
  17. package/dist/lib/neutral/chunk-YEDUHFRC.mjs.map +7 -0
  18. package/dist/lib/neutral/fib-WSN4EY7R.mjs +10 -0
  19. package/dist/lib/neutral/fib-WSN4EY7R.mjs.map +7 -0
  20. package/dist/lib/neutral/index.mjs +1073 -0
  21. package/dist/lib/neutral/index.mjs.map +7 -0
  22. package/dist/lib/neutral/meta.json +1 -0
  23. package/dist/lib/neutral/reply-XRLTFNDF.mjs +10 -0
  24. package/dist/lib/neutral/reply-XRLTFNDF.mjs.map +7 -0
  25. package/dist/lib/neutral/sleep-7O76LQCA.mjs +10 -0
  26. package/dist/lib/neutral/sleep-7O76LQCA.mjs.map +7 -0
  27. package/dist/lib/neutral/testing/index.mjs +32 -0
  28. package/dist/lib/neutral/testing/index.mjs.map +7 -0
  29. package/dist/types/src/Blueprint.d.ts +140 -0
  30. package/dist/types/src/Blueprint.d.ts.map +1 -0
  31. package/dist/types/src/Credential.d.ts +27 -0
  32. package/dist/types/src/Credential.d.ts.map +1 -0
  33. package/dist/types/src/McpServer.d.ts +27 -0
  34. package/dist/types/src/McpServer.d.ts.map +1 -0
  35. package/dist/types/src/Operation.d.ts +309 -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 +63 -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 +62 -0
  52. package/dist/types/src/Template.d.ts.map +1 -0
  53. package/dist/types/src/Template.test.d.ts +2 -0
  54. package/dist/types/src/Template.test.d.ts.map +1 -0
  55. package/dist/types/src/Trace.d.ts +174 -0
  56. package/dist/types/src/Trace.d.ts.map +1 -0
  57. package/dist/types/src/Trigger.d.ts +150 -0
  58. package/dist/types/src/Trigger.d.ts.map +1 -0
  59. package/dist/types/src/TriggerEvent.d.ts +75 -0
  60. package/dist/types/src/TriggerEvent.d.ts.map +1 -0
  61. package/dist/types/src/errors.d.ts +308 -0
  62. package/dist/types/src/errors.d.ts.map +1 -0
  63. package/dist/types/src/index.d.ts +16 -5
  64. package/dist/types/src/index.d.ts.map +1 -1
  65. package/dist/types/src/testing/definitions.d.ts +11 -0
  66. package/dist/types/src/testing/definitions.d.ts.map +1 -0
  67. package/dist/types/src/testing/fib.d.ts +8 -0
  68. package/dist/types/src/testing/fib.d.ts.map +1 -0
  69. package/dist/types/src/testing/index.d.ts +6 -3
  70. package/dist/types/src/testing/index.d.ts.map +1 -1
  71. package/dist/types/src/testing/reply.d.ts +4 -0
  72. package/dist/types/src/testing/reply.d.ts.map +1 -0
  73. package/dist/types/src/testing/sleep.d.ts +6 -0
  74. package/dist/types/src/testing/sleep.d.ts.map +1 -0
  75. package/dist/types/src/umbrella.test.d.ts +2 -0
  76. package/dist/types/src/umbrella.test.d.ts.map +1 -0
  77. package/dist/types/tsconfig.tsbuildinfo +1 -1
  78. package/package.json +27 -39
  79. package/src/Blueprint.ts +207 -0
  80. package/src/Credential.ts +53 -0
  81. package/src/McpServer.ts +44 -0
  82. package/src/Operation.ts +533 -0
  83. package/src/OperationHandlerSet.ts +134 -0
  84. package/src/OperationRegistry.ts +50 -0
  85. package/src/Process.ts +490 -0
  86. package/src/Routine.ts +88 -0
  87. package/src/Script.ts +40 -0
  88. package/src/ServiceResolver.ts +174 -0
  89. package/src/StorageService.ts +101 -0
  90. package/src/Template.test.ts +151 -0
  91. package/src/Template.ts +122 -0
  92. package/src/Trace.ts +231 -0
  93. package/src/Trigger.ts +209 -0
  94. package/src/TriggerEvent.ts +64 -0
  95. package/src/errors.ts +71 -0
  96. package/src/index.ts +17 -32
  97. package/src/testing/definitions.ts +49 -0
  98. package/src/testing/fib.ts +22 -0
  99. package/src/testing/index.ts +13 -4
  100. package/src/testing/reply.ts +18 -0
  101. package/src/testing/sleep.ts +16 -0
  102. package/src/umbrella.test.ts +51 -0
  103. package/dist/lib/browser/chunk-XQYPCRZP.mjs +0 -3140
  104. package/dist/lib/browser/chunk-XQYPCRZP.mjs.map +0 -7
  105. package/dist/lib/browser/index.mjs +0 -55
  106. package/dist/lib/browser/meta.json +0 -1
  107. package/dist/lib/browser/testing/index.mjs +0 -186
  108. package/dist/lib/browser/testing/index.mjs.map +0 -7
  109. package/dist/lib/node-esm/chunk-2XWWSGAU.mjs +0 -3142
  110. package/dist/lib/node-esm/chunk-2XWWSGAU.mjs.map +0 -7
  111. package/dist/lib/node-esm/index.mjs +0 -56
  112. package/dist/lib/node-esm/meta.json +0 -1
  113. package/dist/lib/node-esm/testing/index.mjs +0 -187
  114. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  115. package/dist/types/src/compute-graph-registry.d.ts +0 -32
  116. package/dist/types/src/compute-graph-registry.d.ts.map +0 -1
  117. package/dist/types/src/compute-graph.d.ts +0 -64
  118. package/dist/types/src/compute-graph.d.ts.map +0 -1
  119. package/dist/types/src/compute-graph.test.d.ts +0 -2
  120. package/dist/types/src/compute-graph.test.d.ts.map +0 -1
  121. package/dist/types/src/compute-node.d.ts +0 -24
  122. package/dist/types/src/compute-node.d.ts.map +0 -1
  123. package/dist/types/src/functions/async-function.d.ts +0 -66
  124. package/dist/types/src/functions/async-function.d.ts.map +0 -1
  125. package/dist/types/src/functions/edge-function.d.ts +0 -20
  126. package/dist/types/src/functions/edge-function.d.ts.map +0 -1
  127. package/dist/types/src/functions/function-defs.d.ts +0 -11
  128. package/dist/types/src/functions/function-defs.d.ts.map +0 -1
  129. package/dist/types/src/functions/index.d.ts +0 -4
  130. package/dist/types/src/functions/index.d.ts.map +0 -1
  131. package/dist/types/src/hyperformula.test.d.ts +0 -2
  132. package/dist/types/src/hyperformula.test.d.ts.map +0 -1
  133. package/dist/types/src/testing/test-builder.d.ts +0 -15
  134. package/dist/types/src/testing/test-builder.d.ts.map +0 -1
  135. package/dist/types/src/testing/test-plugin.d.ts +0 -35
  136. package/dist/types/src/testing/test-plugin.d.ts.map +0 -1
  137. package/dist/types/src/testing/util.d.ts +0 -2
  138. package/dist/types/src/testing/util.d.ts.map +0 -1
  139. package/dist/types/src/types/hyperformula.d.ts +0 -8
  140. package/dist/types/src/types/hyperformula.d.ts.map +0 -1
  141. package/dist/types/src/types/index.d.ts +0 -3
  142. package/dist/types/src/types/index.d.ts.map +0 -1
  143. package/dist/types/src/types/types.d.ts +0 -20
  144. package/dist/types/src/types/types.d.ts.map +0 -1
  145. package/dist/types/src/types/types.test.d.ts +0 -2
  146. package/dist/types/src/types/types.test.d.ts.map +0 -1
  147. package/dist/types/src/util.d.ts +0 -2
  148. package/dist/types/src/util.d.ts.map +0 -1
  149. package/src/compute-graph-registry.ts +0 -88
  150. package/src/compute-graph.test.ts +0 -88
  151. package/src/compute-graph.ts +0 -258
  152. package/src/compute-node.ts +0 -59
  153. package/src/functions/async-function.ts +0 -183
  154. package/src/functions/edge-function.ts +0 -111
  155. package/src/functions/function-defs.ts +0 -2427
  156. package/src/functions/index.ts +0 -7
  157. package/src/hyperformula.test.ts +0 -14
  158. package/src/testing/test-builder.ts +0 -54
  159. package/src/testing/test-plugin.ts +0 -98
  160. package/src/testing/util.ts +0 -9
  161. package/src/types/hyperformula.ts +0 -19
  162. package/src/types/index.ts +0 -6
  163. package/src/types/types.test.ts +0 -91
  164. package/src/types/types.ts +0 -80
  165. package/src/util.ts +0 -8
  166. /package/dist/lib/{browser/index.mjs.map → neutral/StorageService.mjs.map} +0 -0
  167. /package/dist/lib/{node-esm/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
package/README.md CHANGED
@@ -1,3 +1,38 @@
1
1
  # @dxos/compute
2
2
 
3
- Basic compute API.
3
+ Umbrella package for AI-aware DXOS compute primitives.
4
+
5
+ ## Usage
6
+
7
+ Importing from `@dxos/compute` is equivalent to importing from the underlying
8
+ source packages. Namespaces preserve their nesting — there is no extra wrapping
9
+ or unwrapping:
10
+
11
+ ```ts
12
+ import { Blueprint, Operation, Routine, Process, Script, Trace, Trigger } from '@dxos/compute';
13
+
14
+ Blueprint.make({ /* ... */ });
15
+ Operation.lazy(() => /* ... */);
16
+ Trace.write(Trace.OperationStart, { /* ... */ });
17
+ ```
18
+
19
+ This single surface subsumes:
20
+
21
+ | Re-exported from | Includes |
22
+ | ------------------ | --------------------------------------------------------------- |
23
+ | `@dxos/operation` | `Operation`, `OperationInvoker`, `OperationHandlerSet`, `OperationRegistry`, errors |
24
+ | `@dxos/blueprints` | `Blueprint`, `Routine`, `Template` |
25
+ | `@dxos/functions` | `Process`, `Trigger`, `TriggerEvent`, `Script`, `Trace`, `ServiceResolver`, `StorageService`, `CredentialsService`, `ExampleHandlers`, services, errors, sdk |
26
+
27
+ The HyperFormula-based compute graph that previously lived here moved to
28
+ [`@dxos/compute-hyperformula`](../compute-hyperformula).
29
+
30
+ ## Roadmap
31
+
32
+ - Stage 1 (current): re-exports — consumers depend only on `@dxos/compute`
33
+ while the source packages stay in place.
34
+ - Stage 2: migrate source into `@dxos/compute` and remove
35
+ `@dxos/operation`, `@dxos/blueprints`, and `@dxos/functions`.
36
+ - A companion `@dxos/compute-runtime-local` package will host the local
37
+ implementations of the services defined here (currently in
38
+ `@dxos/functions-runtime`).
@@ -0,0 +1,22 @@
1
+ import {
2
+ StorageService,
3
+ clear,
4
+ deleteKey,
5
+ get,
6
+ key,
7
+ list,
8
+ set,
9
+ withDefault
10
+ } from "./chunk-XEVFBI6S.mjs";
11
+ import "./chunk-J5LGTIGS.mjs";
12
+ export {
13
+ StorageService,
14
+ clear,
15
+ deleteKey,
16
+ get,
17
+ key,
18
+ list,
19
+ set,
20
+ withDefault
21
+ };
22
+ //# sourceMappingURL=StorageService.mjs.map
@@ -0,0 +1,53 @@
1
+ import {
2
+ intrinsic,
3
+ make
4
+ } from "./chunk-VIRNEVFD.mjs";
5
+
6
+ // src/testing/definitions.ts
7
+ import * as Schema from "effect/Schema";
8
+ var Fibonacci = make({
9
+ meta: {
10
+ key: "org.example.function.fib",
11
+ name: "Fibonacci",
12
+ description: "Function that calculates a Fibonacci number"
13
+ },
14
+ input: Schema.Struct({
15
+ iterations: Schema.optional(Schema.Number).annotations({
16
+ description: "Number of iterations",
17
+ default: 1e5
18
+ })
19
+ }),
20
+ output: Schema.Struct({
21
+ result: Schema.String
22
+ })
23
+ }).pipe(intrinsic);
24
+ var Reply = make({
25
+ meta: {
26
+ key: "org.example.function.reply",
27
+ name: "Reply",
28
+ description: "Function that echoes the input"
29
+ },
30
+ input: Schema.Any,
31
+ output: Schema.Any
32
+ }).pipe(intrinsic);
33
+ var Sleep = make({
34
+ meta: {
35
+ key: "org.example.function.sleep",
36
+ name: "Sleep",
37
+ description: "Function that sleeps for a given amount of time"
38
+ },
39
+ input: Schema.Struct({
40
+ duration: Schema.optional(Schema.Number).annotations({
41
+ description: "Milliseconds to sleep",
42
+ default: 1e5
43
+ })
44
+ }),
45
+ output: Schema.Void
46
+ }).pipe(intrinsic);
47
+
48
+ export {
49
+ Fibonacci,
50
+ Reply,
51
+ Sleep
52
+ };
53
+ //# sourceMappingURL=chunk-CXDV2FPU.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/testing/definitions.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport * as Operation from '../Operation';\n\nexport const Fibonacci = Operation.make({\n meta: {\n key: 'org.example.function.fib',\n name: 'Fibonacci',\n description: 'Function that calculates a Fibonacci number',\n },\n input: Schema.Struct({\n iterations: Schema.optional(Schema.Number).annotations({\n description: 'Number of iterations',\n default: 100_000,\n }),\n }),\n output: Schema.Struct({\n result: Schema.String,\n }),\n}).pipe(Operation.intrinsic);\n\nexport const Reply = Operation.make({\n meta: {\n key: 'org.example.function.reply',\n name: 'Reply',\n description: 'Function that echoes the input',\n },\n input: Schema.Any,\n output: Schema.Any,\n}).pipe(Operation.intrinsic);\n\nexport const Sleep = Operation.make({\n meta: {\n key: 'org.example.function.sleep',\n name: 'Sleep',\n description: 'Function that sleeps for a given amount of time',\n },\n input: Schema.Struct({\n duration: Schema.optional(Schema.Number).annotations({\n description: 'Milliseconds to sleep',\n default: 100_000,\n }),\n }),\n output: Schema.Void,\n}).pipe(Operation.intrinsic);\n"],
5
+ "mappings": ";;;;;;AAIA,YAAYA,YAAY;AAIjB,IAAMC,YAAsBC,KAAK;EACtCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBC,YAAmBC,gBAAgBC,aAAM,EAAEC,YAAY;MACrDN,aAAa;MACbO,SAAS;IACX,CAAA;EACF,CAAA;EACAC,QAAeN,cAAO;IACpBO,QAAeC;EACjB,CAAA;AACF,CAAA,EAAGC,KAAeC,SAAS;AAEpB,IAAMC,QAAkBjB,KAAK;EAClCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAca;EACdN,QAAeM;AACjB,CAAA,EAAGH,KAAeC,SAAS;AAEpB,IAAMG,QAAkBnB,KAAK;EAClCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBc,UAAiBZ,gBAAgBC,aAAM,EAAEC,YAAY;MACnDN,aAAa;MACbO,SAAS;IACX,CAAA;EACF,CAAA;EACAC,QAAeS;AACjB,CAAA,EAAGN,KAAeC,SAAS;",
6
+ "names": ["Schema", "Fibonacci", "make", "meta", "key", "name", "description", "input", "Struct", "iterations", "optional", "Number", "annotations", "default", "output", "result", "String", "pipe", "intrinsic", "Reply", "Any", "Sleep", "duration", "Void"]
7
+ }
@@ -0,0 +1,25 @@
1
+ import {
2
+ Fibonacci
3
+ } from "./chunk-CXDV2FPU.mjs";
4
+ import {
5
+ withHandler
6
+ } from "./chunk-VIRNEVFD.mjs";
7
+
8
+ // src/testing/fib.ts
9
+ import * as Effect from "effect/Effect";
10
+ var fib_default = Fibonacci.pipe(withHandler(Effect.fn(function* ({ iterations = 1e5 }) {
11
+ let a = 0n;
12
+ let b = 1n;
13
+ for (let i = 0; i < iterations; i++) {
14
+ a += b;
15
+ b = a - b;
16
+ }
17
+ return {
18
+ result: a.toString()
19
+ };
20
+ })));
21
+
22
+ export {
23
+ fib_default
24
+ };
25
+ //# sourceMappingURL=chunk-EG7VLX2F.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/testing/fib.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as Operation from '../Operation';\nimport { Fibonacci } from './definitions';\n\nexport default Fibonacci.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ 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"],
5
+ "mappings": ";;;;;;;;AAIA,YAAYA,YAAY;AAKxB,IAAA,cAAeC,UAAUC,KACbC,YACDC,UAAG,WAAW,EAAEC,aAAa,IAAO,GAAE;AAC3C,MAAIC,IAAI;AACR,MAAIC,IAAI;AACR,WAASC,IAAI,GAAGA,IAAIH,YAAYG,KAAK;AACnCF,SAAKC;AACLA,QAAID,IAAIC;EACV;AACA,SAAO;IAAEE,QAAQH,EAAEI,SAAQ;EAAG;AAChC,CAAA,CAAA,CAAA;",
6
+ "names": ["Effect", "Fibonacci", "pipe", "withHandler", "fn", "iterations", "a", "b", "i", "result", "toString"]
7
+ }
@@ -0,0 +1,10 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ export {
8
+ __export
9
+ };
10
+ //# sourceMappingURL=chunk-J5LGTIGS.mjs.map
@@ -0,0 +1,144 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-J5LGTIGS.mjs";
4
+
5
+ // src/errors.ts
6
+ import { BaseError } from "@dxos/errors";
7
+ var InvokerNotInitializedError = class extends BaseError.extend("InvokerNotInitializedError", "Invoker not initialized") {
8
+ constructor() {
9
+ super();
10
+ }
11
+ };
12
+ var NoHandlerError = class extends BaseError.extend("NoHandlerError", "No handler found for operation. ") {
13
+ constructor(operationKey) {
14
+ super({
15
+ context: {
16
+ operationKey
17
+ }
18
+ });
19
+ }
20
+ };
21
+ var ServiceNotAvailableError = class extends BaseError.extend("ServiceNotAvailable", "Service not available") {
22
+ constructor(service, options) {
23
+ super({
24
+ context: {
25
+ service
26
+ },
27
+ ...options,
28
+ message: `Service not available: ${service}`
29
+ });
30
+ }
31
+ };
32
+ var FunctionNotFoundError = class extends BaseError.extend("FunctionNotFound", "Function not found") {
33
+ constructor(functionKey, options) {
34
+ super({
35
+ context: {
36
+ function: functionKey
37
+ },
38
+ ...options
39
+ });
40
+ }
41
+ };
42
+ var FunctionError = class extends BaseError.extend("FunctionError", "Function invocation error") {
43
+ };
44
+ var InvalidOperationInputError = class extends BaseError.extend("InvalidOperationInput", "Operation input did not match schema") {
45
+ };
46
+ var InvalidOperationOutputError = class extends BaseError.extend("InvalidOperationOutput", "Operation output did not match schema") {
47
+ };
48
+ var TriggerStateNotFoundError = class extends BaseError.extend("TriggerStateNotFound", "Trigger state not found") {
49
+ };
50
+ var FunctionsAiUpstreamError = class extends BaseError.extend("FunctionsAiUpstreamError", "Upstream AI service returned an error") {
51
+ };
52
+ var FunctionsAiMemoizationMissError = class extends BaseError.extend("FunctionsAiMemoizationMissError", "No memoized AI conversation found for the given cache key") {
53
+ };
54
+
55
+ // src/OperationHandlerSet.ts
56
+ var OperationHandlerSet_exports = {};
57
+ __export(OperationHandlerSet_exports, {
58
+ OperationHandlerProvider: () => OperationHandlerProvider,
59
+ TypeId: () => TypeId,
60
+ async: () => async,
61
+ empty: () => empty,
62
+ getHandler: () => getHandler,
63
+ getHandlerByKey: () => getHandlerByKey,
64
+ isOperationHandlerSet: () => isOperationHandlerSet,
65
+ lazy: () => lazy,
66
+ make: () => make,
67
+ merge: () => merge,
68
+ provide: () => provide
69
+ });
70
+ import * as Context from "effect/Context";
71
+ import * as Effect from "effect/Effect";
72
+ import * as Layer from "effect/Layer";
73
+ import { assertArgument } from "@dxos/invariant";
74
+ var TypeId = "~@dxos/operation/OperationHandlerSet";
75
+ var isOperationHandlerSet = (value) => {
76
+ return typeof value === "object" && value !== null && TypeId in value;
77
+ };
78
+ var empty = {
79
+ [TypeId]: TypeId,
80
+ handlers: Effect.succeed([]),
81
+ getHandlers: () => Promise.resolve([])
82
+ };
83
+ var make = (...handlers) => {
84
+ return async(() => Promise.resolve(handlers));
85
+ };
86
+ var async = (getHandlers) => {
87
+ let promise2 = null;
88
+ const getHandlersCached = () => {
89
+ if (!promise2) {
90
+ promise2 = getHandlers();
91
+ }
92
+ return promise2;
93
+ };
94
+ return {
95
+ [TypeId]: TypeId,
96
+ getHandlers,
97
+ handlers: Effect.promise(getHandlersCached)
98
+ };
99
+ };
100
+ var merge = (...sets) => {
101
+ assertArgument(sets.every(isOperationHandlerSet), "sets", "sets must be an array of OperationHandlerSet");
102
+ return async(() => Promise.all(sets.map((set) => set.getHandlers())).then((handlers) => handlers.flat()));
103
+ };
104
+ var lazy = (...modules) => {
105
+ return async(() => Promise.all(modules.map((module) => module().then(({ default: handler }) => handler))));
106
+ };
107
+ var getHandler = (set, definition) => Effect.gen(function* () {
108
+ const handlers = yield* set.handlers;
109
+ const handler = handlers.find((handler2) => handler2.meta.key === definition.meta.key);
110
+ if (!handler) {
111
+ return yield* Effect.fail(new NoHandlerError(definition.meta.key));
112
+ }
113
+ return handler;
114
+ });
115
+ var getHandlerByKey = (set, key) => Effect.gen(function* () {
116
+ const handlers = yield* set.handlers;
117
+ const handler = handlers.find((handler2) => handler2.meta.key === key);
118
+ if (!handler) {
119
+ return yield* Effect.fail(new NoHandlerError(key));
120
+ }
121
+ return handler;
122
+ });
123
+ var OperationHandlerProvider = class extends Context.Tag("@dxos/operation/OperationHandlerProvider")() {
124
+ };
125
+ var provide = (handlers) => Layer.succeed(OperationHandlerProvider, handlers);
126
+
127
+ export {
128
+ InvokerNotInitializedError,
129
+ NoHandlerError,
130
+ ServiceNotAvailableError,
131
+ FunctionNotFoundError,
132
+ FunctionError,
133
+ InvalidOperationInputError,
134
+ InvalidOperationOutputError,
135
+ TriggerStateNotFoundError,
136
+ FunctionsAiUpstreamError,
137
+ FunctionsAiMemoizationMissError,
138
+ lazy,
139
+ getHandler,
140
+ getHandlerByKey,
141
+ OperationHandlerProvider,
142
+ OperationHandlerSet_exports
143
+ };
144
+ //# sourceMappingURL=chunk-JTZYM2QW.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/errors.ts", "../../../src/OperationHandlerSet.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { BaseError, type BaseErrorOptions } from '@dxos/errors';\n\n// Errors from @dxos/operation.\n\nexport class InvokerNotInitializedError extends BaseError.extend(\n 'InvokerNotInitializedError',\n 'Invoker not initialized',\n) {\n constructor() {\n super();\n }\n}\n\nexport class NoHandlerError extends BaseError.extend('NoHandlerError', 'No handler found for operation. ') {\n constructor(operationKey: string) {\n super({ context: { operationKey } });\n }\n}\n\n// Errors from @dxos/functions.\n\nexport class ServiceNotAvailableError extends BaseError.extend('ServiceNotAvailable', 'Service not available') {\n constructor(service: string, options?: Omit<BaseErrorOptions, 'context'>) {\n super({ context: { service }, ...options, message: `Service not available: ${service}` });\n }\n}\n\nexport class FunctionNotFoundError extends BaseError.extend('FunctionNotFound', 'Function not found') {\n constructor(functionKey: string, options?: Omit<BaseErrorOptions, 'context'>) {\n super({ context: { function: functionKey }, ...options });\n }\n}\n\nexport class FunctionError extends BaseError.extend('FunctionError', 'Function invocation error') {}\n\nexport class InvalidOperationInputError extends BaseError.extend(\n 'InvalidOperationInput',\n 'Operation input did not match schema',\n) {}\n\nexport class InvalidOperationOutputError extends BaseError.extend(\n 'InvalidOperationOutput',\n 'Operation output did not match schema',\n) {}\n\nexport class TriggerStateNotFoundError extends BaseError.extend('TriggerStateNotFound', 'Trigger state not found') {}\n\n/**\n * Raised when the upstream AI gateway responds with a structured JSON error envelope\n * (`{ \"type\": \"error\", \"error\": { \"type\": ..., \"message\": ... } }`). Surfaces as a typed\n * defect from `FunctionsAiHttpClient`, bypassing `@effect/ai`'s generic `HttpResponseError`\n * wrapping so callers can match on the error class directly.\n */\nexport class FunctionsAiUpstreamError extends BaseError.extend(\n 'FunctionsAiUpstreamError',\n 'Upstream AI service returned an error',\n) {}\n\n/**\n * Specialized `FunctionsAiUpstreamError` for the memoization layer: the recorded fixture for a\n * given cache key was not found and `ALLOW_LLM_GENERATION` is unset. The `cacheKey` is exposed\n * via `context.cacheKey` to make regeneration straightforward.\n */\nexport class FunctionsAiMemoizationMissError extends BaseError.extend(\n 'FunctionsAiMemoizationMissError',\n 'No memoized AI conversation found for the given cache key',\n) {}\n", "//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nimport { assertArgument } from '@dxos/invariant';\n\nimport { NoHandlerError } from './errors';\nimport type * as Operation from './Operation';\n\nexport const TypeId = '~@dxos/operation/OperationHandlerSet' as const;\nexport type TypeId = typeof TypeId;\n\nexport interface OperationHandlerSet {\n [TypeId]: TypeId;\n\n readonly handlers: Effect.Effect<Operation.WithHandler<Operation.Definition.Any>[]>;\n\n getHandlers(): Promise<Operation.WithHandler<Operation.Definition.Any>[]>;\n}\n\nexport const isOperationHandlerSet = (value: unknown): value is OperationHandlerSet => {\n return typeof value === 'object' && value !== null && TypeId in value;\n};\n\nexport const empty: OperationHandlerSet = {\n [TypeId]: TypeId,\n handlers: Effect.succeed([]),\n getHandlers: () => Promise.resolve([]),\n};\n\n/**\n * Creates a new operation handler set from a list of handlers.\n *\n * @example\n * ```ts\n * const set = OperationHandlerSet.make(\n * Operation.withHandler(Operation.make({ input: Schema.Void, output: Schema.Void }), (input) => Effect.succeed({})),\n * Operation.withHandler(Operation.make({ input: Schema.Void, output: Schema.Void }), (input) => Effect.succeed({})),\n * );\n * ```\n */\nexport const make = (...handlers: Operation.WithHandler<Operation.Definition.Any>[]): OperationHandlerSet => {\n return async(() => Promise.resolve(handlers));\n};\n\nexport const async = (\n getHandlers: () => Promise<Operation.WithHandler<Operation.Definition.Any>[]>,\n): OperationHandlerSet => {\n // NOTE: Re-runing async module imports has a big performance penalty in Chrome.\n let promise: Promise<Operation.WithHandler<Operation.Definition.Any>[]> | null = null;\n const getHandlersCached = () => {\n if (!promise) {\n promise = getHandlers();\n }\n return promise;\n };\n return {\n [TypeId]: TypeId,\n getHandlers,\n handlers: Effect.promise(getHandlersCached),\n };\n};\n\n/**\n * Merges multiple operation handler sets into a single set.\n *\n */\nexport const merge = (...sets: OperationHandlerSet[]): OperationHandlerSet => {\n assertArgument(sets.every(isOperationHandlerSet), 'sets', 'sets must be an array of OperationHandlerSet');\n return async(() => Promise.all(sets.map((set) => set.getHandlers())).then((handlers) => handlers.flat()));\n};\n\n/**\n * Creates a new operation handler set from a list of lazy-loaded modules.\n *\n * @example\n * ```ts\n * const set = OperationHandlerSet.lazy(\n * () => import('./my-handler'),\n * () => import('./my-other-handler'),\n * );\n * ```\n */\nexport const lazy = (\n ...modules: (() => Promise<{ default: Operation.WithHandler<Operation.Definition.Any> }>)[]\n): OperationHandlerSet => {\n return async(() => Promise.all(modules.map((module) => module().then(({ default: handler }) => handler))));\n};\n\n/**\n * Gets a handler for an operation by definition.\n */\nexport const getHandler = <const Op extends Operation.Definition.Any>(\n set: OperationHandlerSet,\n definition: Op,\n): Effect.Effect<Operation.WithHandler<Op>, NoHandlerError> =>\n Effect.gen(function* () {\n const handlers = yield* set.handlers;\n const handler = handlers.find((handler) => handler.meta.key === definition.meta.key);\n if (!handler) {\n return yield* Effect.fail(new NoHandlerError(definition.meta.key));\n }\n return handler as any;\n });\n\n/**\n * Gets a handler for an operation by key.\n */\nexport const getHandlerByKey = (\n set: OperationHandlerSet,\n key: string,\n): Effect.Effect<Operation.WithHandler<Operation.Definition.Any>, NoHandlerError> =>\n Effect.gen(function* () {\n const handlers = yield* set.handlers;\n const handler = handlers.find((handler) => handler.meta.key === key);\n if (!handler) {\n return yield* Effect.fail(new NoHandlerError(key));\n }\n return handler as any;\n });\n\nexport class OperationHandlerProvider extends Context.Tag('@dxos/operation/OperationHandlerProvider')<\n OperationHandlerProvider,\n OperationHandlerSet\n>() {}\n\nexport const provide = (handlers: OperationHandlerSet): Layer.Layer<OperationHandlerProvider, never, never> =>\n Layer.succeed(OperationHandlerProvider, handlers);\n"],
5
+ "mappings": "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",
6
+ "names": ["BaseError", "InvokerNotInitializedError", "extend", "NoHandlerError", "operationKey", "context", "ServiceNotAvailableError", "service", "options", "message", "FunctionNotFoundError", "functionKey", "function", "FunctionError", "InvalidOperationInputError", "InvalidOperationOutputError", "TriggerStateNotFoundError", "FunctionsAiUpstreamError", "FunctionsAiMemoizationMissError", "Context", "Effect", "Layer", "assertArgument", "TypeId", "isOperationHandlerSet", "value", "empty", "handlers", "succeed", "getHandlers", "Promise", "resolve", "make", "async", "promise", "getHandlersCached", "merge", "sets", "assertArgument", "every", "all", "map", "set", "then", "flat", "lazy", "modules", "module", "default", "handler", "getHandler", "definition", "gen", "find", "meta", "key", "fail", "NoHandlerError", "getHandlerByKey", "OperationHandlerProvider", "Tag", "provide"]
7
+ }
@@ -0,0 +1,17 @@
1
+ import {
2
+ Sleep
3
+ } from "./chunk-CXDV2FPU.mjs";
4
+ import {
5
+ withHandler
6
+ } from "./chunk-VIRNEVFD.mjs";
7
+
8
+ // src/testing/sleep.ts
9
+ import * as Effect from "effect/Effect";
10
+ var sleep_default = Sleep.pipe(withHandler(Effect.fn(function* ({ duration = 1e5 }) {
11
+ yield* Effect.sleep(duration);
12
+ })));
13
+
14
+ export {
15
+ sleep_default
16
+ };
17
+ //# sourceMappingURL=chunk-OA7JMLJK.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/testing/sleep.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport * as Operation from '../Operation';\nimport { Sleep } from './definitions';\n\nexport default Sleep.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ duration = 100_000 }) {\n yield* Effect.sleep(duration);\n }),\n ),\n);\n"],
5
+ "mappings": ";;;;;;;;AAIA,YAAYA,YAAY;AAKxB,IAAA,gBAAeC,MAAMC,KACTC,YACDC,UAAG,WAAW,EAAEC,WAAW,IAAO,GAAE;AACzC,SAAcC,aAAMD,QAAAA;AACtB,CAAA,CAAA,CAAA;",
6
+ "names": ["Effect", "Sleep", "pipe", "withHandler", "fn", "duration", "sleep"]
7
+ }
@@ -0,0 +1,199 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-J5LGTIGS.mjs";
4
+
5
+ // src/Operation.ts
6
+ var Operation_exports = {};
7
+ __export(Operation_exports, {
8
+ DefinitionTypeId: () => DefinitionTypeId,
9
+ PersistentOperation: () => PersistentOperation,
10
+ Service: () => Service,
11
+ deserialize: () => deserialize,
12
+ intrinsic: () => intrinsic,
13
+ invoke: () => invoke,
14
+ isOperationDefinition: () => isOperationDefinition,
15
+ isOperationWithHandler: () => isOperationWithHandler,
16
+ make: () => make,
17
+ opaqueHandler: () => opaqueHandler,
18
+ schedule: () => schedule,
19
+ serialize: () => serialize,
20
+ setFrom: () => setFrom,
21
+ withHandler: () => withHandler,
22
+ withInvocationOptions: () => withInvocationOptions
23
+ });
24
+ import * as Context from "effect/Context";
25
+ import * as Effect from "effect/Effect";
26
+ import * as Layer from "effect/Layer";
27
+ import * as Pipeable from "effect/Pipeable";
28
+ import * as Schema$ from "effect/Schema";
29
+ import { Annotation, JsonSchema, Obj, Ref, Type } from "@dxos/echo";
30
+ var DefinitionTypeId = "~@dxos/operation/OperationDefinition";
31
+ var isOperationDefinition = (value) => {
32
+ return typeof value === "object" && value !== null && DefinitionTypeId in value;
33
+ };
34
+ var isOperationWithHandler = (value) => {
35
+ return isOperationDefinition(value) && "handler" in value;
36
+ };
37
+ var make = (props) => {
38
+ return {
39
+ [DefinitionTypeId]: {},
40
+ ...props,
41
+ executionMode: props.executionMode ?? "async",
42
+ types: props.types ?? [],
43
+ services: props.services ?? [],
44
+ pipe() {
45
+ return Pipeable.pipeArguments(this, arguments);
46
+ }
47
+ };
48
+ };
49
+ var intrinsic = (op) => {
50
+ return {
51
+ ...op,
52
+ meta: {
53
+ ...op.meta,
54
+ deployedId: `intrinsic:${op.meta.key}`
55
+ }
56
+ };
57
+ };
58
+ var withHandler = (opOrHandler, handler) => {
59
+ if (handler === void 0) {
60
+ const handlerFn = opOrHandler;
61
+ return (op2) => ({
62
+ ...op2,
63
+ handler: handlerFn
64
+ });
65
+ }
66
+ const op = opOrHandler;
67
+ return {
68
+ ...op,
69
+ handler
70
+ };
71
+ };
72
+ var opaqueHandler = (handler) => handler;
73
+ var PersistentOperation = Schema$.Struct({
74
+ /**
75
+ * Global registry ID.
76
+ * NOTE: The `key` property refers to the original registry entry.
77
+ */
78
+ // TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.
79
+ // TODO(dmaretskyi): Consider making it part of ECHO meta.
80
+ // TODO(dmaretskyi): Make required.
81
+ key: Schema$.optional(Schema$.String).annotations({
82
+ description: "Unique registration key for the blueprint"
83
+ }),
84
+ name: Schema$.NonEmptyString,
85
+ version: Schema$.String,
86
+ description: Schema$.optional(Schema$.String),
87
+ /**
88
+ * ISO date string of the last deployment.
89
+ */
90
+ updated: Schema$.optional(Schema$.String),
91
+ // Reference to a source script if it exists within ECHO.
92
+ // TODO(burdon): Don't ref ScriptType directly (core).
93
+ source: Schema$.optional(Ref.Ref(Obj.Unknown)),
94
+ inputSchema: Schema$.optional(JsonSchema.JsonSchema),
95
+ outputSchema: Schema$.optional(JsonSchema.JsonSchema),
96
+ /**
97
+ * List of required services.
98
+ * Match the Context.Tag keys of the FunctionServices variants.
99
+ */
100
+ services: Schema$.optional(Schema$.Array(Schema$.String)),
101
+ // Local binding to a function name.
102
+ // TODO(dmaretskyi): Add this field to Operation.Definition.
103
+ binding: Schema$.optional(Schema$.String)
104
+ }).pipe(
105
+ // TODO(dmaretskyi): Keep typename as 'org.dxos.type.function' (not 'operation') to maintain
106
+ // backward compatibility with existing data and avoid requiring data migration.
107
+ Type.object({
108
+ typename: "org.dxos.type.function",
109
+ version: "0.1.0"
110
+ }),
111
+ Annotation.LabelAnnotation.set([
112
+ "name"
113
+ ]),
114
+ Annotation.IconAnnotation.set({
115
+ icon: "ph--function--regular",
116
+ hue: "blue"
117
+ }),
118
+ Annotation.SystemTypeAnnotation.set(true)
119
+ );
120
+ var FUNCTION_META_KEY = "org.dxos.service.function";
121
+ var serialize = (operation) => {
122
+ return Obj.make(PersistentOperation, {
123
+ [Obj.Meta]: {
124
+ keys: operation.meta.deployedId ? [
125
+ {
126
+ source: FUNCTION_META_KEY,
127
+ id: operation.meta.deployedId
128
+ }
129
+ ] : []
130
+ },
131
+ key: operation.meta.key,
132
+ name: operation.meta.name ?? "",
133
+ version: operation.meta.version ?? "0.0.0",
134
+ description: operation.meta.description,
135
+ updated: void 0,
136
+ source: void 0,
137
+ inputSchema: JsonSchema.toJsonSchema(operation.input),
138
+ outputSchema: JsonSchema.toJsonSchema(operation.output),
139
+ services: operation.services.map((service) => service.key)
140
+ });
141
+ };
142
+ var deserialize = (record) => {
143
+ const deployedId = Obj.getMeta(record).keys.find((key) => key.source === FUNCTION_META_KEY)?.id;
144
+ return make({
145
+ input: record.inputSchema ? JsonSchema.toEffectSchema(record.inputSchema) : Schema$.Unknown,
146
+ output: record.outputSchema ? JsonSchema.toEffectSchema(record.outputSchema) : Schema$.Unknown,
147
+ services: record.services?.map((service) => Context.GenericTag(service)) ?? [],
148
+ executionMode: "async",
149
+ types: [],
150
+ meta: {
151
+ key: record.key ?? record.name,
152
+ name: record.name,
153
+ version: record.version,
154
+ description: record.description,
155
+ deployedId
156
+ }
157
+ });
158
+ };
159
+ var setFrom = (target, source) => {
160
+ Obj.update(target, (target2) => {
161
+ target2.key = source.key ?? target2.key;
162
+ target2.name = source.name ?? target2.name;
163
+ target2.version = source.version;
164
+ target2.description = source.description;
165
+ target2.updated = source.updated;
166
+ target2.inputSchema = source.inputSchema ? JSON.parse(JSON.stringify(source.inputSchema)) : void 0;
167
+ target2.outputSchema = source.outputSchema ? JSON.parse(JSON.stringify(source.outputSchema)) : void 0;
168
+ Obj.getMeta(target2).keys = JSON.parse(JSON.stringify(Obj.getMeta(source).keys));
169
+ });
170
+ };
171
+ var Service = class extends Context.Tag("@dxos/operation/Service")() {
172
+ };
173
+ var invoke = (op, ...args) => Effect.flatMap(Service, (ops) => ops.invoke(op, ...args)).pipe(Effect.withSpan("Operation.invoke"));
174
+ var schedule = (op, ...args) => Effect.flatMap(Service, (ops) => ops.schedule(op, args[0])).pipe(Effect.withSpan("Operation.schedule"));
175
+ var withInvocationOptions = (options) => Layer.effect(Service, Effect.gen(function* () {
176
+ const service = yield* Service;
177
+ return Service.of({
178
+ invoke: (op, input, invocationOptions) => service.invoke(op, input, {
179
+ ...options,
180
+ ...invocationOptions
181
+ }),
182
+ invokePromise: (op, input, invocationOptions) => service.invokePromise(op, input, {
183
+ ...options,
184
+ ...invocationOptions
185
+ }),
186
+ schedule: service.schedule
187
+ });
188
+ }));
189
+
190
+ export {
191
+ make,
192
+ intrinsic,
193
+ withHandler,
194
+ PersistentOperation,
195
+ deserialize,
196
+ invoke,
197
+ Operation_exports
198
+ };
199
+ //# sourceMappingURL=chunk-VIRNEVFD.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/Operation.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Pipeable from 'effect/Pipeable';\nimport * as Schema$ from 'effect/Schema';\nimport type * as Types from 'effect/Types';\n\nimport { Annotation, JsonSchema, Obj, Ref, Type, type DXN, type Key } from '@dxos/echo';\n\nimport type { NoHandlerError } from './errors';\nimport type { Operation } from './index';\n\n/**\n * Schema type that accepts any Encoded form but requires no Context.\n * This allows ECHO object schemas where Type !== Encoded due to [KindId] symbol.\n */\ntype Schema<T> = Schema$.Schema<T, any, never>;\n\nexport const DefinitionTypeId = '~@dxos/operation/OperationDefinition' as const;\nexport type DefinitionTypeId = typeof DefinitionTypeId;\n\n/**\n * Serializable definition of an Operation.\n * Contains schema and metadata, but no runtime logic.\n */\nexport interface Definition<I, O, S = any> extends Pipeable.Pipeable, Definition.Variance<I, O, S> {\n /**\n * Input schema for the operation.\n */\n readonly input: Schema<I>;\n /**\n * Output schema for the operation.\n */\n readonly output: Schema<O>;\n\n readonly meta: {\n readonly key: string;\n readonly name?: string;\n readonly version?: string;\n readonly description?: string;\n /**\n * Deployment ID for remote invocation.\n * Assigned by the EDGE function service when deployed.\n */\n readonly deployedId?: string;\n };\n\n /**\n * Execution mode for the operation.\n * - 'sync': Operation completes synchronously (fast, UI-blocking acceptable).\n * - 'async': Operation may take time (should not block UI).\n */\n readonly executionMode: 'sync' | 'async';\n\n /**\n * ECHO types the operation uses.\n * Ensures types are available when the operation is executed remotely.\n */\n readonly types: readonly Type.AnyEntity[];\n\n /**\n * Effect services required by this operation.\n * These services will be automatically provided to the handler at invocation time.\n */\n readonly services: readonly Context.Tag<any, any>[];\n}\n\n/**\n * Namespace for OperationDefinition helper types.\n */\nexport declare namespace Definition {\n export interface Variance<I, O, S> {\n [DefinitionTypeId]: {\n readonly _Input: Types.Contravariant<I>;\n readonly _Output: Types.Covariant<O>;\n readonly _Services: Types.Covariant<S>;\n };\n }\n\n /**\n * Any operation definition, regardless of input/output types.\n */\n export type Any = Definition<any, any, any>;\n\n /**\n * Extract the input type from an operation definition.\n */\n export type Input<T extends Any> = T extends Variance<infer I, infer _O, infer _S> ? I : never;\n\n /**\n * Extract the output type from an operation definition.\n */\n export type Output<T extends Any> = T extends Variance<infer _I, infer O, infer _S> ? O : never;\n\n /**\n * Extract the service identifier types from an operation's services array.\n * Returns `never` if the operation has no services declared.\n */\n export type Services<T extends Any> = T extends Variance<infer _I, infer _O, infer S> ? S : never;\n\n export type HandlerType<T extends Any> =\n T extends Variance<infer I, infer O, infer S> ? Handler<I, O, any, S> : never;\n}\n\n/**\n * Runtime handler for an Operation.\n */\nexport type Handler<I, O, E = Error, R = never> = (input: I) => Effect.Effect<O, E, R>;\n\nexport type WithHandler<T extends Definition.Any> = T & {\n handler: Definition.HandlerType<T>;\n};\n\n/**\n * Checks if a value is an operation definition.\n */\nexport const isOperationDefinition = (value: unknown): value is Definition.Any => {\n return typeof value === 'object' && value !== null && DefinitionTypeId in value;\n};\n\n/**\n * Checks if a value is an operation with a handler.\n */\nexport const isOperationWithHandler = (value: unknown): value is WithHandler<Definition.Any> => {\n return isOperationDefinition(value) && 'handler' in value;\n};\n\n/**a\n * Props for creating an Operation definition.\n * Derived from OperationDefinition with executionMode made optional (defaults to 'async').\n */\nexport type Props<I, O> = Omit<Definition<I, O>, DefinitionTypeId | 'pipe' | 'executionMode' | 'types' | 'services'> & {\n readonly executionMode?: 'sync' | 'async';\n readonly types?: Definition<I, O>['types'];\n readonly services?: Definition<I, O>['services'];\n};\n\n/**\n * Creates a new Operation definition.\n * Applies default executionMode of 'async' if not specified.\n * The returned type preserves the literal types of props (including services).\n */\nexport const make = <const P extends Types.NoExcessProperties<Props<any, any>, P>>(\n props: P,\n): Definition<\n Schema$.Schema.Type<P['input']>,\n Schema$.Schema.Type<P['output']>,\n Context.Tag.Identifier<NonNullable<P['services']>[number]>\n> => {\n return {\n [DefinitionTypeId]: {},\n ...props,\n executionMode: props.executionMode ?? 'async',\n types: props.types ?? [],\n services: props.services ?? [],\n pipe() {\n // eslint-disable-next-line prefer-rest-params\n return Pipeable.pipeArguments(this, arguments);\n },\n } as any;\n};\n\n/**\n * Marks an operation as intrinsic — provided directly by the DXOS platform runtime rather than\n * deployed as a user function. The `intrinsic:<key>` deployedId routes invocations to the\n * built-in implementation registered with the runtime.\n */\nexport const intrinsic = <const O extends Operation.Definition.Any>(op: O): O => {\n return {\n ...op,\n meta: {\n ...op.meta,\n deployedId: `intrinsic:${op.meta.key}`,\n },\n };\n};\n\n/**\n * Attaches a handler to an Operation definition.\n * The handler may use any services declared in the operation, plus Operation.Service (always available).\n * Dual API: can be called directly or used in a pipe.\n *\n * @example\n * ```ts\n * const MyOp = Operation.make({\n * input: Schema.Void,\n * output: Schema.Void,\n * meta: { key: 'my-op' },\n * services: [DatabaseService],\n * });\n *\n * // Direct call - handler can use DatabaseService\n * const op = Operation.withHandler(MyOp, (input) =>\n * Effect.gen(function* () {\n * const db = yield* DatabaseService;\n * return {};\n * }),\n * );\n *\n * // Piped call\n * const op = MyOp.pipe(Operation.withHandler((input) => Effect.succeed({})));\n * ```\n */\nexport const withHandler: {\n <Def extends Definition<any, any>, E = never>(\n handler: Handler<Definition.Input<Def>, Definition.Output<Def>, E, Definition.Services<Def> | Service>,\n ): (op: Def) => WithHandler<Def>;\n <Def extends Definition<any, any>, E = never>(\n op: Def,\n handler: Handler<Definition.Input<Def>, Definition.Output<Def>, E, Definition.Services<Def> | Service>,\n ): WithHandler<Def>;\n} = <Def extends Definition<any, any>, E = never>(\n opOrHandler: Def | Handler<Definition.Input<Def>, Definition.Output<Def>, E, Definition.Services<Def> | Service>,\n handler?: Handler<Definition.Input<Def>, Definition.Output<Def>, E, Definition.Services<Def> | Service>,\n): WithHandler<Def> => {\n // If called with just handler (piped usage).\n if (handler === undefined) {\n const handlerFn = opOrHandler as Handler<\n Definition.Input<Def>,\n Definition.Output<Def>,\n E,\n Definition.Services<Def> | Service\n >;\n return ((op: Def) => ({\n ...op,\n handler: handlerFn,\n })) as any;\n }\n\n // If called with both op and handler (direct usage).\n const op = opOrHandler as Def;\n return {\n ...op,\n handler,\n } as any;\n};\n\n/**\n * Helper to make the handler type opaque.\n * Workaround for TypeScript's inability to infer the handler type from the operation definition:\n * ```\n * error TS2742: The inferred type of 'default' cannot be named without a reference.\n * ```\n *\n * Most of the time the exact handler type is not needed.\n *\n * @example\n * ```ts\n * const MyOp = Operation.make({\n * input: Schema.Void,\n * output: Schema.Void,\n * meta: { key: 'my-op' },\n * services: [DatabaseService],\n * });\n *\n * export default MyOp.pipe(\n * Operation.withHandler(\n * Effect.fn(function* (input) {\n * return { result: 'ok' };\n * }),\n * ),\n * Operation.opaqueHandler,\n * );\n * ```\n */\nexport const opaqueHandler = <T extends Operation.Definition.Any>(\n handler: Operation.WithHandler<T>,\n): Operation.WithHandler<Operation.Definition.Any> => handler;\n\n//\n// Invocation Interfaces\n//\n\n/**\n * Local invocation of an operation.\n */\nexport type Invoke = <I, O, E>(op: Definition<I, O>, input: I) => Effect.Effect<O, E>;\n\n/**\n * Remote invocation of an operation.\n */\nexport type InvokeRemote = <I, O, E>(\n op: Definition<I, O>,\n input: I,\n options?: { timeout?: number },\n) => Effect.Effect<O, E>;\n\n/**\n * Database record of an operation.\n */\nexport const PersistentOperation = 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(Ref.Ref(Obj.Unknown)),\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 // TODO(dmaretskyi): Add this field to Operation.Definition.\n binding: Schema$.optional(Schema$.String),\n}).pipe(\n // TODO(dmaretskyi): Keep typename as 'org.dxos.type.function' (not 'operation') to maintain\n // backward compatibility with existing data and avoid requiring data migration.\n Type.object({\n typename: 'org.dxos.type.function',\n version: '0.1.0',\n }),\n Annotation.LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({ icon: 'ph--function--regular', hue: 'blue' }),\n Annotation.SystemTypeAnnotation.set(true),\n);\nexport interface PersistentOperation extends Schema$.Schema.Type<typeof PersistentOperation> {}\n\nconst FUNCTION_META_KEY = 'org.dxos.service.function';\n\n/**\n * Serialize an operation definition to a persistent operation record.\n */\nexport const serialize = (operation: Definition.Any): PersistentOperation => {\n return Obj.make(PersistentOperation, {\n [Obj.Meta]: {\n keys: operation.meta.deployedId ? [{ source: FUNCTION_META_KEY, id: operation.meta.deployedId }] : [],\n },\n key: operation.meta.key,\n name: operation.meta.name ?? '',\n version: operation.meta.version ?? '0.0.0',\n description: operation.meta.description,\n updated: undefined,\n source: undefined,\n inputSchema: JsonSchema.toJsonSchema(operation.input),\n outputSchema: JsonSchema.toJsonSchema(operation.output),\n services: operation.services.map((service) => service.key),\n });\n};\n\n/**\n * Deserialize a persistent operation record to an operation definition.\n */\nexport const deserialize = (record: PersistentOperation): Definition.Any => {\n // Extract deployed function ID from ECHO meta keys (matches FUNCTIONS_META_KEY in @dxos/functions).\n const deployedId = Obj.getMeta(record).keys.find((key) => key.source === FUNCTION_META_KEY)?.id;\n return make({\n input: record.inputSchema ? JsonSchema.toEffectSchema(record.inputSchema) : Schema$.Unknown,\n output: record.outputSchema ? JsonSchema.toEffectSchema(record.outputSchema) : Schema$.Unknown,\n services: record.services?.map((service) => Context.GenericTag(service)) ?? [],\n executionMode: 'async',\n types: [],\n meta: {\n key: record.key ?? record.name,\n name: record.name,\n version: record.version,\n description: record.description,\n deployedId,\n },\n });\n};\n\n/**\n * Update properties on the target operation record from the source operation record.\n */\nexport const setFrom = (target: PersistentOperation, source: PersistentOperation) => {\n Obj.update(target, (target) => {\n target.key = source.key ?? target.key;\n target.name = source.name ?? target.name;\n target.version = source.version;\n target.description = source.description;\n target.updated = source.updated;\n // TODO(dmaretskyi): A workaround for an ECHO bug.\n target.inputSchema = source.inputSchema ? JSON.parse(JSON.stringify(source.inputSchema)) : undefined;\n target.outputSchema = source.outputSchema ? JSON.parse(JSON.stringify(source.outputSchema)) : undefined;\n Obj.getMeta(target).keys = JSON.parse(JSON.stringify(Obj.getMeta(source).keys));\n });\n};\n\n/**\n * Options for operation invocation.\n */\nexport interface InvokeOptions {\n /**\n * Space ID to provide database context for the handler.\n */\n spaceId?: Key.SpaceId;\n /**\n * DXN string of the conversation feed (queue).\n * Passed to the process environment so nested operations can resolve AiContextService and related services.\n */\n conversation?: DXN.String;\n /**\n * Optional process-runtime tracing metadata (consumed by `@dxos/functions-runtime` when wired).\n */\n tracing?: unknown;\n}\n\n/**\n * Operation service interface - provides unified access to operation invocation and scheduling.\n * This service is automatically provided to operation handlers.\n */\nexport interface OperationService {\n /**\n * Invoke an operation as an Effect.\n * Returns an Effect that resolves to the operation output.\n */\n invoke: <I, O>(\n op: Operation.Definition<I, O>,\n ...args: void extends I ? [input?: I, options?: InvokeOptions] : [input: I, options?: InvokeOptions]\n ) => Effect.Effect<O, NoHandlerError>;\n\n /**\n * Schedule an operation to run as a followup.\n * The followup is tracked and won't be cancelled when the parent operation completes.\n * Returns an Effect that completes immediately after scheduling.\n */\n schedule: <I, O>(\n op: Operation.Definition<I, O>,\n ...args: void extends I ? [input?: I] : [input: I]\n ) => Effect.Effect<void>;\n\n /**\n * Invoke an operation and return a Promise.\n * Useful for async contexts where Effect is not available.\n */\n invokePromise: <I, O>(\n op: Operation.Definition<I, O>,\n ...args: void extends I ? [input?: I, options?: InvokeOptions] : [input: I, options?: InvokeOptions]\n ) => Promise<{ data?: O; error?: Error }>;\n}\n\n/**\n * Context tag for the Operation service.\n * Operation handlers can yield this to invoke other operations or schedule followups.\n *\n * @example\n * ```ts\n * const handler = (input) => Effect.gen(function* () {\n * // Schedule a followup (fire and forget)\n * yield* Operation.schedule(AnalyticsOperation, { event: 'completed' });\n *\n * // Invoke another operation\n * return yield* Operation.invoke(OtherOperation, { data: input.data });\n * });\n * ```\n */\n// TODO(dmaretskyi): Rename Operation.Invoker\nexport class Service extends Context.Tag('@dxos/operation/Service')<Service, OperationService>() {}\n\n//\n// Namespace functions - ergonomic access to Operation.Service methods.\n//\n\n/**\n * Invoke an operation as an Effect.\n * Yields the Operation.Service internally.\n *\n * @example\n * ```ts\n * yield* Operation.invoke(MyOperation, { data: 'test' });\n * ```\n */\nexport const invoke = <I, O>(\n op: Operation.Definition<I, O>,\n ...args: void extends I ? [input?: I, options?: InvokeOptions] : [input: I, options?: InvokeOptions]\n): Effect.Effect<O, NoHandlerError, Service> =>\n Effect.flatMap(Service, (ops) => ops.invoke(op, ...(args as [I, InvokeOptions?]))).pipe(\n Effect.withSpan('Operation.invoke'),\n );\n\n/**\n * Schedule an operation to run as a followup.\n * Yields the Operation.Service internally.\n *\n * @example\n * ```ts\n * yield* Operation.schedule(AnalyticsOperation, { event: 'completed' });\n * yield* Operation.schedule(VoidOperation); // input optional when void\n * ```\n */\nexport const schedule = <I, O>(\n op: Operation.Definition<I, O>,\n ...args: void extends I ? [input?: I] : [input: I]\n): Effect.Effect<void, never, Service> =>\n Effect.flatMap(Service, (ops) => ops.schedule(op, args[0] as I)).pipe(Effect.withSpan('Operation.schedule'));\n\n/**\n * Provides additional invocation options to all invocations.\n */\nexport const withInvocationOptions = (options: InvokeOptions): Layer.Layer<Service, never, Service> =>\n Layer.effect(\n Service,\n Effect.gen(function* () {\n const service = yield* Service;\n return Service.of({\n invoke: ((op: Operation.Definition.Any, input: any, invocationOptions: InvokeOptions) =>\n service.invoke(op, input, { ...options, ...invocationOptions })) as any,\n invokePromise: ((op: Operation.Definition.Any, input: any, invocationOptions: InvokeOptions) =>\n service.invokePromise(op, input, { ...options, ...invocationOptions })) as any,\n schedule: service.schedule,\n });\n }),\n );\n"],
5
+ "mappings": "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",
6
+ "names": ["Context", "Effect", "Layer", "Pipeable", "Schema$", "Annotation", "JsonSchema", "Obj", "Ref", "Type", "DefinitionTypeId", "isOperationDefinition", "value", "isOperationWithHandler", "make", "props", "executionMode", "types", "services", "pipe", "pipeArguments", "arguments", "intrinsic", "op", "meta", "deployedId", "key", "withHandler", "opOrHandler", "handler", "undefined", "handlerFn", "opaqueHandler", "PersistentOperation", "Struct", "optional", "String", "annotations", "description", "name", "NonEmptyString", "version", "updated", "source", "Unknown", "inputSchema", "outputSchema", "Array", "binding", "object", "typename", "LabelAnnotation", "set", "IconAnnotation", "icon", "hue", "SystemTypeAnnotation", "FUNCTION_META_KEY", "serialize", "operation", "Meta", "keys", "id", "toJsonSchema", "input", "output", "map", "service", "deserialize", "record", "getMeta", "find", "toEffectSchema", "GenericTag", "setFrom", "target", "update", "JSON", "parse", "stringify", "Service", "Tag", "invoke", "args", "flatMap", "ops", "withSpan", "schedule", "withInvocationOptions", "options", "effect", "gen", "of", "invocationOptions", "invokePromise"]
7
+ }