@dxos/functions 0.8.4-main.72ec0f3 → 0.8.4-main.7996785055

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 (84) hide show
  1. package/README.md +4 -6
  2. package/dist/lib/neutral/chunk-GEM2K7BA.mjs +56 -0
  3. package/dist/lib/neutral/chunk-GEM2K7BA.mjs.map +7 -0
  4. package/dist/lib/neutral/fib-XBUKWUUS.mjs +22 -0
  5. package/dist/lib/neutral/fib-XBUKWUUS.mjs.map +7 -0
  6. package/dist/lib/neutral/index.mjs +960 -0
  7. package/dist/lib/neutral/index.mjs.map +7 -0
  8. package/dist/lib/neutral/meta.json +1 -0
  9. package/dist/lib/neutral/reply-XBQTXDLZ.mjs +18 -0
  10. package/dist/lib/neutral/reply-XBQTXDLZ.mjs.map +7 -0
  11. package/dist/lib/neutral/sleep-TLQKHAK2.mjs +14 -0
  12. package/dist/lib/neutral/sleep-TLQKHAK2.mjs.map +7 -0
  13. package/dist/types/src/errors.d.ts +24 -32
  14. package/dist/types/src/errors.d.ts.map +1 -1
  15. package/dist/types/src/example/definitions.d.ts +11 -0
  16. package/dist/types/src/example/definitions.d.ts.map +1 -0
  17. package/dist/types/src/example/fib.d.ts +3 -2
  18. package/dist/types/src/example/fib.d.ts.map +1 -1
  19. package/dist/types/src/example/index.d.ts +3 -11
  20. package/dist/types/src/example/index.d.ts.map +1 -1
  21. package/dist/types/src/example/reply.d.ts +2 -1
  22. package/dist/types/src/example/reply.d.ts.map +1 -1
  23. package/dist/types/src/example/sleep.d.ts +3 -2
  24. package/dist/types/src/example/sleep.d.ts.map +1 -1
  25. package/dist/types/src/protocol/functions-ai-http-client.d.ts +12 -0
  26. package/dist/types/src/protocol/functions-ai-http-client.d.ts.map +1 -0
  27. package/dist/types/src/protocol/protocol.d.ts +2 -2
  28. package/dist/types/src/protocol/protocol.d.ts.map +1 -1
  29. package/dist/types/src/sdk.d.ts +2 -79
  30. package/dist/types/src/sdk.d.ts.map +1 -1
  31. package/dist/types/src/services/credentials.d.ts +6 -4
  32. package/dist/types/src/services/credentials.d.ts.map +1 -1
  33. package/dist/types/src/services/event-logger.d.ts +25 -31
  34. package/dist/types/src/services/event-logger.d.ts.map +1 -1
  35. package/dist/types/src/services/function-invocation-service.d.ts +9 -3
  36. package/dist/types/src/services/function-invocation-service.d.ts.map +1 -1
  37. package/dist/types/src/services/index.d.ts +0 -1
  38. package/dist/types/src/services/index.d.ts.map +1 -1
  39. package/dist/types/src/services/queues.d.ts +4 -4
  40. package/dist/types/src/services/queues.d.ts.map +1 -1
  41. package/dist/types/src/services/tracing.d.ts +38 -3
  42. package/dist/types/src/services/tracing.d.ts.map +1 -1
  43. package/dist/types/src/types/Script.d.ts +9 -16
  44. package/dist/types/src/types/Script.d.ts.map +1 -1
  45. package/dist/types/src/types/Trigger.d.ts +57 -76
  46. package/dist/types/src/types/Trigger.d.ts.map +1 -1
  47. package/dist/types/src/types/TriggerEvent.d.ts +44 -13
  48. package/dist/types/src/types/TriggerEvent.d.ts.map +1 -1
  49. package/dist/types/src/types/index.d.ts +0 -1
  50. package/dist/types/src/types/index.d.ts.map +1 -1
  51. package/dist/types/src/types/url.d.ts +6 -5
  52. package/dist/types/src/types/url.d.ts.map +1 -1
  53. package/dist/types/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +23 -17
  55. package/src/errors.ts +4 -4
  56. package/src/example/definitions.ts +48 -0
  57. package/src/example/fib.ts +14 -24
  58. package/src/example/forex-effect.ts +1 -1
  59. package/src/example/index.ts +7 -8
  60. package/src/example/reply.ts +10 -13
  61. package/src/example/sleep.ts +8 -17
  62. package/src/protocol/functions-ai-http-client.ts +67 -0
  63. package/src/protocol/protocol.ts +196 -84
  64. package/src/sdk.ts +4 -194
  65. package/src/services/credentials.ts +31 -15
  66. package/src/services/event-logger.ts +2 -2
  67. package/src/services/function-invocation-service.ts +18 -3
  68. package/src/services/index.ts +0 -2
  69. package/src/services/queues.ts +5 -7
  70. package/src/services/tracing.ts +64 -4
  71. package/src/types/Script.ts +13 -8
  72. package/src/types/Trigger.ts +31 -17
  73. package/src/types/TriggerEvent.ts +29 -29
  74. package/src/types/index.ts +0 -1
  75. package/src/types/url.ts +6 -5
  76. package/dist/lib/browser/index.mjs +0 -927
  77. package/dist/lib/browser/index.mjs.map +0 -7
  78. package/dist/lib/browser/meta.json +0 -1
  79. package/dist/lib/node-esm/index.mjs +0 -928
  80. package/dist/lib/node-esm/index.mjs.map +0 -7
  81. package/dist/lib/node-esm/meta.json +0 -1
  82. package/dist/types/src/types/Function.d.ts +0 -58
  83. package/dist/types/src/types/Function.d.ts.map +0 -1
  84. package/src/types/Function.ts +0 -62
