@dxos/functions 0.8.4-main.fd6878d → 0.8.4-main.fffef41

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/dist/lib/browser/index.mjs +788 -361
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +788 -361
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/errors.d.ts +87 -28
  8. package/dist/types/src/errors.d.ts.map +1 -1
  9. package/dist/types/src/example/fib.d.ts +7 -0
  10. package/dist/types/src/example/fib.d.ts.map +1 -0
  11. package/dist/types/src/example/forex-effect.d.ts +3 -0
  12. package/dist/types/src/example/forex-effect.d.ts.map +1 -0
  13. package/dist/types/src/example/index.d.ts +12 -0
  14. package/dist/types/src/example/index.d.ts.map +1 -0
  15. package/dist/types/src/example/reply.d.ts +3 -0
  16. package/dist/types/src/example/reply.d.ts.map +1 -0
  17. package/dist/types/src/example/sleep.d.ts +5 -0
  18. package/dist/types/src/example/sleep.d.ts.map +1 -0
  19. package/dist/types/src/index.d.ts +5 -7
  20. package/dist/types/src/index.d.ts.map +1 -1
  21. package/dist/types/src/protocol/index.d.ts +2 -0
  22. package/dist/types/src/protocol/index.d.ts.map +1 -0
  23. package/dist/types/src/protocol/protocol.d.ts +7 -0
  24. package/dist/types/src/protocol/protocol.d.ts.map +1 -0
  25. package/dist/types/src/protocol/protocol.test.d.ts +2 -0
  26. package/dist/types/src/protocol/protocol.test.d.ts.map +1 -0
  27. package/dist/types/src/sdk.d.ts +89 -0
  28. package/dist/types/src/sdk.d.ts.map +1 -0
  29. package/dist/types/src/services/credentials.d.ts +17 -3
  30. package/dist/types/src/services/credentials.d.ts.map +1 -1
  31. package/dist/types/src/services/event-logger.d.ts +20 -5
  32. package/dist/types/src/services/event-logger.d.ts.map +1 -1
  33. package/dist/types/src/services/function-invocation-service.d.ts +11 -0
  34. package/dist/types/src/services/function-invocation-service.d.ts.map +1 -0
  35. package/dist/types/src/services/index.d.ts +6 -6
  36. package/dist/types/src/services/index.d.ts.map +1 -1
  37. package/dist/types/src/services/queues.d.ts +4 -1
  38. package/dist/types/src/services/queues.d.ts.map +1 -1
  39. package/dist/types/src/services/tracing.d.ts +34 -6
  40. package/dist/types/src/services/tracing.d.ts.map +1 -1
  41. package/dist/types/src/types/Function.d.ts +58 -0
  42. package/dist/types/src/types/Function.d.ts.map +1 -0
  43. package/dist/types/src/types/Script.d.ts +28 -0
  44. package/dist/types/src/types/Script.d.ts.map +1 -0
  45. package/dist/types/src/types/Trigger.d.ts +139 -0
  46. package/dist/types/src/types/Trigger.d.ts.map +1 -0
  47. package/dist/types/src/types/TriggerEvent.d.ts +44 -0
  48. package/dist/types/src/types/TriggerEvent.d.ts.map +1 -0
  49. package/dist/types/src/types/index.d.ts +6 -0
  50. package/dist/types/src/types/index.d.ts.map +1 -0
  51. package/dist/types/src/types/url.d.ts +12 -0
  52. package/dist/types/src/types/url.d.ts.map +1 -0
  53. package/dist/types/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +18 -72
  55. package/src/errors.ts +13 -5
  56. package/src/example/fib.ts +32 -0
  57. package/src/example/forex-effect.ts +40 -0
  58. package/src/example/index.ts +13 -0
  59. package/src/example/reply.ts +21 -0
  60. package/src/example/sleep.ts +24 -0
  61. package/src/index.ts +5 -9
  62. package/src/{executor → protocol}/index.ts +1 -1
  63. package/src/protocol/protocol.test.ts +59 -0
  64. package/src/protocol/protocol.ts +145 -0
  65. package/src/sdk.ts +226 -0
  66. package/src/services/credentials.ts +51 -6
  67. package/src/services/event-logger.ts +12 -3
  68. package/src/services/function-invocation-service.ts +23 -0
  69. package/src/services/index.ts +7 -6
  70. package/src/services/queues.ts +8 -1
  71. package/src/services/tracing.ts +81 -17
  72. package/src/types/Function.ts +62 -0
  73. package/src/types/Script.ts +33 -0
  74. package/src/types/Trigger.ts +139 -0
  75. package/src/types/TriggerEvent.ts +62 -0
  76. package/src/types/index.ts +9 -0
  77. package/src/types/url.ts +31 -0
  78. package/dist/lib/browser/bundler/index.mjs +0 -248
  79. package/dist/lib/browser/bundler/index.mjs.map +0 -7
  80. package/dist/lib/browser/chunk-M2OIFLGE.mjs +0 -486
  81. package/dist/lib/browser/chunk-M2OIFLGE.mjs.map +0 -7
  82. package/dist/lib/browser/edge/index.mjs +0 -69
  83. package/dist/lib/browser/edge/index.mjs.map +0 -7
  84. package/dist/lib/browser/testing/index.mjs +0 -59
  85. package/dist/lib/browser/testing/index.mjs.map +0 -7
  86. package/dist/lib/node-esm/bundler/index.mjs +0 -250
  87. package/dist/lib/node-esm/bundler/index.mjs.map +0 -7
  88. package/dist/lib/node-esm/chunk-K7REX6H4.mjs +0 -488
  89. package/dist/lib/node-esm/chunk-K7REX6H4.mjs.map +0 -7
  90. package/dist/lib/node-esm/edge/index.mjs +0 -71
  91. package/dist/lib/node-esm/edge/index.mjs.map +0 -7
  92. package/dist/lib/node-esm/testing/index.mjs +0 -60
  93. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  94. package/dist/types/src/bundler/bundler.d.ts +0 -50
  95. package/dist/types/src/bundler/bundler.d.ts.map +0 -1
  96. package/dist/types/src/bundler/bundler.test.d.ts +0 -2
  97. package/dist/types/src/bundler/bundler.test.d.ts.map +0 -1
  98. package/dist/types/src/bundler/index.d.ts +0 -2
  99. package/dist/types/src/bundler/index.d.ts.map +0 -1
  100. package/dist/types/src/edge/functions.d.ts +0 -16
  101. package/dist/types/src/edge/functions.d.ts.map +0 -1
  102. package/dist/types/src/edge/index.d.ts +0 -2
  103. package/dist/types/src/edge/index.d.ts.map +0 -1
  104. package/dist/types/src/executor/executor.d.ts +0 -11
  105. package/dist/types/src/executor/executor.d.ts.map +0 -1
  106. package/dist/types/src/executor/index.d.ts +0 -2
  107. package/dist/types/src/executor/index.d.ts.map +0 -1
  108. package/dist/types/src/handler.d.ts +0 -65
  109. package/dist/types/src/handler.d.ts.map +0 -1
  110. package/dist/types/src/schema.d.ts +0 -38
  111. package/dist/types/src/schema.d.ts.map +0 -1
  112. package/dist/types/src/services/database.d.ts +0 -79
  113. package/dist/types/src/services/database.d.ts.map +0 -1
  114. package/dist/types/src/services/local-function-execution.d.ts +0 -12
  115. package/dist/types/src/services/local-function-execution.d.ts.map +0 -1
  116. package/dist/types/src/services/remote-function-execution-service.d.ts +0 -15
  117. package/dist/types/src/services/remote-function-execution-service.d.ts.map +0 -1
  118. package/dist/types/src/services/service-container.d.ts +0 -56
  119. package/dist/types/src/services/service-container.d.ts.map +0 -1
  120. package/dist/types/src/services/service-registry.d.ts +0 -29
  121. package/dist/types/src/services/service-registry.d.ts.map +0 -1
  122. package/dist/types/src/services/service-registry.test.d.ts +0 -2
  123. package/dist/types/src/services/service-registry.test.d.ts.map +0 -1
  124. package/dist/types/src/testing/index.d.ts +0 -3
  125. package/dist/types/src/testing/index.d.ts.map +0 -1
  126. package/dist/types/src/testing/layer.d.ts +0 -10
  127. package/dist/types/src/testing/layer.d.ts.map +0 -1
  128. package/dist/types/src/testing/logger.d.ts +0 -5
  129. package/dist/types/src/testing/logger.d.ts.map +0 -1
  130. package/dist/types/src/testing/services.d.ts +0 -59
  131. package/dist/types/src/testing/services.d.ts.map +0 -1
  132. package/dist/types/src/trace.d.ts +0 -122
  133. package/dist/types/src/trace.d.ts.map +0 -1
  134. package/dist/types/src/translations.d.ts +0 -12
  135. package/dist/types/src/translations.d.ts.map +0 -1
  136. package/dist/types/src/types.d.ts +0 -411
  137. package/dist/types/src/types.d.ts.map +0 -1
  138. package/dist/types/src/url.d.ts +0 -17
  139. package/dist/types/src/url.d.ts.map +0 -1
  140. package/src/bundler/bundler.test.ts +0 -59
  141. package/src/bundler/bundler.ts +0 -292
  142. package/src/bundler/index.ts +0 -5
  143. package/src/edge/functions.ts +0 -64
  144. package/src/edge/index.ts +0 -9
  145. package/src/executor/executor.ts +0 -54
  146. package/src/handler.ts +0 -122
  147. package/src/schema.ts +0 -57
  148. package/src/services/database.ts +0 -116
  149. package/src/services/local-function-execution.ts +0 -74
  150. package/src/services/remote-function-execution-service.ts +0 -66
  151. package/src/services/service-container.ts +0 -114
  152. package/src/services/service-registry.test.ts +0 -42
  153. package/src/services/service-registry.ts +0 -59
  154. package/src/testing/index.ts +0 -6
  155. package/src/testing/layer.ts +0 -31
  156. package/src/testing/logger.ts +0 -16
  157. package/src/testing/services.ts +0 -115
  158. package/src/trace.ts +0 -178
  159. package/src/translations.ts +0 -20
  160. package/src/types.ts +0 -211
  161. package/src/url.ts +0 -52
