@dxos/compute 0.8.4-main.a4bbb77 → 0.8.4-main.abd8ff62ef

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/README.md +36 -1
  2. package/dist/lib/neutral/StorageService.mjs +22 -0
  3. package/dist/lib/neutral/chunk-4N4JAXCP.mjs +17 -0
  4. package/dist/lib/neutral/chunk-4N4JAXCP.mjs.map +7 -0
  5. package/dist/lib/neutral/chunk-DDEBBRCI.mjs +62 -0
  6. package/dist/lib/neutral/chunk-DDEBBRCI.mjs.map +7 -0
  7. package/dist/lib/neutral/chunk-FEABF5XY.mjs +25 -0
  8. package/dist/lib/neutral/chunk-FEABF5XY.mjs.map +7 -0
  9. package/dist/lib/neutral/chunk-H6EHIVDN.mjs +21 -0
  10. package/dist/lib/neutral/chunk-H6EHIVDN.mjs.map +7 -0
  11. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  12. package/dist/lib/neutral/chunk-N462A6NO.mjs +138 -0
  13. package/dist/lib/neutral/chunk-N462A6NO.mjs.map +7 -0
  14. package/dist/lib/neutral/chunk-QPCDM7MF.mjs +179 -0
  15. package/dist/lib/neutral/chunk-QPCDM7MF.mjs.map +7 -0
  16. package/dist/lib/neutral/chunk-S24LL2D5.mjs +52 -0
  17. package/dist/lib/neutral/chunk-S24LL2D5.mjs.map +7 -0
  18. package/dist/lib/neutral/fib-HDHBZHPE.mjs +10 -0
  19. package/dist/lib/neutral/fib-HDHBZHPE.mjs.map +7 -0
  20. package/dist/lib/neutral/index.mjs +1034 -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-XSQMXAPX.mjs +10 -0
  24. package/dist/lib/neutral/reply-XSQMXAPX.mjs.map +7 -0
  25. package/dist/lib/neutral/sleep-WHTJQ56P.mjs +10 -0
  26. package/dist/lib/neutral/sleep-WHTJQ56P.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 +148 -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/Operation.d.ts +303 -0
  34. package/dist/types/src/Operation.d.ts.map +1 -0
  35. package/dist/types/src/OperationHandlerSet.d.ts +60 -0
  36. package/dist/types/src/OperationHandlerSet.d.ts.map +1 -0
  37. package/dist/types/src/OperationRegistry.d.ts +23 -0
  38. package/dist/types/src/OperationRegistry.d.ts.map +1 -0
  39. package/dist/types/src/Process.d.ts +247 -0
  40. package/dist/types/src/Process.d.ts.map +1 -0
  41. package/dist/types/src/Routine.d.ts +61 -0
  42. package/dist/types/src/Routine.d.ts.map +1 -0
  43. package/dist/types/src/Script.d.ts +22 -0
  44. package/dist/types/src/Script.d.ts.map +1 -0
  45. package/dist/types/src/ServiceResolver.d.ts +74 -0
  46. package/dist/types/src/ServiceResolver.d.ts.map +1 -0
  47. package/dist/types/src/StorageService.d.ts +58 -0
  48. package/dist/types/src/StorageService.d.ts.map +1 -0
  49. package/dist/types/src/Template.d.ts +56 -0
  50. package/dist/types/src/Template.d.ts.map +1 -0
  51. package/dist/types/src/Trace.d.ts +174 -0
  52. package/dist/types/src/Trace.d.ts.map +1 -0
  53. package/dist/types/src/Trigger.d.ts +150 -0
  54. package/dist/types/src/Trigger.d.ts.map +1 -0
  55. package/dist/types/src/TriggerEvent.d.ts +75 -0
  56. package/dist/types/src/TriggerEvent.d.ts.map +1 -0
  57. package/dist/types/src/errors.d.ts +239 -0
  58. package/dist/types/src/errors.d.ts.map +1 -0
  59. package/dist/types/src/index.d.ts +15 -5
  60. package/dist/types/src/index.d.ts.map +1 -1
  61. package/dist/types/src/testing/definitions.d.ts +11 -0
  62. package/dist/types/src/testing/definitions.d.ts.map +1 -0
  63. package/dist/types/src/testing/fib.d.ts +8 -0
  64. package/dist/types/src/testing/fib.d.ts.map +1 -0
  65. package/dist/types/src/testing/index.d.ts +6 -3
  66. package/dist/types/src/testing/index.d.ts.map +1 -1
  67. package/dist/types/src/testing/reply.d.ts +4 -0
  68. package/dist/types/src/testing/reply.d.ts.map +1 -0
  69. package/dist/types/src/testing/sleep.d.ts +6 -0
  70. package/dist/types/src/testing/sleep.d.ts.map +1 -0
  71. package/dist/types/src/umbrella.test.d.ts +2 -0
  72. package/dist/types/src/umbrella.test.d.ts.map +1 -0
  73. package/dist/types/tsconfig.tsbuildinfo +1 -1
  74. package/package.json +27 -39
  75. package/src/Blueprint.ts +221 -0
  76. package/src/Credential.ts +51 -0
  77. package/src/Operation.ts +513 -0
  78. package/src/OperationHandlerSet.ts +132 -0
  79. package/src/OperationRegistry.ts +48 -0
  80. package/src/Process.ts +490 -0
  81. package/src/Routine.ts +84 -0
  82. package/src/Script.ts +38 -0
  83. package/src/ServiceResolver.ts +174 -0
  84. package/src/StorageService.ts +99 -0
  85. package/src/Template.ts +105 -0
  86. package/src/Trace.ts +231 -0
  87. package/src/Trigger.ts +207 -0
  88. package/src/TriggerEvent.ts +62 -0
  89. package/src/errors.ts +50 -0
  90. package/src/index.ts +16 -33
  91. package/src/testing/definitions.ts +49 -0
  92. package/src/testing/fib.ts +22 -0
  93. package/src/testing/index.ts +13 -4
  94. package/src/testing/reply.ts +18 -0
  95. package/src/testing/sleep.ts +16 -0
  96. package/src/umbrella.test.ts +51 -0
  97. package/dist/lib/browser/chunk-XQYPCRZP.mjs +0 -3140
  98. package/dist/lib/browser/chunk-XQYPCRZP.mjs.map +0 -7
  99. package/dist/lib/browser/index.mjs +0 -55
  100. package/dist/lib/browser/meta.json +0 -1
  101. package/dist/lib/browser/testing/index.mjs +0 -186
  102. package/dist/lib/browser/testing/index.mjs.map +0 -7
  103. package/dist/lib/node-esm/chunk-2XWWSGAU.mjs +0 -3142
  104. package/dist/lib/node-esm/chunk-2XWWSGAU.mjs.map +0 -7
  105. package/dist/lib/node-esm/index.mjs +0 -56
  106. package/dist/lib/node-esm/meta.json +0 -1
  107. package/dist/lib/node-esm/testing/index.mjs +0 -187
  108. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  109. package/dist/types/src/compute-graph-registry.d.ts +0 -32
  110. package/dist/types/src/compute-graph-registry.d.ts.map +0 -1
  111. package/dist/types/src/compute-graph.d.ts +0 -64
  112. package/dist/types/src/compute-graph.d.ts.map +0 -1
  113. package/dist/types/src/compute-graph.test.d.ts +0 -2
  114. package/dist/types/src/compute-graph.test.d.ts.map +0 -1
  115. package/dist/types/src/compute-node.d.ts +0 -24
  116. package/dist/types/src/compute-node.d.ts.map +0 -1
  117. package/dist/types/src/functions/async-function.d.ts +0 -66
  118. package/dist/types/src/functions/async-function.d.ts.map +0 -1
  119. package/dist/types/src/functions/edge-function.d.ts +0 -20
  120. package/dist/types/src/functions/edge-function.d.ts.map +0 -1
  121. package/dist/types/src/functions/function-defs.d.ts +0 -11
  122. package/dist/types/src/functions/function-defs.d.ts.map +0 -1
  123. package/dist/types/src/functions/index.d.ts +0 -4
  124. package/dist/types/src/functions/index.d.ts.map +0 -1
  125. package/dist/types/src/hyperformula.test.d.ts +0 -2
  126. package/dist/types/src/hyperformula.test.d.ts.map +0 -1
  127. package/dist/types/src/testing/test-builder.d.ts +0 -15
  128. package/dist/types/src/testing/test-builder.d.ts.map +0 -1
  129. package/dist/types/src/testing/test-plugin.d.ts +0 -35
  130. package/dist/types/src/testing/test-plugin.d.ts.map +0 -1
  131. package/dist/types/src/testing/util.d.ts +0 -2
  132. package/dist/types/src/testing/util.d.ts.map +0 -1
  133. package/dist/types/src/types/hyperformula.d.ts +0 -8
  134. package/dist/types/src/types/hyperformula.d.ts.map +0 -1
  135. package/dist/types/src/types/index.d.ts +0 -3
  136. package/dist/types/src/types/index.d.ts.map +0 -1
  137. package/dist/types/src/types/types.d.ts +0 -20
  138. package/dist/types/src/types/types.d.ts.map +0 -1
  139. package/dist/types/src/types/types.test.d.ts +0 -2
  140. package/dist/types/src/types/types.test.d.ts.map +0 -1
  141. package/dist/types/src/util.d.ts +0 -2
  142. package/dist/types/src/util.d.ts.map +0 -1
  143. package/src/compute-graph-registry.ts +0 -88
  144. package/src/compute-graph.test.ts +0 -88
  145. package/src/compute-graph.ts +0 -258
  146. package/src/compute-node.ts +0 -59
  147. package/src/functions/async-function.ts +0 -183
  148. package/src/functions/edge-function.ts +0 -111
  149. package/src/functions/function-defs.ts +0 -2427
  150. package/src/functions/index.ts +0 -7
  151. package/src/hyperformula.test.ts +0 -14
  152. package/src/testing/test-builder.ts +0 -54
  153. package/src/testing/test-plugin.ts +0 -98
  154. package/src/testing/util.ts +0 -9
  155. package/src/types/hyperformula.ts +0 -19
  156. package/src/types/index.ts +0 -6
  157. package/src/types/types.test.ts +0 -91
  158. package/src/types/types.ts +0 -80
  159. package/src/util.ts +0 -8
  160. /package/dist/lib/{browser/index.mjs.map → neutral/StorageService.mjs.map} +0 -0
  161. /package/dist/lib/{node-esm/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
@@ -0,0 +1,61 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import { Ref, Type } from '@dxos/echo';
3
+ import * as Blueprint from './Blueprint';
4
+ /**
5
+ * Executable instructions, which may use Blueprints.
6
+ * May reference additional context.
7
+ */
8
+ export declare const Routine: Type.Obj<{
9
+ readonly name?: string | undefined;
10
+ readonly description?: string | undefined;
11
+ readonly input: import("@dxos/echo/internal").JsonSchemaType;
12
+ readonly output: import("@dxos/echo/internal").JsonSchemaType;
13
+ readonly instructions: {
14
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
15
+ readonly name?: string | undefined;
16
+ readonly content: string;
17
+ }>;
18
+ readonly inputs?: readonly {
19
+ readonly name: string;
20
+ readonly kind?: "context" | "function" | "pass-through" | "query" | "resolver" | "retriever" | "schema" | "value" | undefined;
21
+ readonly default?: any;
22
+ readonly function?: string | undefined;
23
+ }[] | undefined;
24
+ };
25
+ readonly blueprints: readonly import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
26
+ readonly key: string;
27
+ readonly name: string;
28
+ readonly description?: string | undefined;
29
+ readonly instructions: {
30
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
31
+ readonly name?: string | undefined;
32
+ readonly content: string;
33
+ }>;
34
+ readonly inputs?: readonly {
35
+ readonly name: string;
36
+ readonly kind?: "context" | "function" | "pass-through" | "query" | "resolver" | "retriever" | "schema" | "value" | undefined;
37
+ readonly default?: any;
38
+ readonly function?: string | undefined;
39
+ }[] | undefined;
40
+ };
41
+ readonly tools: readonly (string & import("effect/Brand").Brand<"ToolId">)[];
42
+ readonly agentCanEnable?: boolean | undefined;
43
+ readonly mcpServers?: readonly {
44
+ readonly url: string;
45
+ readonly protocol: "http" | "sse";
46
+ }[] | undefined;
47
+ }>[];
48
+ readonly context: readonly any[];
49
+ }, Schema.Struct.Fields>;
50
+ export interface Routine extends Schema.Schema.Type<typeof Routine> {
51
+ }
52
+ export declare const make: (params: {
53
+ name?: string;
54
+ description?: string;
55
+ input?: Schema.Schema.AnyNoContext;
56
+ output?: Schema.Schema.AnyNoContext;
57
+ instructions?: string;
58
+ blueprints?: Ref.Ref<Blueprint.Blueprint>[];
59
+ context?: any[];
60
+ }) => Routine;
61
+ //# sourceMappingURL=Routine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Routine.d.ts","sourceRoot":"","sources":["../../../src/Routine.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAA+B,GAAG,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAGzC;;;GAGG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA+CnB,CAAC;AAEF,MAAM,WAAW,OAAQ,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC;CAAG;AAEtE,eAAO,MAAM,IAAI,WAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC;IAC5C,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;CACjB,KAAG,OASA,CAAC"}
@@ -0,0 +1,22 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import { Obj, Type } from '@dxos/echo';
3
+ /**
4
+ * Source script.
5
+ */
6
+ export declare const Script: Type.Obj<{
7
+ readonly name?: string | undefined;
8
+ readonly description?: string | undefined;
9
+ readonly changed?: boolean | undefined;
10
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
11
+ readonly name?: string | undefined;
12
+ readonly content: string;
13
+ }>;
14
+ }, Schema.Struct.Fields>;
15
+ export interface Script extends Schema.Schema.Type<typeof Script> {
16
+ }
17
+ type Props = Omit<Obj.MakeProps<typeof Script>, 'source'> & {
18
+ source?: string;
19
+ };
20
+ export declare const make: ({ source, ...props }?: Props) => Script;
21
+ export {};
22
+ //# sourceMappingURL=Script.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Script.d.ts","sourceRoot":"","sources":["../../../src/Script.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAc,GAAG,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AAIxD;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;;;;wBAiBlB,CAAC;AAEF,MAAM,WAAW,MAAO,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,MAAM,CAAC;CAAG;AAEpE,KAAK,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,eAAO,MAAM,IAAI,0BAA+B,KAAK,KAAQ,MACqB,CAAC"}
@@ -0,0 +1,74 @@
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ import * as Layer from 'effect/Layer';
4
+ import * as Scope from 'effect/Scope';
5
+ import type { DXN, SpaceId } from '@dxos/keys';
6
+ import { ServiceNotAvailableError } from './errors';
7
+ import * as Process from './Process';
8
+ declare const ServiceResolverTypeId: '~@dxos/functions/ServiceResolver';
9
+ type ServiceResolverTypeId = typeof ServiceResolverTypeId;
10
+ export interface ServiceResolver {
11
+ readonly [ServiceResolverTypeId]: ServiceResolverTypeId;
12
+ /**
13
+ * Resolve a set of services identified by their tags.
14
+ * Returns a Context containing all requested services, or fails with ServiceNotAvailableError.
15
+ */
16
+ resolve<Tag extends Context.Tag<any, any>>(tag: Tag, context: ResolutionContext): Effect.Effect<Context.Tag.Service<Tag>, ServiceNotAvailableError, Scope.Scope>;
17
+ }
18
+ /**
19
+ * Tag for the ServiceResolver service.
20
+ */
21
+ export declare const ServiceResolver: Context.Tag<ServiceResolver, ServiceResolver>;
22
+ export declare const resolve: <Tag extends Context.Tag<any, any>>(tag: Tag, context: ResolutionContext) => Effect.Effect<Context.Tag.Service<Tag>, ServiceNotAvailableError, Scope.Scope | ServiceResolver>;
23
+ export declare const resolveAll: <const Tags extends readonly Context.Tag<any, any>[]>(tags: Tags, context: ResolutionContext) => Effect.Effect<Context.Context<Tags[number]>, ServiceNotAvailableError, Scope.Scope | ServiceResolver>;
24
+ /**
25
+ * Provides context for service resolution.
26
+ */
27
+ export interface ResolutionContext {
28
+ /**
29
+ * Under which identity the process is running.
30
+ */
31
+ readonly identity?: string;
32
+ /**
33
+ * Under which space the process is running.
34
+ */
35
+ readonly space?: SpaceId;
36
+ /**
37
+ * DXN of the conversation feed the process is running in.
38
+ */
39
+ readonly conversation?: DXN.String;
40
+ /**
41
+ * Under which process the process is running.
42
+ */
43
+ readonly process?: Process.ID;
44
+ }
45
+ export declare const succeed: <I, S>(tag: Context.Tag<I, S>, getService: (context: ResolutionContext) => Effect.Effect<S, ServiceNotAvailableError, Scope.Scope>) => ServiceResolver;
46
+ /**
47
+ * Create a ServiceResolver from a custom resolution function.
48
+ */
49
+ export declare const make: (resolveFn: <I, S>(tag: Context.Tag<I, S>, context: ResolutionContext) => Effect.Effect<S, ServiceNotAvailableError, Scope.Scope>) => ServiceResolver;
50
+ /**
51
+ * Create a ServiceResolver backed by a static Context.
52
+ * Tags present in the context are resolved; missing tags fail with ServiceNotAvailableError.
53
+ */
54
+ export declare const fromContext: (ctx: Context.Context<any>) => ServiceResolver;
55
+ /**
56
+ * Create a ServiceResolver that resolves tags from the current Effect context.
57
+ * Only the specified tags are available; requests for other tags fail.
58
+ */
59
+ export declare const fromRequirements: <const Tags extends readonly Context.Tag<any, any>[]>(...tags: Tags) => Effect.Effect<ServiceResolver, never, Context.Tag.Identifier<Tags[number]>>;
60
+ /**
61
+ * Like {@link fromRequirements} but returns a Layer that provides ServiceResolver.
62
+ */
63
+ export declare const layerRequirements: <const Tags extends readonly Context.Tag<any, any>[]>(...tags: Tags) => Layer.Layer<ServiceResolver, never, Context.Tag.Identifier<Tags[number]>>;
64
+ /**
65
+ * Compose multiple resolvers left to right. Earlier resolvers take precedence:
66
+ * the first resolver that can satisfy a tag wins.
67
+ */
68
+ export declare const compose: (...resolvers: readonly ServiceResolver[]) => ServiceResolver;
69
+ /**
70
+ * An empty resolver that fails for any requested service.
71
+ */
72
+ export declare const empty: ServiceResolver;
73
+ export {};
74
+ //# sourceMappingURL=ServiceResolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServiceResolver.d.ts","sourceRoot":"","sources":["../../../src/ServiceResolver.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,QAAA,MAAM,qBAAqB,EAAG,kCAA2C,CAAC;AAC1E,KAAK,qBAAqB,GAAG,OAAO,qBAAqB,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,CAAC,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAExD;;;OAGG;IACH,OAAO,CAAC,GAAG,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EACvC,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,iBAAiB,GACzB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,wBAAwB,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;CACnF;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,+CAAyE,CAAC;AAEtG,eAAO,MAAM,OAAO,GAXV,GAAG,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,2IAW2C,CAAC;AAEvF,eAAO,MAAM,UAAU,GAAI,KAAK,CAAC,IAA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AAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,WACzE,IAAI,KACZ,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAgBzE,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,CAAC,IAAI,SAAS,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,WAC1E,IAAI,KACZ,KAAK,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CACjB,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,OAAO,iBAAkB,SAAS,eAAe,EAAE,KAAG,eAYhE,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,eAElB,CAAC"}
@@ -0,0 +1,58 @@
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ import * as Option from 'effect/Option';
4
+ import * as Pipeable from 'effect/Pipeable';
5
+ import * as Schema from 'effect/Schema';
6
+ export interface Service {
7
+ /** Read a value by key. Returns `None` if key does not exist. */
8
+ get<S extends Schema.Schema<any, string, any>>(schema: S, key: string): Effect.Effect<Option.Option<Schema.Schema.Type<S>>, never, Schema.Schema.Context<S>>;
9
+ /** Write a value for the given key. */
10
+ set<S extends Schema.Schema<any, string, any>>(schema: S, key: string, value: Schema.Schema.Type<S>): Effect.Effect<void, never, Schema.Schema.Context<S>>;
11
+ /** Remove a key. */
12
+ delete(key: string): Effect.Effect<void>;
13
+ /** List all keys, optionally filtered by prefix. */
14
+ list(prefix?: string): Effect.Effect<readonly string[]>;
15
+ /** Remove all keys managed by this scoped store. */
16
+ clear(): Effect.Effect<void>;
17
+ }
18
+ declare const StorageService_base: Context.TagClass<StorageService, "@dxos/functions/StorageService", Service>;
19
+ /**
20
+ * Scoped key-value storage service for processes.
21
+ * Each process receives its own namespaced instance via the process manager.
22
+ * Construct a live implementation with `StorageService.layer` from `@dxos/functions-runtime`.
23
+ */
24
+ export declare class StorageService extends StorageService_base {
25
+ }
26
+ export declare const get: <S extends Schema.Schema<any, string, any>>(schema: S, key: string) => Effect.Effect<Option.Option<Schema.Schema.Type<S>>, never, StorageService | Schema.Schema.Context<S>>;
27
+ export declare const set: <S extends Schema.Schema<any, string, any>>(schema: S, key: string, value: Schema.Schema.Type<S>) => Effect.Effect<void, never, StorageService | Schema.Schema.Context<S>>;
28
+ export declare const deleteKey: (key: string) => Effect.Effect<void, never, StorageService>;
29
+ export declare const list: (prefix?: string | undefined) => Effect.Effect<readonly string[], never, StorageService>;
30
+ export declare const clear: () => Effect.Effect<void, never, StorageService>;
31
+ /**
32
+ * Typed key in a storage service.
33
+ */
34
+ export interface Key<T> extends Pipeable.Pipeable {
35
+ readonly key: string;
36
+ get: Effect.Effect<Option.Option<T>, never, StorageService>;
37
+ set(value: T): Effect.Effect<void, never, StorageService>;
38
+ delete(): Effect.Effect<void, never, StorageService>;
39
+ }
40
+ /**
41
+ * Create a typed key in a storage service.
42
+ */
43
+ export declare const key: <S extends Schema.Schema<any, string, any>>(schema: S, key: string) => Key<Schema.Schema.Type<S>>;
44
+ /**
45
+ * Typed key in a storage service with a default value.
46
+ */
47
+ export interface KeyWithDefault<T, U> extends Pipeable.Pipeable {
48
+ readonly key: string;
49
+ get: Effect.Effect<T | U, never, StorageService>;
50
+ set(value: U): Effect.Effect<void, never, StorageService>;
51
+ delete(): Effect.Effect<void, never, StorageService>;
52
+ }
53
+ /**
54
+ * Assign a default value to a key if it is not present.
55
+ */
56
+ export declare const withDefault: <T>(getDefault: () => NoInfer<T>) => (key: Key<T>) => KeyWithDefault<T, T>;
57
+ export {};
58
+ //# sourceMappingURL=StorageService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageService.d.ts","sourceRoot":"","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AAG,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;IACjD,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;IAC1D,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;CACtD;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,GACrB,CAAC,cAAc,MAAM,OAAO,CAAC,CAAC,CAAC,WAC1B,GAAG,CAAC,CAAC,CAAC,KAAG,cAAc,CAAC,CAAC,EAAE,CAAC,CAUjC,CAAC"}
@@ -0,0 +1,56 @@
1
+ import * as Effect from 'effect/Effect';
2
+ import * as Schema from 'effect/Schema';
3
+ import type { ObjectNotFoundError } from '@dxos/echo/Err';
4
+ import { FunctionNotFoundError } from './errors';
5
+ import * as Operation from './Operation';
6
+ import * as OperationRegistry from './OperationRegistry';
7
+ /**
8
+ * Template input kind determines how template variables are resolved.
9
+ */
10
+ export declare const InputKind: Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>;
11
+ export type InputKind = Schema.Schema.Type<typeof InputKind>;
12
+ /**
13
+ * Template input variable.
14
+ * E.g., {{foo}}
15
+ */
16
+ export declare const Input: Schema.Struct<{
17
+ name: typeof Schema.String;
18
+ kind: Schema.optional<Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>>;
19
+ default: Schema.optional<typeof Schema.Any>;
20
+ /**
21
+ * Function to call if the kind is 'function'.
22
+ */
23
+ function: Schema.optional<typeof Schema.String>;
24
+ }>;
25
+ export type Input = Schema.Schema.Type<typeof Input>;
26
+ /**
27
+ * Template type.
28
+ */
29
+ export declare const Template: Schema.Struct<{
30
+ source: Schema.SchemaClass<import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
31
+ readonly name?: string | undefined;
32
+ readonly content: string;
33
+ }>, import("@dxos/echo-protocol").EncodedReference, never>;
34
+ inputs: Schema.optional<Schema.Array$<Schema.Struct<{
35
+ name: typeof Schema.String;
36
+ kind: Schema.optional<Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>>;
37
+ default: Schema.optional<typeof Schema.Any>;
38
+ /**
39
+ * Function to call if the kind is 'function'.
40
+ */
41
+ function: Schema.optional<typeof Schema.String>;
42
+ }>>>;
43
+ }>;
44
+ export interface Template extends Schema.Schema.Type<typeof Template> {
45
+ }
46
+ export declare const make: ({ id, source, inputs, }?: {
47
+ id?: string;
48
+ source?: string;
49
+ inputs?: Input[];
50
+ }) => Template;
51
+ /**
52
+ * Process Handlebars template.
53
+ */
54
+ export declare const process: <Options extends {}>(source: string, variables?: Partial<Options>) => string;
55
+ export declare const processTemplate: (template: Template) => Effect.Effect<string, ObjectNotFoundError | FunctionNotFoundError, OperationRegistry.Service | Operation.Service>;
56
+ //# sourceMappingURL=Template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Template.d.ts","sourceRoot":"","sources":["../../../src/Template.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAK1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,SAAS,8GASrB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;IAKhB;;OAEG;;EAEH,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;QAXnB;;WAEG;;;EAYH,CAAC;AAEH,MAAM,WAAW,QAAS,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC;CAAG;AAExE,eAAO,MAAM,IAAI,6BAId;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;CAAE,KAAQ,QAG3D,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,SAAS,EAAE,UAAU,MAAM,cAAa,OAAO,CAAC,OAAO,CAAC,KAAQ,MAO9F,CAAC;AAEF,eAAO,MAAM,eAAe,aAChB,QAAQ,KACjB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,qBAAqB,EAAE,iBAAiB,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAmB/G,CAAC"}
@@ -0,0 +1,174 @@
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ import * as Layer from 'effect/Layer';
4
+ import * as Schema from 'effect/Schema';
5
+ import { Type } from '@dxos/echo';
6
+ /**
7
+ * Writes ephemeral or persistent events to the trace.
8
+ * Exposed to processes and operations to record events to the trace.
9
+ */
10
+ export interface TraceWriter {
11
+ write<T>(eventType: EventType<T>, payload: NoInfer<T>): void;
12
+ }
13
+ declare const TraceService_base: Context.TagClass<TraceService, "@dxos/functions/TraceService", TraceWriter>;
14
+ /**
15
+ * Service that writes events to the trace.
16
+ * Exposed to processes and operations to record events to the trace.
17
+ */
18
+ export declare class TraceService extends TraceService_base {
19
+ }
20
+ /**
21
+ * Writes an event to the trace.
22
+ */
23
+ export declare function write<T>(eventType: EventType<T>, payload: NoInfer<T>): Effect.Effect<void, never, TraceService>;
24
+ /**
25
+ * Defines an event type for the trace.
26
+ */
27
+ export interface EventType<T> {
28
+ readonly key: string;
29
+ readonly schema: Schema.Schema<T, any>;
30
+ readonly isEphemeral: boolean;
31
+ }
32
+ export declare const EventType: <T>(key: string, opts: {
33
+ schema: Schema.Schema<T, any>;
34
+ isEphemeral: boolean;
35
+ }) => EventType<T>;
36
+ /**
37
+ * Extracts the payload type from an event type.
38
+ */
39
+ export type PayloadType<E extends EventType<any>> = E extends EventType<infer T> ? T : never;
40
+ export declare const Event: Schema.Struct<{
41
+ timestamp: typeof Schema.Number;
42
+ type: typeof Schema.String;
43
+ data: typeof Schema.Unknown;
44
+ }>;
45
+ export interface Event extends Schema.Schema.Type<typeof Event> {
46
+ }
47
+ /**
48
+ * Checks if an event is of a given type.
49
+ */
50
+ export declare const isOfType: <T, E extends Event>(eventType: EventType<T>, event: E) => event is E & {
51
+ data: T;
52
+ };
53
+ /**
54
+ * Metadata on the context of a trace message.
55
+ */
56
+ export declare const Meta: Schema.Struct<{
57
+ pid: Schema.optional<typeof Schema.String>;
58
+ parentPid: Schema.optional<typeof Schema.String>;
59
+ processName: Schema.optional<typeof Schema.String>;
60
+ /**
61
+ * ID of the conversation feed object if present.
62
+ */
63
+ conversationId: Schema.optional<import("@dxos/keys").ObjectIdClass>;
64
+ /**
65
+ * ID of the trigger object if invocation resulted from a trigger.
66
+ */
67
+ triggerId: Schema.optional<import("@dxos/keys").ObjectIdClass>;
68
+ /**
69
+ * ID of the tool call that created the current process.
70
+ */
71
+ toolCallId: Schema.optional<typeof Schema.String>;
72
+ }>;
73
+ export interface Meta extends Schema.Schema.Type<typeof Meta> {
74
+ }
75
+ /**
76
+ * Envelope for a set of events.
77
+ */
78
+ export declare const MessageData: Schema.Struct<{
79
+ meta: Schema.Struct<{
80
+ pid: Schema.optional<typeof Schema.String>;
81
+ parentPid: Schema.optional<typeof Schema.String>;
82
+ processName: Schema.optional<typeof Schema.String>;
83
+ /**
84
+ * ID of the conversation feed object if present.
85
+ */
86
+ conversationId: Schema.optional<import("@dxos/keys").ObjectIdClass>;
87
+ /**
88
+ * ID of the trigger object if invocation resulted from a trigger.
89
+ */
90
+ triggerId: Schema.optional<import("@dxos/keys").ObjectIdClass>;
91
+ /**
92
+ * ID of the tool call that created the current process.
93
+ */
94
+ toolCallId: Schema.optional<typeof Schema.String>;
95
+ }>;
96
+ isEphemeral: typeof Schema.Boolean;
97
+ events: Schema.Array$<Schema.Struct<{
98
+ timestamp: typeof Schema.Number;
99
+ type: typeof Schema.String;
100
+ data: typeof Schema.Unknown;
101
+ }>>;
102
+ }>;
103
+ export interface MessageData extends Schema.Schema.Type<typeof MessageData> {
104
+ }
105
+ export declare const Message: Type.Obj<{
106
+ readonly meta: {
107
+ readonly pid?: string | undefined;
108
+ readonly parentPid?: string | undefined;
109
+ readonly processName?: string | undefined;
110
+ readonly conversationId?: string | undefined;
111
+ readonly triggerId?: string | undefined;
112
+ readonly toolCallId?: string | undefined;
113
+ };
114
+ readonly isEphemeral: boolean;
115
+ readonly events: readonly {
116
+ readonly timestamp: number;
117
+ readonly type: string;
118
+ readonly data: unknown;
119
+ }[];
120
+ }, Schema.Struct.Fields>;
121
+ export interface Message extends Schema.Schema.Type<typeof Message> {
122
+ }
123
+ /**
124
+ * Sink for complete trace messages.
125
+ */
126
+ export interface Sink {
127
+ write(message: Message): void;
128
+ }
129
+ declare const TraceSink_base: Context.TagClass<TraceSink, "@dxos/functions/TraceSink", Sink>;
130
+ /**
131
+ * Sink for complete trace messages.
132
+ * The Process Manager forwards trace messages to it.
133
+ */
134
+ export declare class TraceSink extends TraceSink_base {
135
+ }
136
+ export declare const noopWriter: TraceWriter;
137
+ export declare const writerLayerNoop: Layer.Layer<TraceService>;
138
+ export declare const layerNoop: Layer.Layer<TraceSink>;
139
+ export declare const layerConsole: Layer.Layer<TraceSink>;
140
+ export declare const testTraceService: (opts?: {
141
+ meta?: Meta;
142
+ }) => Layer.Layer<TraceService, never, TraceSink>;
143
+ /**
144
+ * Outcome of an operation invocation.
145
+ */
146
+ export type OperationOutcome = 'success' | 'failure';
147
+ /**
148
+ * Operation invocation started.
149
+ */
150
+ export declare const OperationStart: EventType<{
151
+ readonly key: string;
152
+ readonly name?: string | undefined;
153
+ }>;
154
+ /**
155
+ * Operation invocation ended.
156
+ */
157
+ export declare const OperationEnd: EventType<{
158
+ readonly key: string;
159
+ readonly name?: string | undefined;
160
+ readonly outcome: "failure" | "success";
161
+ readonly error?: string | undefined;
162
+ }>;
163
+ /**
164
+ * Human-readable status update emitted by an agent or operation.
165
+ */
166
+ export declare const StatusUpdate: EventType<{
167
+ readonly message: string;
168
+ }>;
169
+ /**
170
+ * Emit the current human-readable execution status to the trace.
171
+ */
172
+ export declare const emitStatus: (message: string) => Effect.Effect<void, never, TraceService>;
173
+ export {};
174
+ //# sourceMappingURL=Trace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Trace.d.ts","sourceRoot":"","sources":["../../../src/Trace.ts"],"names":[],"mappings":"AAMA,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,EAAmB,IAAI,EAAE,MAAM,YAAY,CAAC;AAGnD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;CAC9D;;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,iBAAwE;CAAG;AAE7G;;GAEG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAA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@@
1
+ import * as Schema from 'effect/Schema';
2
+ import { Feed, Obj, QueryAST, Type, type Query } from '@dxos/echo';
3
+ /**
4
+ * Type discriminator for TriggerType.
5
+ * Every spec has a type field of type TriggerKind that we can use to understand which type we're working with.
6
+ * https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions
7
+ */
8
+ export declare const Kinds: readonly ['email', 'queue', 'subscription', 'timer', 'webhook'];
9
+ export type Kind = (typeof Kinds)[number];
10
+ export declare const EmailSpec: Schema.Struct<{
11
+ kind: Schema.Literal<["email"]>;
12
+ }>;
13
+ export type EmailSpec = Schema.Schema.Type<typeof EmailSpec>;
14
+ /**
15
+ * Construct an Email trigger spec.
16
+ */
17
+ export declare const specEmail: () => EmailSpec;
18
+ export declare const QueueSpec: Schema.Struct<{
19
+ kind: Schema.Literal<["queue"]>;
20
+ queue: Schema.refine<string, typeof Schema.NonEmptyString>;
21
+ }>;
22
+ export type QueueSpec = Schema.Schema.Type<typeof QueueSpec>;
23
+ /**
24
+ * Construct a Queue trigger spec from a queue DXN string.
25
+ */
26
+ export declare const specQueue: (queueDxn: string) => QueueSpec;
27
+ /**
28
+ * Construct a Queue trigger spec from a Feed object.
29
+ */
30
+ export declare const specFeed: (feed: Feed.Feed) => QueueSpec;
31
+ /**
32
+ * Subscription.
33
+ */
34
+ export declare const SubscriptionSpec: Schema.Struct<{
35
+ kind: Schema.Literal<["subscription"]>;
36
+ query: Schema.Struct<{
37
+ raw: Schema.optional<Schema.SchemaClass<string, string, never>>;
38
+ ast: Schema.Schema<QueryAST.QueryFilterClause | QueryAST.QueryFromClause | QueryAST.QueryHierarchyTraversalClause | QueryAST.QueryIncomingReferencesClause | QueryAST.QueryLimitClause | QueryAST.QueryOptionsClause | QueryAST.QueryOrderClause | QueryAST.QueryReferenceTraversalClause | QueryAST.QueryRelationClause | QueryAST.QueryRelationTraversalClause | QueryAST.QuerySelectClause | QueryAST.QuerySetDifferenceClause | QueryAST.QueryUnionClause, QueryAST.QueryFilterClause | QueryAST.QueryFromClause | QueryAST.QueryHierarchyTraversalClause | QueryAST.QueryIncomingReferencesClause | QueryAST.QueryLimitClause | QueryAST.QueryOptionsClause | QueryAST.QueryOrderClause | QueryAST.QueryReferenceTraversalClause | QueryAST.QueryRelationClause | QueryAST.QueryRelationTraversalClause | QueryAST.QuerySelectClause | QueryAST.QuerySetDifferenceClause | QueryAST.QueryUnionClause, never>;
39
+ }>;
40
+ options: Schema.optional<Schema.Struct<{
41
+ deep: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
42
+ delay: Schema.optional<Schema.SchemaClass<number, number, never>>;
43
+ }>>;
44
+ }>;
45
+ export type SubscriptionSpec = Schema.Schema.Type<typeof SubscriptionSpec>;
46
+ /**
47
+ * Construct a Subscription trigger spec from a Query object.
48
+ */
49
+ export declare const specSubscription: (query: Query.Query<any>, options?: {
50
+ deep?: boolean;
51
+ delay?: number;
52
+ }) => SubscriptionSpec;
53
+ /**
54
+ * Cron timer.
55
+ */
56
+ export declare const TimerSpec: Schema.Struct<{
57
+ kind: Schema.Literal<["timer"]>;
58
+ cron: Schema.SchemaClass<string, string, never>;
59
+ }>;
60
+ export type TimerSpec = Schema.Schema.Type<typeof TimerSpec>;
61
+ /**
62
+ * Construct a Timer trigger spec from a cron string.
63
+ */
64
+ export declare const specTimer: (cron: string) => TimerSpec;
65
+ /**
66
+ * Webhook.
67
+ */
68
+ export declare const WebhookSpec: Schema.Struct<{
69
+ kind: Schema.Literal<["webhook"]>;
70
+ method: Schema.optional<Schema.SchemaClass<string, string, never>>;
71
+ port: Schema.optional<Schema.SchemaClass<number, number, never>>;
72
+ }>;
73
+ export type WebhookSpec = Schema.Schema.Type<typeof WebhookSpec>;
74
+ /**
75
+ * Construct a Webhook trigger spec from a method and port.
76
+ */
77
+ export declare const specWebhook: (opts?: {
78
+ method?: string;
79
+ port?: number;
80
+ }) => WebhookSpec;
81
+ /**
82
+ * Trigger schema.
83
+ */
84
+ export declare const Spec: Schema.Union<[Schema.Struct<{
85
+ kind: Schema.Literal<["email"]>;
86
+ }>, Schema.Struct<{
87
+ kind: Schema.Literal<["queue"]>;
88
+ queue: Schema.refine<string, typeof Schema.NonEmptyString>;
89
+ }>, Schema.Struct<{
90
+ kind: Schema.Literal<["subscription"]>;
91
+ query: Schema.Struct<{
92
+ raw: Schema.optional<Schema.SchemaClass<string, string, never>>;
93
+ ast: Schema.Schema<QueryAST.QueryFilterClause | QueryAST.QueryFromClause | QueryAST.QueryHierarchyTraversalClause | QueryAST.QueryIncomingReferencesClause | QueryAST.QueryLimitClause | QueryAST.QueryOptionsClause | QueryAST.QueryOrderClause | QueryAST.QueryReferenceTraversalClause | QueryAST.QueryRelationClause | QueryAST.QueryRelationTraversalClause | QueryAST.QuerySelectClause | QueryAST.QuerySetDifferenceClause | QueryAST.QueryUnionClause, QueryAST.QueryFilterClause | QueryAST.QueryFromClause | QueryAST.QueryHierarchyTraversalClause | QueryAST.QueryIncomingReferencesClause | QueryAST.QueryLimitClause | QueryAST.QueryOptionsClause | QueryAST.QueryOrderClause | QueryAST.QueryReferenceTraversalClause | QueryAST.QueryRelationClause | QueryAST.QueryRelationTraversalClause | QueryAST.QuerySelectClause | QueryAST.QuerySetDifferenceClause | QueryAST.QueryUnionClause, never>;
94
+ }>;
95
+ options: Schema.optional<Schema.Struct<{
96
+ deep: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
97
+ delay: Schema.optional<Schema.SchemaClass<number, number, never>>;
98
+ }>>;
99
+ }>, Schema.Struct<{
100
+ kind: Schema.Literal<["timer"]>;
101
+ cron: Schema.SchemaClass<string, string, never>;
102
+ }>, Schema.Struct<{
103
+ kind: Schema.Literal<["webhook"]>;
104
+ method: Schema.optional<Schema.SchemaClass<string, string, never>>;
105
+ port: Schema.optional<Schema.SchemaClass<number, number, never>>;
106
+ }>]>;
107
+ export type Spec = Schema.Schema.Type<typeof Spec>;
108
+ /**
109
+ * Function trigger.
110
+ * Function is invoked with the `payload` passed as input data.
111
+ * The event that triggers the function is available in the function context.
112
+ */
113
+ declare const TriggerSchema: Type.Obj<{
114
+ readonly function?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown> | undefined;
115
+ readonly inputNodeId?: string | undefined;
116
+ readonly enabled?: boolean | undefined;
117
+ readonly spec?: {
118
+ readonly kind: "email";
119
+ } | {
120
+ readonly kind: "queue";
121
+ readonly queue: string;
122
+ } | {
123
+ readonly kind: "subscription";
124
+ readonly query: {
125
+ readonly raw?: string | undefined;
126
+ readonly ast: QueryAST.QueryFilterClause | QueryAST.QueryFromClause | QueryAST.QueryHierarchyTraversalClause | QueryAST.QueryIncomingReferencesClause | QueryAST.QueryLimitClause | QueryAST.QueryOptionsClause | QueryAST.QueryOrderClause | QueryAST.QueryReferenceTraversalClause | QueryAST.QueryRelationClause | QueryAST.QueryRelationTraversalClause | QueryAST.QuerySelectClause | QueryAST.QuerySetDifferenceClause | QueryAST.QueryUnionClause;
127
+ };
128
+ readonly options?: {
129
+ readonly deep?: boolean | undefined;
130
+ readonly delay?: number | undefined;
131
+ } | undefined;
132
+ } | {
133
+ readonly kind: "timer";
134
+ readonly cron: string;
135
+ } | {
136
+ readonly kind: "webhook";
137
+ readonly method?: string | undefined;
138
+ readonly port?: number | undefined;
139
+ } | undefined;
140
+ readonly concurrency?: number | undefined;
141
+ readonly input?: {
142
+ readonly [x: string]: any;
143
+ } | undefined;
144
+ }, Schema.Struct.Fields>;
145
+ export interface Trigger extends Schema.Schema.Type<typeof TriggerSchema> {
146
+ }
147
+ export declare const Trigger: Type.Obj<Trigger>;
148
+ export declare const make: (props: Obj.MakeProps<typeof Trigger>) => Obj.OfShape<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Trigger>;
149
+ export {};
150
+ //# sourceMappingURL=Trigger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Trigger.d.ts","sourceRoot":"","sources":["../../../src/Trigger.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