@@ -1,10 +1,6 @@
1
- import type * as Context from 'effect/Context';
2
- import * as Effect from 'effect/Effect';
3
- import * as Schema from 'effect/Schema';
4
1
  import { type AiService } from '@dxos/ai';
5
- import { type DatabaseService } from '@dxos/echo-db';
2
+ import { type Database, type Feed } from '@dxos/echo';
6
3
  import { type CredentialsService, type FunctionInvocationService, type QueueService, type TracingService } from './services';
7
- import { Function } from './types';
8
4
  /**
9
5
  * Services that are provided at the function call site by the caller.
10
6
  */
@@ -12,78 +8,5 @@ export type InvocationServices = TracingService;
12
8
  /**
13
9
  * Services that are available to invoked functions.
14
10
  */
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 {};
11
+ export type FunctionServices = InvocationServices | AiService.AiService | CredentialsService | Database.Service | QueueService | Feed.Service | FunctionInvocationService;
89
12
  //# sourceMappingURL=sdk.d.ts.map
@@ -1 +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,CAAC,CAAC,CAAC;AAElE;;GAEG;AACH,MAAM,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AAG,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAgBvG,CAAC"}
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/sdk.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAEtD,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,YAAY,EACjB,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAOpB;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,kBAAkB,GAClB,SAAS,CAAC,SAAS,GACnB,kBAAkB,GAClB,QAAQ,CAAC,OAAO,GAEhB,YAAY,GACZ,IAAI,CAAC,OAAO,GACZ,yBAAyB,CAAC"}
@@ -4,7 +4,7 @@ import * as Context from 'effect/Context';
4
4
  import * as Effect from 'effect/Effect';
5
5
  import * as Layer from 'effect/Layer';
6
6
  import * as Redacted from 'effect/Redacted';
7
- import { DatabaseService } from '@dxos/echo-db';
7
+ import { Database } from '@dxos/echo';
8
8
  export type CredentialQuery = {
9
9
  service?: string;
10
10
  };
@@ -31,7 +31,9 @@ export declare class CredentialsService extends CredentialsService_base {
31
31
  service: string;
32
32
  apiKey: Config.Config<Redacted.Redacted<string>>;
33
33
  }[]) => Layer.Layer<CredentialsService, import("effect/ConfigError").ConfigError, never>;