@@ -0,0 +1,12 @@
1
+ export declare namespace Example {
2
+ const fib: import("..").FunctionDefinition<{
3
+ readonly iterations?: number | undefined;
4
+ }, {
5
+ readonly result: string;
6
+ }, import("..").FunctionServices>;
7
+ const reply: import("..").FunctionDefinition<any, any, import("..").FunctionServices>;
8
+ const sleep: import("..").FunctionDefinition<{
9
+ readonly duration?: number | undefined;
10
+ }, void, import("..").FunctionServices>;
11
+ }
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/example/index.ts"],"names":[],"mappings":"AAQA,yBAAiB,OAAO,CAAC;IAChB,MAAM,GAAG;;;;qCAAO,CAAC;IACjB,MAAM,KAAK,0EAAS,CAAC;IACrB,MAAM,KAAK;;2CAAS,CAAC;CAC7B"}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("..").FunctionDefinition<any, any, import("..").FunctionServices>;
2
+ export default _default;
3
+ //# sourceMappingURL=reply.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../../../src/example/reply.ts"],"names":[],"mappings":";AAUA,wBAUG"}
@@ -0,0 +1,5 @@
1
+ declare const _default: import("..").FunctionDefinition<{
2
+ readonly duration?: number | undefined;
3
+ }, void, import("..").FunctionServices>;
4
+ export default _default;
5
+ //# sourceMappingURL=sleep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../../../src/example/sleep.ts"],"names":[],"mappings":";;;AASA,wBAcG"}
@@ -1,9 +1,7 @@
1
- export * from './handler';
2
- export * from './schema';
3
- export * from './trace';
4
- export * from './types';
5
- export * from './url';
6
- export * from './services';
7
- export * from './executor';
8
1
  export * from './errors';