34
- static layerFromDatabase: () => Layer.Layer<CredentialsService, never, DatabaseService>;
34
+ static layerFromDatabase: ({ caching }?: {
35
+ caching?: boolean;
36
+ }) => Layer.Layer<CredentialsService, never, Database.Service>;
35
37
  }
36
38
  export declare class ConfiguredCredentialsService implements Context.Tag.Service<CredentialsService> {
37
39
  private readonly credentials;
@@ -41,8 +43,8 @@ export declare class ConfiguredCredentialsService implements Context.Tag.Service
41
43
  getCredential(query: CredentialQuery): Promise<ServiceCredential>;
42
44
  }
43
45
  /**
44
- * Maps the request to include the API key from the credential.
46
+ * Maps the request to include the given token in the Authorization header.
45
47
  */
46
- export declare const withAuthorization: (query: CredentialQuery, kind?: "Bearer" | "Basic") => <E, R>(self: HttpClient.HttpClient.With<E, R>) => HttpClient.HttpClient.With<E, CredentialsService | R>;
48
+ export declare const withAuthorization: (token: string, kind?: "Bearer" | "Basic") => <E, R>(self: HttpClient.HttpClient.With<E, R>) => HttpClient.HttpClient.With<E, R>;
47
49
  export {};
48
50
  //# sourceMappingURL=credentials.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../../src/services/credentials.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAE1D,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAIF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAGhB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;;IAKE;;OAEG;sBACe,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAE1E;;;OAGG;mBACY,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,iBAAiB,CAAC;;AAZzE,qBAAa,kBAAmB,SAAQ,uBAcrC;IACD,MAAM,CAAC,aAAa,GAAI,OAAO,eAAe,KAAG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Q,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,MAAM,EAAE,OAAO,QAAQ,GAAG,OAAO,uFAItE,CAAC"}
@@ -35,37 +35,31 @@ export declare const ComputeEventPayload: Schema.Union<[Schema.Struct<{
35
35
  event: typeof Schema.Any;
36
36
  }>]>;
37
37
  export type ComputeEventPayload = Schema.Schema.Type<typeof ComputeEventPayload>;
38
- export declare const ComputeEvent: Type.obj<Schema.Struct<{
39
- payload: Schema.Union<[Schema.Struct<{
40
- type: Schema.Literal<["begin-compute"]>;
41
- nodeId: typeof Schema.String;
42
- /**
43
- * Names of the inputs begin computed.
44
- */
45
- inputs: Schema.Array$<typeof Schema.String>;
46
- }>, Schema.Struct<{
47
- type: Schema.Literal<["end-compute"]>;
48
- nodeId: typeof Schema.String;
49
- /**
50
- * Names of the outputs computed.
51
- */
52
- outputs: Schema.Array$<typeof Schema.String>;
53
- }>, Schema.Struct<{
54
- type: Schema.Literal<["compute-input"]>;
55
- nodeId: typeof Schema.String;
56
- property: typeof Schema.String;
57
- value: typeof Schema.Any;
58
- }>, Schema.Struct<{
59
- type: Schema.Literal<["compute-output"]>;
60
- nodeId: typeof Schema.String;
61
- property: typeof Schema.String;
62
- value: typeof Schema.Any;
63
- }>, Schema.Struct<{
64
- type: Schema.Literal<["custom"]>;
65
- nodeId: typeof Schema.String;
66
- event: typeof Schema.Any;
67
- }>]>;
68
- }>>;
38
+ export declare const ComputeEvent: Type.Obj<{
39
+ readonly payload: {
40
+ readonly type: "begin-compute";
41
+ readonly nodeId: string;
42
+ readonly inputs: readonly string[];
43
+ } | {
44
+ readonly type: "end-compute";
45
+ readonly nodeId: string;
46
+ readonly outputs: readonly string[];
47
+ } | {
48
+ readonly value: any;
49
+ readonly type: "compute-input";
50
+ readonly nodeId: string;
51
+ readonly property: string;
52
+ } | {
53
+ readonly value: any;
54
+ readonly type: "compute-output";
55
+ readonly nodeId: string;
56
+ readonly property: string;
57
+ } | {
58
+ readonly type: "custom";
59
+ readonly nodeId: string;
60
+ readonly event: any;
61
+ };
62
+ }, Schema.Struct.Fields>;
69
63
  declare const ComputeEventLogger_base: Context.TagClass<ComputeEventLogger, "@dxos/functions/ComputeEventLogger", {
70
64
  readonly log: (event: ComputeEventPayload) => void;
71
65
  readonly nodeId: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"event-logger.d.ts","sourceRoot":"","sources":["../../../../src/services/event-logger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,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;;;IAI5B;;OAEG;;;;;IAMH;;OAEG;;;;;;;;;;;;;;;;IAoBN,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEjF,eAAO,MAAM,YAAY;;;;QAjCrB;;WAEG;;;;;QAMH;;WAEG;;;;;;;;;;;;;;;;;GAyBwE,CAAC;;kBAO9D,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI;qBAAmB,MAAM,GAAG,SAAS;;AAL3F;;GA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;;;;;wBAE0D,CAAC;;kBAOlE,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"}
@@ -1,11 +1,17 @@
1
1
  import * as Context from 'effect/Context';
2
2
  import * as Effect from 'effect/Effect';
3
- import { type FunctionDefinition, type InvocationServices } from '../sdk';
3
+ import * as Layer from 'effect/Layer';
4
+ import type { FunctionNotFoundError } from '../errors';
5
+ import { type InvocationServices } from '../sdk';
6
+ import { Operation } from '@dxos/operation';
4
7
  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>;
8
+ invokeFunction<I, O>(functionDef: Operation.Definition<I, O, any>, input: I): Effect.Effect<O, never, InvocationServices>;
9
+ resolveFunction(key: string): Effect.Effect<Operation.Definition.Any, FunctionNotFoundError>;
6
10
  }>;
7
11
  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>;
12
+ static layerNotAvailable: Layer.Layer<FunctionInvocationService, never, never>;
13
+ static invokeFunction: <I, O>(functionDef: Operation.Definition<I, O, any>, input: I) => Effect.Effect<O, never, FunctionInvocationService | InvocationServices>;
14
+ static resolveFunction: (key: string) => Effect.Effect<Operation.Definition.Any, FunctionNotFoundError, FunctionInvocationService>;
9
15
  }
10
16
  export {};
11
17
  //# sourceMappingURL=function-invocation-service.d.ts.map
@@ -1 +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
+ {"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;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;;mBAKzB,CAAC,EAAE,CAAC,eACJ,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,SACrC,CAAC,GACP,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC;yBAEzB,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,qBAAqB,CAAC;;AARhG,qBAAa,yBAA0B,SAAQ,8BAU5C;IACD,MAAM,CAAC,iBAAiB,uDAGrB;IAEH,MAAM,CAAC,cAAc,GAAI,CAAC,EAAE,CAAC,EAC3B,aAAa,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,EAC5C,OAAO,CAAC,KACP,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,yBAAyB,GAAG,kBAAkB,CAAC,CACyC;IAEnH,MAAM,CAAC,eAAe,GACpB,KAAK,MAAM,KACV,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,qBAAqB,EAAE,yBAAyB,CAAC,CACS;CACtG"}
@@ -1,4 +1,3 @@
1
- export { DatabaseService } from '@dxos/echo-db';
2
1
  export * from './credentials';
3
2
  export { ConfiguredCredentialsService, type ServiceCredential } from './credentials';
4
3
  export * from './event-logger';
@@ -1 +1 @@
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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/index.ts"],"names":[],"mappings":"AAIA,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,7 +1,7 @@
1
1
  import * as Context from 'effect/Context';
2
2
  import * as Effect from 'effect/Effect';
3
3
  import * as Layer from 'effect/Layer';
4
- import type { Obj, Relation } from '@dxos/echo';
4
+ import type { Entity } from '@dxos/echo';
5
5
  import type { Queue, QueueAPI, QueueFactory } from '@dxos/echo-db';
6
6
  import type { DXN, QueueSubspaceTag } from '@dxos/keys';