2
+ export * from './example';
3
+ export * from './sdk';
4
+ export * from './services';
5
+ export * from './types';
6
+ export * from './protocol';
9
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './protocol';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/protocol/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type FunctionProtocol } from '@dxos/protocols';
2
+ import { FunctionDefinition } from '../sdk';
3
+ /**
4
+ * Wraps a function handler made with `defineFunction` to a protocol that the functions-runtime expects.
5
+ */
6
+ export declare const wrapFunctionHandler: (func: FunctionDefinition) => FunctionProtocol.Func;
7
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../../src/protocol/protocol.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGxD,OAAO,EAAE,kBAAkB,EAAyB,MAAM,QAAQ,CAAC;AAInE;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,kBAAkB,KAAG,gBAAgB,CAAC,IA6D/E,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=protocol.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.test.d.ts","sourceRoot":"","sources":["../../../../src/protocol/protocol.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,89 @@
1
+ import type * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ import * as Schema from 'effect/Schema';
4
+ import { type AiService } from '@dxos/ai';
5
+ import { type DatabaseService } from '@dxos/echo-db';
6
+ import { type CredentialsService, type FunctionInvocationService, type QueueService, type TracingService } from './services';
7
+ import { Function } from './types';
8
+ /**
9
+ * Services that are provided at the function call site by the caller.
10
+ */
11
+ export type InvocationServices = TracingService;
12
+ /**
13
+ * Services that are available to invoked functions.
14
+ */
15
+ export type FunctionServices = InvocationServices | AiService.AiService | CredentialsService | DatabaseService | QueueService | FunctionInvocationService;
16
+ /**
17
+ * Function handler.
18
+ */
19
+ export type FunctionHandler<TData = {}, TOutput = any, S extends FunctionServices = FunctionServices> = (params: {
20
+ /**
21
+ * Context available to the function.
22
+ */
23
+ context: FunctionContext;
24
+ /**
25
+ * Data passed as the input to the function.
26
+ * Must match the function's input schema.
27
+ * This will be the payload from the trigger or other data passed into the function in a workflow.
28
+ */
29
+ data: TData;
30
+ }) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any, S>;
31
+ /**
32
+ * Function context.
33
+ */
34
+ export interface FunctionContext {
35
+ }
36
+ declare const typeId: unique symbol;
37
+ export type FunctionDefinition<T = any, O = any, S extends FunctionServices = FunctionServices> = {
38
+ [typeId]: true;
39
+ key: string;
40
+ name: string;
41
+ description?: string;
42
+ inputSchema: Schema.Schema<T, any>;
43
+ outputSchema?: Schema.Schema<O, any>;
44
+ /**
45
+ * Keys of the required services.
46
+ */
47
+ services: readonly string[];
48
+ handler: FunctionHandler<T, O, S>;
49
+ meta?: {
50
+ /**
51
+ * Tools that are projected from functions have this annotation.
52
+ *
53
+ * deployedFunctionId:
54
+ * - Backend deployment ID assigned by the EDGE function service (typically a UUID).
55
+ * - Used for remote invocation via `FunctionInvocationService` → `RemoteFunctionExecutionService`.
56
+ * - Persisted on the corresponding ECHO `Function.Function` object's metadata under the
57
+ * `FUNCTIONS_META_KEY` and retrieved with `getUserFunctionIdInMetadata`.
58
+ */
59
+ deployedFunctionId?: string;
60
+ };
61
+ };
62
+ export declare namespace FunctionDefinition {
63
+ type Any = FunctionDefinition<any, any, any>;
64
+ type Input<T extends Any> = T extends FunctionDefinition<infer I, infer _O, infer _S> ? I : never;
65
+ type Output<T extends Any> = T extends FunctionDefinition<infer _I, infer O, infer _S> ? O : never;
66
+ type Services<T extends Any> = T extends FunctionDefinition<infer _I, infer _O, infer S> ? S : never;
67
+ }
68
+ export type FunctionProps<T, O> = {
69
+ key: string;
70
+ name: string;
71
+ description?: string;
72
+ inputSchema: Schema.Schema<T, any>;
73
+ outputSchema?: Schema.Schema<O, any>;
74
+ services?: readonly Context.Tag<any, any>[];
75
+ handler: FunctionHandler<T, O, FunctionServices>;
76
+ };
77
+ export declare const defineFunction: {
78
+ <I, O>(params: FunctionProps<I, O>): FunctionDefinition<I, O, FunctionServices>;
79
+ };
80
+ export declare const FunctionDefinition: {
81
+ make: <I, O>(params: FunctionProps<I, O>) => FunctionDefinition<I, O, FunctionServices>;
82
+ isFunction: (value: unknown) => value is FunctionDefinition.Any;
83
+ serialize: (functionDef: FunctionDefinition.Any) => Function.Function;
84
+ deserialize: (functionObj: Function.Function) => FunctionDefinition.Any;
85
+ };
86
+ export declare const serializeFunction: (functionDef: FunctionDefinition.Any) => Function.Function;
87
+ export declare const deserializeFunction: (functionObj: Function.Function) => FunctionDefinition<unknown, unknown>;
88
+ export {};
89
+ //# sourceMappingURL=sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/sdk.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,YAAY,EACjB,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAQnC;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,kBAAkB,GAClB,SAAS,CAAC,SAAS,GACnB,kBAAkB,GAClB,eAAe,GACf,YAAY,GACZ,yBAAyB,CAAC;AAE9B;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,KAAK,GAAG,EAAE,EAAE,OAAO,GAAG,GAAG,EAAE,CAAC,SAAS,gBAAgB,GAAG,gBAAgB,IAAI,CAAC,MAAM,EAAE;IAC/G;;OAEG;IACH,OAAO,EAAE,eAAe,CAAC;IAEzB;;;;OAIG;IACH,IAAI,EAAE,KAAK,CAAC;CACb,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,CAA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AmB,GAAI,aAAa,QAAQ,CAAC,QAAQ,KAAG,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAgBvG,CAAC"}
@@ -1,6 +1,11 @@
1
- import { Context, Effect, Layer } from 'effect';
2
- import { DatabaseService } from './database';
3
- type CredentialQuery = {
1
+ import * as HttpClient from '@effect/platform/HttpClient';
2
+ import type * as Config from 'effect/Config';
3
+ import * as Context from 'effect/Context';
4
+ import * as Effect from 'effect/Effect';
5
+ import * as Layer from 'effect/Layer';
6
+ import * as Redacted from 'effect/Redacted';
7
+ import { DatabaseService } from '@dxos/echo-db';
8
+ export type CredentialQuery = {
4
9
  service?: string;
5
10
  };
6
11
  export type ServiceCredential = {
@@ -20,7 +25,12 @@ declare const CredentialsService_base: Context.TagClass<CredentialsService, "@dx
20
25
  }>;
21
26
  export declare class CredentialsService extends CredentialsService_base {
22
27
  static getCredential: (query: CredentialQuery) => Effect.Effect<ServiceCredential, never, CredentialsService>;
28
+ static getApiKey: (query: CredentialQuery) => Effect.Effect<Redacted.Redacted<string>, never, CredentialsService>;
23
29
  static configuredLayer: (credentials: ServiceCredential[]) => Layer.Layer<CredentialsService, never, never>;
30
+ static layerConfig: (credentials: {
31
+ service: string;
32
+ apiKey: Config.Config<Redacted.Redacted<string>>;
33
+ }[]) => Layer.Layer<CredentialsService, import("effect/ConfigError").ConfigError, never>;
24
34
  static layerFromDatabase: () => Layer.Layer<CredentialsService, never, DatabaseService>;
25
35
  }
26
36
  export declare class ConfiguredCredentialsService implements Context.Tag.Service<CredentialsService> {
@@ -30,5 +40,9 @@ export declare class ConfiguredCredentialsService implements Context.Tag.Service
30
40
  queryCredentials(query: CredentialQuery): Promise<ServiceCredential[]>;
31
41
  getCredential(query: CredentialQuery): Promise<ServiceCredential>;
32
42
  }
43
+ /**
44
+ * Maps the request to include the API key from the credential.
45
+ */
46
+ export declare const withAuthorization: (query: CredentialQuery, kind?: "Bearer" | "Basic") => <E, R>(self: HttpClient.HttpClient.With<E, R>) => HttpClient.HttpClient.With<E, CredentialsService | R>;
33
47
  export {};
34
48
  //# sourceMappingURL=credentials.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../../src/services/credentials.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAKhD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,KAAK,eAAe,GAAG;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAIF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAGhB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;;IAKE;;OAEG;sBACe,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAE1E;;;OAGG;mBACY,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,iBAAiB,CAAC;;AAZzE,qBAAa,kBAAmB,SAAQ,uBAcrC;IACD,MAAM,CAAC,aAAa,GAAI,OAAO,eAAe,KAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAIvG;IAEL,MAAM,CAAC,eAAe,GAAI,aAAa,iBAAiB,EAAE,mDACyB;IAEnF,MAAM,CAAC,iBAAiB,gEA2BpB;CACL;AAED,qBAAa,4BAA6B,YAAW,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC;IAC9E,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,GAAE,iBAAiB,EAAO;IAElE,cAAc,CAAC,WAAW,EAAE,iBAAiB,EAAE,GAAG,4BAA4B;IAKxE,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAItE,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAi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,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;KAAE,EAAE,sFAetG;IAEJ,MAAM,CAAC,iBAAiB,gEA4BpB;CACL;AAED,qBAAa,4BAA6B,YAAW,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC;IAC9E,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,GAAE,iBAAiB,EAAO;IAElE,cAAc,CAAC,WAAW,EAAE,iBAAiB,EAAE,GAAG,4BAA4B;IAKxE,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAItE,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAQxE;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,eAAe,EAAE,OAAO,QAAQ,GAAG,OAAO,4GAOhF,CAAC"}
@@ -1,15 +1,24 @@
1
- import { Context, Effect, Layer, Schema } from 'effect';
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';
2
5
  import { Type } from '@dxos/echo';
3
6
  import { LogLevel } from '@dxos/log';
4
7
  import { TracingService } from './tracing';
5
8
  export declare const ComputeEventPayload: Schema.Union<[Schema.Struct<{
6
9
  type: Schema.Literal<["begin-compute"]>;
7
10
  nodeId: typeof Schema.String;
8
- inputs: Schema.Record$<typeof Schema.String, typeof Schema.Any>;
11
+ /**
12
+ * Names of the inputs begin computed.
13
+ */
14
+ inputs: Schema.Array$<typeof Schema.String>;
9
15
  }>, Schema.Struct<{
10
16
  type: Schema.Literal<["end-compute"]>;
11
17
  nodeId: typeof Schema.String;
12
- outputs: Schema.Record$<typeof Schema.String, typeof Schema.Any>;
18
+ /**
19
+ * Names of the outputs computed.
20
+ */
21
+ outputs: Schema.Array$<typeof Schema.String>;
13
22
  }>, Schema.Struct<{
14
23
  type: Schema.Literal<["compute-input"]>;
15
24
  nodeId: typeof Schema.String;
@@ -30,11 +39,17 @@ export declare const ComputeEvent: Type.obj<Schema.Struct<{
30
39
  payload: Schema.Union<[Schema.Struct<{
31
40
  type: Schema.Literal<["begin-compute"]>;
32
41
  nodeId: typeof Schema.String;
33
- inputs: Schema.Record$<typeof Schema.String, typeof Schema.Any>;
42
+ /**
43
+ * Names of the inputs begin computed.
44
+ */
45
+ inputs: Schema.Array$<typeof Schema.String>;
34
46
  }>, Schema.Struct<{
35
47
  type: Schema.Literal<["end-compute"]>;
36
48
  nodeId: typeof Schema.String;
37
- outputs: Schema.Record$<typeof Schema.String, typeof Schema.Any>;
49
+ /**
50
+ * Names of the outputs computed.
51
+ */
52
+ outputs: Schema.Array$<typeof Schema.String>;
38
53
  }>, Schema.Struct<{
39
54
  type: Schema.Literal<["compute-input"]>;
40
55
  nodeId: typeof Schema.String;
@@ -1 +1 @@
1
- {"version":3,"file":"event-logger.d.ts","sourceRoot":"","sources":["../../../../src/services/event-logger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExD,OAAO,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,QAAQ,EAAO,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;IA4B/B,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEjF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;GAEsD,CAAC;;kBAO9D,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI;qBAAmB,MAAM,GAAG,SAAS;;AAL3F;;GAEG;AACH,qBAAa,kB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;;;;;;;;;;;;;;GAyBwE,CAAC;;kBAO9D,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI;qBAAmB,MAAM,GAAG,SAAS;;AAL3F;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,uBAGrC;IACD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAGlD;IAEF;;OAEG;IACH,MAAM,CAAC,gBAAgB,yDAWrB;CACH;AAED,eAAO,MAAM,cAAc,GAAI,MAAM,GAAG,mDAWpC,CAAC;AAEL,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,OAAK,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAMrG,CAAC;AAEJ,eAAO,MAAM,iBAAiB,GAC5B,OAAO,QAAQ,EACf,UAAS,MAAgB,KACxB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAiBxC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ import { type FunctionDefinition, type InvocationServices } from '../sdk';
4
+ declare const FunctionInvocationService_base: Context.TagClass<FunctionInvocationService, "@dxos/functions/FunctionInvocationService", {
5
+ invokeFunction<I, O>(functionDef: FunctionDefinition<I, O, any>, input: I): Effect.Effect<O, never, InvocationServices>;
6
+ }>;
7
+ export declare class FunctionInvocationService extends FunctionInvocationService_base {
8
+ static invokeFunction: <I, O>(functionDef: FunctionDefinition<I, O, any>, input: I) => Effect.Effect<O, never, FunctionInvocationService | InvocationServices>;
9
+ }
10
+ export {};
11
+ //# sourceMappingURL=function-invocation-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function-invocation-service.d.ts","sourceRoot":"","sources":["../../../../src/services/function-invocation-service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,QAAQ,CAAC;;mBAKvD,CAAC,EAAE,CAAC,eACJ,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,SACnC,CAAC,GACP,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC;;AANlD,qBAAa,yBAA0B,SAAQ,8BAQ5C;IACD,MAAM,CAAC,cAAc,GAAI,CAAC,EAAE,CAAC,EAC3B,aAAa,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,EAC1C,OAAO,CAAC,KACP,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,yBAAyB,GAAG,kBAAkB,CAAC,CACyC;CACpH"}
@@ -1,9 +1,9 @@
1
- export * from './database';
2
- export * from './queues';
3
- export * from './service-container';
1
+ export { DatabaseService } from '@dxos/echo-db';
4
2
  export * from './credentials';
5
- export * from './tracing';
3
+ export { ConfiguredCredentialsService, type ServiceCredential } from './credentials';
6
4
  export * from './event-logger';
7
- export * from './remote-function-execution-service';
8
- export * from './local-function-execution';
5
+ export { createEventLogger, createDefectLogger } from './event-logger';
6
+ export * from './function-invocation-service';
7
+ export * from './queues';
8
+ export * from './tracing';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qCAAqC,CAAC;AACpD,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,4BAA4B,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACrF,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACvE,cAAc,+BAA+B,CAAC;AAC9C,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
@@ -1,4 +1,6 @@
1
- import { Context, Effect, Layer } from 'effect';
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ import * as Layer from 'effect/Layer';
2
4
  import type { Obj, Relation } from '@dxos/echo';
3
5
  import type { Queue, QueueAPI, QueueFactory } from '@dxos/echo-db';
4
6
  import type { DXN, QueueSubspaceTag } from '@dxos/keys';
@@ -30,6 +32,7 @@ export declare class QueueService extends QueueService_base {
30
32
  static createQueue: <T extends Obj.Any | Relation.Any = Obj.Any | Relation.Any>(options?: {
31
33
  subspaceTag?: QueueSubspaceTag;
32
34
  }) => Effect.Effect<Queue<T>, never, QueueService>;
35
+ static append: <T extends Obj.Any | Relation.Any = Obj.Any | Relation.Any>(queue: Queue<T>, objects: T[]) => Effect.Effect<void>;
33
36
  }
34
37
  declare const ContextQueueService_base: Context.TagClass<ContextQueueService, "@dxos/functions/ContextQueueService", {
35
38
  readonly queue: Queue;
@@ -1 +1 @@
1
- {"version":3,"file":"queues.d.ts","sourceRoot":"","sources":["../../../../src/services/queues.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAChD,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AC;KAChC,KAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAC2B;IAE3E,MAAM,CAAC,MAAM,GAAI,CAAC,SAAS,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,EACxE,OAAO,KAAK,CAAC,CAAC,CAAC,EACf,SAAS,CAAC,EAAE,KACX,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAgD;CACvE;;oBAQmB,KAAK;;AANzB;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,wBAKtC;IACD,MAAM,CAAC,KAAK,GAAI,OAAO,KAAK,oDAAmD;CAChF"}
@@ -1,13 +1,20 @@
1
- import { Context, Effect, Layer } from 'effect';
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ import * as Layer from 'effect/Layer';
2
4
  import { AgentStatus } from '@dxos/ai';
3
5
  import { Obj } from '@dxos/echo';
4
- import type { AnyEchoObject } from '@dxos/echo-schema';
6
+ import type { ObjectId } from '@dxos/echo/internal';
7
+ import { Message } from '@dxos/types';
5
8
  declare const TracingService_base: Context.TagClass<TracingService, "@dxos/functions/TracingService", {
9
+ /**
10
+ * Gets the parent message ID.
11
+ */
12
+ getTraceContext: () => TracingService.TraceContext;
6
13
  /**
7
14
  * Write an event to the tracing queue.
8
15
  * @param event - The event to write. Must be an a typed object.
9
16
  */
10
- write(event: AnyEchoObject): void;
17
+ write: (event: Obj.Any) => void;
11
18
  }>;
12
19
  /**
13
20
  * Provides a way for compute primitives (functions, workflows, tools)
@@ -15,12 +22,33 @@ declare const TracingService_base: Context.TagClass<TracingService, "@dxos/funct
15
22
  */
16
23
  export declare class TracingService extends TracingService_base {
17
24
  static noop: Context.Tag.Service<TracingService>;
18
- static layerNoop: Layer.Layer<TracingService, never, never>;
19
- static console: Context.Tag.Service<TracingService>;
25
+ static layerNoop: Layer.Layer<TracingService>;
26
+ /**
27
+ * Creates a TracingService layer that emits events to the parent tracing service.
28
+ */
29
+ static layerSubframe: (mapContext: (currentContext: TracingService.TraceContext) => TracingService.TraceContext) => Layer.Layer<TracingService, never, TracingService>;
20
30
  /**
21
31
  * Emit the current human-readable execution status.
22
32
  */
23
- static emitStatus: (data: Obj.MakeProps<typeof AgentStatus>) => Effect.Effect<void, never, TracingService>;
33
+ static emitStatus: (data: Omit<Obj.MakeProps<typeof AgentStatus>, 'created'>) => Effect.Effect<void, never, TracingService>;
34
+ static emitConverationMessage: (data: Obj.MakeProps<typeof Message.Message>) => Effect.Effect<void, never, TracingService>;
24
35
  }
36
+ export declare namespace TracingService {
37
+ interface TraceContext {
38
+ /**
39
+ * If this thread sprung from a tool call, this is the ID of the message containing the tool call.
40
+ */
41
+ parentMessage?: ObjectId;
42
+ /**
43
+ * If the current thread is a byproduct of a tool call, this is the ID of the tool call.
44
+ */
45
+ toolCallId?: string;
46
+ debugInfo?: unknown;
47
+ }
48
+ }
49
+ /**
50
+ * Goes into {@link Message['properties']}
51
+ */
52
+ export declare const MESSAGE_PROPERTY_TOOL_CALL_ID: "toolCallId";
25
53
  export {};
26
54
  //# sourceMappingURL=tracing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../../../src/services/tracing.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;;IASnD;;;OAGG;iBACU,aAAa,GAAG,IAAI;;AAXrC;;;GAGG;AACH,qBAAa,cAAe,SAAQ,mBASjC;IACD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAA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,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,WAAW,CAAC,EAAE,SAAS,CAAC,KACrD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,CAU5C;IAEH,MAAM,CAAC,sBAAsB,EAAE,CAC7B,IAAI,EAAE,GAAG,CAAC,SAAS,CAAC,OAAO,OAAO,CAAC,OAAO,CAAC,KACxC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,CAY5C;CACJ;AAED,yBAAiB,cAAc,CAAC;IAC9B,UAAiB,YAAY;QAC3B;;WAEG;QACH,aAAa,CAAC,EAAE,QAAQ,CAAC;QAEzB;;WAEG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;QAEpB,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB;CACF;AAED;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAG,YAAqB,CAAC"}
@@ -0,0 +1,58 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import { Obj, Type } from '@dxos/echo';
3
+ import { Ref } from '@dxos/echo/internal';
4
+ /**
5
+ * Function deployment.
6
+ */
7
+ export declare const Function: Type.obj<Schema.Struct<{
8
+ /**
9
+ * Global registry ID.
10
+ * NOTE: The `key` property refers to the original registry entry.
11
+ */
12
+ key: Schema.optional<typeof Schema.String>;
13
+ name: typeof Schema.NonEmptyString;
14
+ version: typeof Schema.String;
15
+ description: Schema.optional<typeof Schema.String>;
16
+ /**
17
+ * ISO date string of the last deployment.
18
+ */
19
+ updated: Schema.optional<typeof Schema.String>;
20
+ source: Schema.optional<import("@dxos/echo/internal").Ref$<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
21
+ description?: string | undefined;
22
+ source: Ref<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
23
+ content: string;
24
+ }>;
25
+ name?: string | undefined;
26
+ changed?: boolean | undefined;
27
+ }>>;
28
+ inputSchema: Schema.optional<Schema.Schema<Type.JsonSchema, Type.JsonSchema, never>>;
29
+ outputSchema: Schema.optional<Schema.Schema<Type.JsonSchema, Type.JsonSchema, never>>;
30
+ /**
31
+ * List of required services.
32
+ * Match the Context.Tag keys of the FunctionServices variants.
33
+ */
34
+ services: Schema.optional<Schema.Array$<typeof Schema.String>>;
35
+ binding: Schema.optional<typeof Schema.String>;
36
+ }>>;
37
+ export interface Function extends Schema.Schema.Type<typeof Function> {
38
+ }
39
+ export declare const make: (props: Obj.MakeProps<typeof Function>) => import("@dxos/live-object").Live<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
40
+ description?: string | undefined;
41
+ version: string;
42
+ source?: Ref<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
43
+ description?: string | undefined;
44
+ source: Ref<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
45
+ content: string;
46
+ }>;
47
+ name?: string | undefined;
48
+ changed?: boolean | undefined;
49
+ }> | undefined;
50
+ name: string;
51
+ key?: string | undefined;
52
+ updated?: string | undefined;
53
+ inputSchema?: Type.JsonSchema | undefined;
54
+ outputSchema?: Type.JsonSchema | undefined;
55
+ services?: readonly string[] | undefined;
56
+ binding?: string | undefined;
57
+ }>;
58
+ //# sourceMappingURL=Function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Function.d.ts","sourceRoot":"","sources":["../../../../src/types/Function.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAmC,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAI3E;;GAEG;AACH,eAAO,MAAM,QAAQ;IACnB;;;OAGG;;;;;IAcH;;OAEG;;;;;;;;;;;;IAUH;;;OAGG;;;GAWJ,CAAC;AACF,MAAM,WAAW,QAAS,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC;CAAG;AAExE,eAAO,MAAM,IAAI,GAAI,OAAO,GAAG,CAAC,SAAS,CAAC,OAAO,QAAQ,CAAC;;;;;;;;;;;;;;;;;;EAA8B,CAAC"}
@@ -0,0 +1,28 @@
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<Schema.Struct<{
7
+ name: Schema.optional<typeof Schema.String>;
8
+ description: Schema.optional<typeof Schema.String>;
9
+ changed: Schema.optional<typeof Schema.Boolean>;
10
+ source: Type.ref<Type.obj<Schema.Struct<{
11
+ content: typeof Schema.String;
12
+ }>>>;
13
+ }>>;
14
+ export interface Script extends Schema.Schema.Type<typeof Script> {
15
+ }
16
+ type Props = Omit<Obj.MakeProps<typeof Script>, 'source'> & {
17
+ source?: string;
18
+ };
19
+ export declare const make: ({ source, ...props }?: Props) => import("@dxos/live-object").Live<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
20
+ description?: string | undefined;
21
+ source: import("@dxos/echo/internal").Ref<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
22
+ content: string;
23
+ }>;
24
+ name?: string | undefined;
25
+ changed?: boolean | undefined;
26
+ }>;
27
+ export {};
28
+ //# sourceMappingURL=Script.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Script.d.ts","sourceRoot":"","sources":["../../../../src/types/Script.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,GAAG,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AAI5C;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;;;GAalB,CAAC;AACF,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,GAAI,uBAA2B,KAAU;;;;;;;EACW,CAAC"}