7
7
  declare const QueueService_base: Context.TagClass<QueueService, "@dxos/functions/QueueService", {
@@ -25,14 +25,14 @@ export declare class QueueService extends QueueService_base {
25
25
  /**
26
26
  * Gets a queue by its DXN.
27
27
  */
28
- static getQueue: <T extends Obj.Any | Relation.Any = Obj.Any | Relation.Any>(dxn: DXN) => Effect.Effect<Queue<T>, never, QueueService>;
28
+ static getQueue: <T extends Entity.Unknown = Entity.Unknown>(dxn: DXN) => Effect.Effect<Queue<T>, never, QueueService>;
29
29
  /**
30
30
  * Creates a new queue.
31
31
  */
32
- static createQueue: <T extends Obj.Any | Relation.Any = Obj.Any | Relation.Any>(options?: {
32
+ static createQueue: <T extends Entity.Unknown = Entity.Unknown>(options?: {
33
33
  subspaceTag?: QueueSubspaceTag;
34
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>;
35
+ static append: <T extends Entity.Unknown = Entity.Unknown>(queue: Queue<T>, objects: T[]) => Effect.Effect<void>;
36
36
  }
37
37
  declare const ContextQueueService_base: Context.TagClass<ContextQueueService, "@dxos/functions/ContextQueueService", {
38
38
  readonly queue: Queue;
@@ -1 +1 @@
1
- {"version":3,"file":"queues.d.ts","sourceRoot":"","sources":["../../../../src/services/queues.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;;IAQpD;;OAEG;qBACc,QAAQ;IAEzB;;;OAGG;oBACa,KAAK,GAAG,SAAS;;AAfrC;;GAEG;AACH,qBAAa,YAAa,SAAQ,iBAc/B;IACD,MAAM,CAAC,YAAY,0CAUhB;IAEH,MAAM,CAAC,IAAI,GAAI,QAAQ,YAAY,EAAE,QAAQ,KAAK,KAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAKpF;IAEF,MAAM,CAAC,KAAK,GAAI,QAAQ,YAAY,EAAE,QAAQ,KAAK,KAAG,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CACf;IAEhE;;OAEG;IACH,MAAM,CAAC,QAAQ,GAAI,CAAC,SAAS,GAAG,CAAC,GAAG,GAAG,Q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'effect/Effect';
3
3
  import * as Layer from 'effect/Layer';
4
4
  import { AgentStatus } from '@dxos/ai';
5
- import { Obj } from '@dxos/echo';
6
- import type { ObjectId } from '@dxos/echo/internal';
5
+ import { type DXN, Obj, Ref } from '@dxos/echo';
6
+ import { ObjectId } from '@dxos/keys';
7
7
  import { Message } from '@dxos/types';
8
+ import type { Trigger } from '../types';
8
9
  declare const TracingService_base: Context.TagClass<TracingService, "@dxos/functions/TracingService", {
9
10
  /**
10
11
  * Gets the parent message ID.
@@ -14,7 +15,15 @@ declare const TracingService_base: Context.TagClass<TracingService, "@dxos/funct
14
15
  * Write an event to the tracing queue.
15
16
  * @param event - The event to write. Must be an a typed object.
16
17
  */
17
- write: (event: Obj.Any) => void;
18
+ write: (event: Obj.Unknown, traceContext: TracingService.TraceContext) => void;
19
+ traceInvocationStart({ payload, target, }: {
20
+ payload: TracingService.FunctionInvocationPayload;
21
+ target?: DXN;
22
+ }): Effect.Effect<TracingService.InvocationTraceData>;
23
+ traceInvocationEnd({ trace, exception, }: {
24
+ trace: TracingService.InvocationTraceData;
25
+ exception?: any;
26
+ }): Effect.Effect<void>;
18
27
  }>;
19
28
  /**
20
29
  * Provides a way for compute primitives (functions, workflows, tools)
@@ -27,6 +36,12 @@ export declare class TracingService extends TracingService_base {
27
36
  * Creates a TracingService layer that emits events to the parent tracing service.
28
37
  */
29
38
  static layerSubframe: (mapContext: (currentContext: TracingService.TraceContext) => TracingService.TraceContext) => Layer.Layer<TracingService, never, TracingService>;
39
+ /**
40
+ * Create sublayer to trace an invocation.
41
+ * @param data
42
+ * @returns
43
+ */
44
+ static layerInvocation: (data: TracingService.InvocationTraceData) => Layer.Layer<TracingService, never, TracingService>;
30
45
  /**
31
46
  * Emit the current human-readable execution status.
32
47
  */
@@ -35,6 +50,7 @@ export declare class TracingService extends TracingService_base {
35
50
  }
36
51
  export declare namespace TracingService {
37
52
  interface TraceContext {
53
+ currentInvocation?: InvocationTraceData;
38
54
  /**
39
55
  * If this thread sprung from a tool call, this is the ID of the message containing the tool call.
40
56
  */
@@ -45,6 +61,25 @@ export declare namespace TracingService {
45
61
  toolCallId?: string;
46
62
  debugInfo?: unknown;
47
63
  }
64
+ /**
65
+ * Trace data for a function/trigger invocation.
66
+ */
67
+ interface InvocationTraceData {
68
+ invocationId: ObjectId;
69
+ invocationTraceQueue?: DXN.String;
70
+ }
71
+ /**
72
+ * Payload for a function/trigger invocation.
73
+ */
74
+ interface FunctionInvocationPayload {
75
+ data?: any;
76
+ inputNodeId?: string;
77
+ trigger?: {
78
+ id: string;
79
+ kind: Trigger.Kind;
80
+ };
81
+ chat?: Ref.Ref<Obj.Unknown>;
82
+ }
48
83
  }
49
84
  /**
50
85
  * Goes into {@link Message['properties']}
@@ -1 +1 @@
1
- {"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../../../src/services/tracing.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;;IASlC;;OAEG;qBACc,MAAM,cAAc,CAAC,YAAY;IAElD;;;OAGG;WACI,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,KAAK,IAAI;;AAhBnC;;;GAGG;AACH,qBAAa,cAAe,SAAQ,mBAcjC;IACD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAG9C;IAEF,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAsD;IACnG;;OAEG;IACH,MAAM,CAAC,a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cAAc,CAAC;IAC9B,UAAiB,YAAY;QAC3B,iBAAiB,CAAC,EAAE,mBAAmB,CAAC;QAExC;;WAEG;QACH,aAAa,CAAC,EAAE,QAAQ,CAAC;QAEzB;;WAEG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;QAEpB,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB;IAED;;OAEG;IACH,UAAiB,mBAAmB;QAClC,YAAY,EAAE,QAAQ,CAAC;QACvB,oBAAoB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC;KACnC;IAED;;OAEG;IACH,UAAiB,yBAAyB;QACxC,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,OAAO,CAAC,EAAE;YACR,EAAE,EAAE,MAAM,CAAC;YACX,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC;SACpB,CAAC;QACF,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;KAC7B;CACF;AAED;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAG,YAAqB,CAAC"}
@@ -3,26 +3,19 @@ import { Obj, Type } from '@dxos/echo';
3
3
  /**
4
4
  * Source script.
5
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
- }>>;
6
+ export declare const Script: Type.Obj<{
7
+ readonly description?: string | undefined;
8
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
9
+ readonly content: string;
10
+ }>;
11
+ readonly name?: string | undefined;
12
+ readonly changed?: boolean | undefined;
13
+ }, Schema.Struct.Fields>;
14
14
  export interface Script extends Schema.Schema.Type<typeof Script> {
15
15
  }
16
16
  type Props = Omit<Obj.MakeProps<typeof Script>, 'source'> & {
17
17
  source?: string;
18
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
- }>;
19
+ export declare const make: ({ source, ...props }?: Props) => Script;
27
20
  export {};
28
21
  //# sourceMappingURL=Script.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"Script.d.ts","sourceRoot":"","sources":["../../../../src/types/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,GAAI,uBAA2B,KAAU,KAAG,MACQ,CAAC"}