@dxos/functions 0.8.3-main.672df60 → 0.8.3-staging.0fa589b

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 (65) hide show
  1. package/dist/lib/browser/chunk-WEFZUEL2.mjs +300 -0
  2. package/dist/lib/browser/chunk-WEFZUEL2.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +43 -119
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +28 -0
  7. package/dist/lib/browser/testing/index.mjs.map +7 -0
  8. package/dist/lib/node/chunk-IJAE7FZK.cjs +320 -0
  9. package/dist/lib/node/chunk-IJAE7FZK.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +41 -114
  11. package/dist/lib/node/index.cjs.map +4 -4
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/testing/index.cjs +43 -0
  14. package/dist/lib/node/testing/index.cjs.map +7 -0
  15. package/dist/lib/node-esm/chunk-LIYPMWNQ.mjs +302 -0
  16. package/dist/lib/node-esm/chunk-LIYPMWNQ.mjs.map +7 -0
  17. package/dist/lib/node-esm/index.mjs +42 -119
  18. package/dist/lib/node-esm/index.mjs.map +4 -4
  19. package/dist/lib/node-esm/meta.json +1 -1
  20. package/dist/lib/node-esm/testing/index.mjs +29 -0
  21. package/dist/lib/node-esm/testing/index.mjs.map +7 -0
  22. package/dist/types/src/handler.d.ts +2 -2
  23. package/dist/types/src/schema.d.ts +16 -35
  24. package/dist/types/src/schema.d.ts.map +1 -1
  25. package/dist/types/src/services/ai.d.ts +6 -3
  26. package/dist/types/src/services/ai.d.ts.map +1 -1
  27. package/dist/types/src/services/database.d.ts +3 -1
  28. package/dist/types/src/services/database.d.ts.map +1 -1
  29. package/dist/types/src/services/event-logger.d.ts +37 -0
  30. package/dist/types/src/services/event-logger.d.ts.map +1 -0
  31. package/dist/types/src/services/function-call-service.d.ts +16 -0
  32. package/dist/types/src/services/function-call-service.d.ts.map +1 -0
  33. package/dist/types/src/services/index.d.ts +2 -0
  34. package/dist/types/src/services/index.d.ts.map +1 -1
  35. package/dist/types/src/services/queues.d.ts +12 -4
  36. package/dist/types/src/services/queues.d.ts.map +1 -1
  37. package/dist/types/src/services/service-container.d.ts +28 -9
  38. package/dist/types/src/services/service-container.d.ts.map +1 -1
  39. package/dist/types/src/testing/index.d.ts +2 -0
  40. package/dist/types/src/testing/index.d.ts.map +1 -0
  41. package/dist/types/src/testing/logger.d.ts +5 -0
  42. package/dist/types/src/testing/logger.d.ts.map +1 -0
  43. package/dist/types/src/testing/services.d.ts +13 -0
  44. package/dist/types/src/testing/services.d.ts.map +1 -0
  45. package/dist/types/src/trace.d.ts +19 -44
  46. package/dist/types/src/trace.d.ts.map +1 -1
  47. package/dist/types/src/translations.d.ts +4 -2
  48. package/dist/types/src/translations.d.ts.map +1 -1
  49. package/dist/types/src/types.d.ts +36 -32
  50. package/dist/types/src/types.d.ts.map +1 -1
  51. package/package.json +25 -19
  52. package/src/handler.ts +2 -2
  53. package/src/schema.ts +13 -8
  54. package/src/services/ai.ts +21 -4
  55. package/src/services/database.ts +16 -2
  56. package/src/services/event-logger.ts +87 -0
  57. package/src/services/function-call-service.ts +64 -0
  58. package/src/services/index.ts +2 -0
  59. package/src/services/queues.ts +27 -6
  60. package/src/services/service-container.ts +66 -15
  61. package/src/testing/index.ts +5 -0
  62. package/src/testing/logger.ts +16 -0
  63. package/src/testing/services.ts +32 -0
  64. package/src/trace.ts +13 -13
  65. package/src/translations.ts +6 -1
@@ -1,16 +1,34 @@
1
- import { type Context } from 'effect';
1
+ import { Layer, type Context } from 'effect';
2
2
  import { AiService } from './ai';
3
3
  import { CredentialsService } from './credentials';
4
4
  import { DatabaseService } from './database';
5
- import { QueuesService } from './queues';
5
+ import { EventLogger } from './event-logger';
6
+ import { FunctionCallService } from './function-call-service';
7
+ import { QueueService } from './queues';
6
8
  import { TracingService } from './tracing';
7
- export interface Services {
8
- database: Context.Tag.Service<DatabaseService>;
9
- ai: Context.Tag.Service<AiService>;
10
- queues: Context.Tag.Service<QueuesService>;
11
- credentials: Context.Tag.Service<CredentialsService>;
12
- tracing: Context.Tag.Service<TracingService>;
9
+ /**
10
+ * List of all service tags and their names.
11
+ */
12
+ export interface ServiceTagRecord {
13
+ ai: AiService;
14
+ credentials: CredentialsService;
15
+ database: DatabaseService;
16
+ eventLogger: EventLogger;
17
+ functionCallService: FunctionCallService;
18
+ tracing: TracingService;
19
+ queues: QueueService;
13
20
  }
21
+ /**
22
+ * List of all services and their runtime types.
23
+ */
24
+ export type ServiceRecord = {
25
+ [K in keyof ServiceTagRecord]: Context.Tag.Service<ServiceTagRecord[K]>;
26
+ };
27
+ /**
28
+ * Union of all services.
29
+ */
30
+ export type Services = ServiceTagRecord[keyof ServiceTagRecord];
31
+ export declare const SERVICE_TAGS: Context.Tag<any, any>[];
14
32
  export declare class ServiceContainer {
15
33
  private _services;
16
34
  /**
@@ -18,8 +36,9 @@ export declare class ServiceContainer {
18
36
  * @param services - Services to set.
19
37
  * @returns The container instance.
20
38
  */
21
- setServices(services: Partial<Services>): this;
39
+ setServices(services: Partial<ServiceRecord>): this;
22
40
  getService<T extends Context.Tag<any, any>>(tag: T): Context.Tag.Service<T>;
23
41
  clone(): ServiceContainer;
42
+ createLayer(): Layer.Layer<Services>;
24
43
  }
25
44
  //# sourceMappingURL=service-container.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-container.d.ts","sourceRoot":"","sources":["../../../../src/services/service-container.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,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AC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,SAAS,CAAC;IACd,WAAW,EAAE,kBAAkB,CAAC;IAChC,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,WAAW,CAAC;IACzB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,YAAY,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;KACzB,CAAC,IAAI,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;CACxE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,gBAAgB,CAAC,CAAC;AAYhE,eAAO,MAAM,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAQ/C,CAAC;AAMF,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAAmD;IAEpE;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI;IAKnD,UAAU,CAAC,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAS3E,KAAK,IAAI,gBAAgB;IAKzB,WAAW,IAAI,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC;CAkBrC"}
@@ -0,0 +1,2 @@
1
+ export * from './services';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { type Context } from 'effect';
2
+ import { type EventLogger } from '../services';
3
+ export declare const noopLogger: Context.Tag.Service<EventLogger>;
4
+ export declare const consoleLogger: Context.Tag.Service<EventLogger>;
5
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/testing/logger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAI9C,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,aAAa,CAAC;AAElE,eAAO,MAAM,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAGvD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAoC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { type Context } from 'effect';
2
+ import type { AiServiceClient } from '@dxos/ai';
3
+ import type { QueueFactory } from '@dxos/echo-db';
4
+ import { ServiceContainer } from '../services';
5
+ import type { EventLogger } from '../services/event-logger';
6
+ export type TestServiceOptions = {
7
+ ai?: AiServiceClient;
8
+ queueFactory?: QueueFactory;
9
+ enableLogging?: boolean;
10
+ logger?: Context.Tag.Service<EventLogger>;
11
+ };
12
+ export declare const createTestServices: ({ ai, queueFactory, enableLogging, logger, }?: TestServiceOptions) => ServiceContainer;
13
+ //# sourceMappingURL=services.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../src/testing/services.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlD,OAAO,EAA2B,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,CAAC,EAAE,eAAe,CAAC;IACrB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,+CAKhC,kBAAuB,KAAG,gBAM5B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { Schema } from 'effect';
2
+ import { Type, type Ref } from '@dxos/echo';
2
3
  import { Queue } from '@dxos/echo-db';
3
- import { Expando, Ref } from '@dxos/echo-schema';
4
- import { type FunctionTriggerType } from './types';
4
+ import { FunctionTrigger, type FunctionTriggerType } from './types';
5
5
  export declare enum InvocationOutcome {
6
6
  SUCCESS = "success",
7
7
  FAILURE = "failure",
@@ -18,7 +18,7 @@ export declare const TraceEventException: Schema.Struct<{
18
18
  stack: Schema.optional<typeof Schema.String>;
19
19
  }>;
20
20
  export type TraceEventException = Schema.Schema.Type<typeof TraceEventException>;
21
- export declare const InvocationTraceStartEvent: import("@dxos/echo-schema").EchoTypeSchema<Schema.Struct<{
21
+ export declare const InvocationTraceStartEvent: Type.obj<Schema.Struct<{
22
22
  /**
23
23
  * Queue message id.
24
24
  */
@@ -39,46 +39,21 @@ export declare const InvocationTraceStartEvent: import("@dxos/echo-schema").Echo
39
39
  /**
40
40
  * Queue for function/workflow invocation events.
41
41
  */
42
- invocationTraceQueue: import("@dxos/echo-schema").Ref$<Queue<import("@dxos/echo-schema").AnyEchoObject>>;
42
+ invocationTraceQueue: Type.ref<Schema.Schema<Queue<import("@dxos/echo/Obj").Any | import("@dxos/echo/Relation").Any>, Queue<import("@dxos/echo/Obj").Any | import("@dxos/echo/Relation").Any>, never>>;
43
43
  /**
44
44
  * DXN of the invoked function/workflow.
45
45
  */
46
- invocationTarget: import("@dxos/echo-schema").Ref$<Expando>;
46
+ invocationTarget: Type.ref<Schema.Schema<Type.Expando, {
47
+ [x: string]: any;
48
+ id: string;
49
+ }, never>>;
47
50
  /**
48
51
  * Present for automatic invocations.
49
52
  */
50
- trigger: Schema.optional<import("@dxos/echo-schema").Ref$<import("@dxos/echo-schema").TypedObjectFields<Readonly<{
51
- function: Schema.optional<Schema.SchemaClass<Ref<Expando>, import("@dxos/echo-protocol").EncodedReference, never>>;
52
- inputNodeId: Schema.optional<Schema.SchemaClass<string, string, never>>;
53
- enabled: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
54
- spec: Schema.optional<Schema.Union<[Schema.mutable<Schema.Struct<{
55
- kind: Schema.Literal<[import("./types").TriggerKind.Timer]>;
56
- cron: Schema.SchemaClass<string, string, never>;
57
- }>>, Schema.mutable<Schema.Struct<{
58
- kind: Schema.Literal<[import("./types").TriggerKind.Webhook]>;
59
- method: Schema.optional<Schema.SchemaClass<string, string, never>>;
60
- port: Schema.optional<Schema.SchemaClass<number, number, never>>;
61
- }>>, Schema.mutable<Schema.Struct<{
62
- kind: Schema.Literal<[import("./types").TriggerKind.Subscription]>;
63
- filter: Schema.Struct<{
64
- type: Schema.optional<Schema.SchemaClass<string, string, never>>;
65
- props: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Any>>;
66
- }>;
67
- options: Schema.optional<Schema.Struct<{
68
- deep: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
69
- delay: Schema.optional<Schema.SchemaClass<number, number, never>>;
70
- }>>;
71
- }>>, Schema.mutable<Schema.Struct<{
72
- kind: Schema.Literal<[import("./types").TriggerKind.Email]>;
73
- }>>, Schema.mutable<Schema.Struct<{
74
- kind: Schema.Literal<[import("./types").TriggerKind.Queue]>;
75
- queue: Schema.refine<string, typeof Schema.NonEmptyString>;
76
- }>>]>>;
77
- input: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.Any>>>;
78
- }>, import("@dxos/echo-schema").TypedObjectOptions>>>;
79
- }>, {}>;
53
+ trigger: Schema.optional<Type.ref<typeof FunctionTrigger>>;
54
+ }>>;
80
55
  export type InvocationTraceStartEvent = Schema.Schema.Type<typeof InvocationTraceStartEvent>;
81
- export declare const InvocationTraceEndEvent: import("@dxos/echo-schema").EchoTypeSchema<Schema.Struct<{
56
+ export declare const InvocationTraceEndEvent: Type.obj<Schema.Struct<{
82
57
  /**
83
58
  * Trace event id.
84
59
  */
@@ -99,7 +74,7 @@ export declare const InvocationTraceEndEvent: import("@dxos/echo-schema").EchoTy
99
74
  name: typeof Schema.String;
100
75
  stack: Schema.optional<typeof Schema.String>;
101
76
  }>>;
102
- }>, {}>;
77
+ }>>;
103
78
  export type InvocationTraceEndEvent = Schema.Schema.Type<typeof InvocationTraceEndEvent>;
104
79
  export type InvocationTraceEvent = InvocationTraceStartEvent | InvocationTraceEndEvent;
105
80
  export declare const TraceEventLog: Schema.Struct<{
@@ -108,7 +83,7 @@ export declare const TraceEventLog: Schema.Struct<{
108
83
  message: typeof Schema.String;
109
84
  context: Schema.optional<typeof Schema.Object>;
110
85
  }>;
111
- export declare const TraceEvent: import("@dxos/echo-schema").EchoTypeSchema<Schema.Struct<{
86
+ export declare const TraceEvent: Type.obj<Schema.Struct<{
112
87
  id: import("@dxos/keys").ObjectIdClass;
113
88
  outcome: typeof Schema.String;
114
89
  truncated: typeof Schema.Boolean;
@@ -128,11 +103,11 @@ export declare const TraceEvent: import("@dxos/echo-schema").EchoTypeSchema<Sche
128
103
  name: typeof Schema.String;
129
104
  stack: Schema.optional<typeof Schema.String>;
130
105
  }>>;
131
- }>, {}>;
106
+ }>>;
132
107
  export type TraceEvent = Schema.Schema.Type<typeof TraceEvent>;
133
108
  /**
134
- * Deprecated InvocationTrace event format.
135
- * @deprecated
109
+ * InvocationTrace event format.
110
+ * This is the combined format of InvocationTraceStartEvent and InvocationTraceEndEvents for UI consumption.
136
111
  */
137
112
  export type InvocationSpan = {
138
113
  id: string;
@@ -140,9 +115,9 @@ export type InvocationSpan = {
140
115
  outcome: InvocationOutcome;
141
116
  input: object;
142
117
  durationMs: number;
143
- invocationTraceQueue: Ref<Queue>;
144
- invocationTarget: Ref<Expando>;
145
- trigger?: Ref<FunctionTriggerType>;
118
+ invocationTraceQueue: Ref.Ref<Queue>;
119
+ invocationTarget: Ref.Ref<Type.Expando>;
120
+ trigger?: Ref.Ref<FunctionTriggerType>;
146
121
  exception?: TraceEventException;
147
122
  };
148
123
  export declare const createInvocationSpans: (items?: InvocationTraceEvent[]) => InvocationSpan[];
@@ -1 +1 @@
1
- {"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../../src/trace.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAc,OAAO,EAAY,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGvE,OAAO,EAAmB,KAAK,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEpE,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAGD,oBAAY,wBAAwB;IAClC,KAAK,UAAU;IACf,GAAG,QAAQ;CACZ;AAED,eAAO,MAAM,mBAAmB;;;;;EAK9B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEjF,eAAO,MAAM,yBAAyB;IACpC;;OAEG;;;IAGH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAGH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAEoF,CAAC;AAE1F,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE7F,eAA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AAC,KAAK,CAAC,CAAC;IACrC,gBAAgB,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACvC,SAAS,CAAC,EAAE,mBAAmB,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,QAAQ,oBAAoB,EAAE,KAAG,cAAc,EAkDpF,CAAC"}
@@ -1,8 +1,10 @@
1
- import { ScriptType } from './schema';
2
1
  declare const _default: {
3
2
  'en-US': {
4
- [ScriptType.typename]: {
3
+ [x: string]: {
5
4
  'typename label': string;
5
+ 'typename label_zero': string;
6
+ 'typename label_one': string;
7
+ 'typename label_other': string;
6
8
  };
7
9
  };
8
10
  }[];
@@ -1 +1 @@
1
- {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;;;QAKhC,CAAC,UAAU,CAAC,QAAQ,CAAC;;UAEpB;;;AALP,wBAQE"}
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":";;;;;;;;;;AAQA,wBAWE"}
@@ -1,6 +1,5 @@
1
1
  import { Schema } from 'effect';
2
2
  import { Expando, Ref } from '@dxos/echo-schema';
3
- import { FunctionType } from './schema';
4
3
  /**
5
4
  * Type discriminator for TriggerType.
6
5
  * Every spec has a type field of type TriggerKind that we can use to understand which type we're working with.
@@ -270,41 +269,31 @@ export declare class FunctionTrigger extends FunctionTrigger_base {
270
269
  * Function manifest file.
271
270
  */
272
271
  export declare const FunctionManifestSchema: Schema.Struct<{
273
- functions: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<import("@dxos/echo-schema").ExcludeId<import("@dxos/echo-schema").TypedObjectFields<{
274
- name: typeof Schema.NonEmptyString;
275
- version: typeof Schema.String;
276
- description: Schema.optional<typeof Schema.String>;
277
- source: Schema.optional<import("@dxos/echo-schema").Ref$<{
278
- readonly id: string;
272
+ functions: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<import("@dxos/echo-schema").ExcludeId<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
273
+ name: string;
274
+ description?: string | undefined;
275
+ source?: Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
279
276
  name?: string | undefined;
280
277
  description?: string | undefined;
281
278
  changed?: boolean | undefined;
282
- source: Ref<{
283
- readonly id: string;
279
+ source: Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
284
280
  content: string;
285
281
  }>;
286
- }>>;
287
- inputSchema: Schema.optional<Schema.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
288
- outputSchema: Schema.optional<Schema.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
289
- binding: Schema.optional<typeof Schema.String>;
290
- }, import("@dxos/echo-schema").TypedObjectOptions>> & import("@dxos/echo-schema").WithMeta, Schema.Struct.Encoded<{
291
- name: typeof Schema.NonEmptyString;
292
- version: typeof Schema.String;
293
- description: Schema.optional<typeof Schema.String>;
294
- source: Schema.optional<import("@dxos/echo-schema").Ref$<{
295
- readonly id: string;
296
- name?: string | undefined;
297
- description?: string | undefined;
298
- changed?: boolean | undefined;
299
- source: Ref<{
300
- readonly id: string;
301
- content: string;
302
- }>;
303
- }>>;
304
- inputSchema: Schema.optional<Schema.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
305
- outputSchema: Schema.optional<Schema.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
306
- binding: Schema.optional<typeof Schema.String>;
307
- }>, never>>>>;
282
+ }> | undefined;
283
+ version: string;
284
+ inputSchema?: import("@dxos/echo-schema").JsonSchemaType | undefined;
285
+ outputSchema?: import("@dxos/echo-schema").JsonSchemaType | undefined;
286
+ binding?: string | undefined;
287
+ }> & import("@dxos/echo-schema").WithMeta, {
288
+ id: string;
289
+ name: string;
290
+ version: string;
291
+ description?: string | undefined;
292
+ source?: import("@dxos/echo-protocol").EncodedReference | undefined;
293
+ inputSchema?: import("@dxos/echo-schema").JsonSchemaType | undefined;
294
+ outputSchema?: import("@dxos/echo-schema").JsonSchemaType | undefined;
295
+ binding?: string | undefined;
296
+ }, never>>>>;
308
297
  triggers: Schema.optional<Schema.mutable<Schema.Array$<Schema.Schema<import("@dxos/echo-schema").ExcludeId<import("@dxos/echo-schema").TypedObjectFields<Readonly<{
309
298
  /**
310
299
  * Function or workflow to invoke.
@@ -402,6 +391,21 @@ export declare const FunctionManifestSchema: Schema.Struct<{
402
391
  }>>, never>>>>;
403
392
  }>;
404
393
  export type FunctionManifest = Schema.Schema.Type<typeof FunctionManifestSchema>;
405
- export declare const FUNCTION_TYPES: (typeof FunctionType | typeof FunctionTrigger)[];
394
+ export declare const FUNCTION_TYPES: (import("@dxos/echo/Type").obj<Schema.Struct<{
395
+ name: typeof Schema.NonEmptyString;
396
+ version: typeof Schema.String;
397
+ description: Schema.optional<typeof Schema.String>;
398
+ source: Schema.optional<import("@dxos/echo-schema").Ref$<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
399
+ name?: string | undefined;
400
+ description?: string | undefined;
401
+ changed?: boolean | undefined;
402
+ source: Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
403
+ content: string;
404
+ }>;
405
+ }>>;
406
+ inputSchema: Schema.optional<Schema.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
407
+ outputSchema: Schema.optional<Schema.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
408
+ binding: Schema.optional<typeof Schema.String>;
409
+ }>> | typeof FunctionTrigger)[];
406
410
  export {};
407
411
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAa,MAAM,QAAQ,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAoC,GAAG,EAAa,MAAM,mBAAmB,CAAC;AAG9F,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;;;;GAIG;AACH,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAID;;GAEG;AACH,QAAA,MAAM,kBAAkB;;;GAMD,CAAC;AACxB,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEzE,QAAA,MAAM,kBAAkB;;GAED,CAAC;AACxB,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEzE,QAAA,MAAM,kBAAkB;;;GAGD,CAAC;AACxB,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEzE;;GAEG;AACH,QAAA,MAAM,oBAAoB;;;;GAaH,CAAC;AACxB,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAQ7E;;GAEG;AACH,QAAA,MAAM,yBAAyB;;;;;;;;;;GAYR,CAAC;AACxB,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAEvF;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;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AG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE/E;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;IAChC;;OAEG;;IAIH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;IAOH;;;;;;;;;;OAUG;;EAEH,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,qBAAqB,CAAC,CAAC;;IA/BjF;;OAEG;;IAIH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;IAOH;;;;;;;;;;OAUG;;;IA3BH;;OAEG;;IAIH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;IAOH;;;;;;;;;;OAUG;;;AAML;;GAEG;AACH,qBAAa,eAAgB,SAAQ,oBAGL;CAAG;AAInC;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;QA9CjC;;WAEG;;QAIH;;;;WAIG;;;;;;;;;;;;;;;;;;;;;;;;;;QAOH;;;;;;;;;;WAUG;;;QA3BH;;WAEG;;QAIH;;;;WAIG;;;;;;;;;;;;;;;;;;;;;;;;;;QAOH;;;;;;;;;;WAUG;;;EAsBH,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEjF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;+BAAkC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/functions",
3
- "version": "0.8.3-main.672df60",
3
+ "version": "0.8.3-staging.0fa589b",
4
4
  "description": "Functions API and runtime.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -23,6 +23,11 @@
23
23
  "types": "./dist/types/src/edge/index.d.ts",
24
24
  "browser": "./dist/lib/browser/edge/index.mjs",
25
25
  "node": "./dist/lib/node-esm/edge/index.mjs"
26
+ },
27
+ "./testing": {
28
+ "types": "./dist/types/src/testing/index.d.ts",
29
+ "browser": "./dist/lib/browser/testing/index.mjs",
30
+ "node": "./dist/lib/node-esm/testing/index.mjs"
26
31
  }
27
32
  },
28
33
  "types": "dist/types/src/index.d.ts",
@@ -51,28 +56,29 @@
51
56
  "get-port-please": "^3.1.1",
52
57
  "iso-did": "^1.6.0",
53
58
  "ws": "^8.14.2",
54
- "@dxos/ai": "0.8.3-main.672df60",
55
- "@dxos/context": "0.8.3-main.672df60",
56
- "@dxos/async": "0.8.3-main.672df60",
57
- "@dxos/client": "0.8.3-main.672df60",
58
- "@dxos/echo-db": "0.8.3-main.672df60",
59
- "@dxos/echo-protocol": "0.8.3-main.672df60",
60
- "@dxos/crypto": "0.8.3-main.672df60",
61
- "@dxos/invariant": "0.8.3-main.672df60",
62
- "@dxos/echo-schema": "0.8.3-main.672df60",
63
- "@dxos/edge-client": "0.8.3-main.672df60",
64
- "@dxos/keys": "0.8.3-main.672df60",
65
- "@dxos/node-std": "0.8.3-main.672df60",
66
- "@dxos/protocols": "0.8.3-main.672df60",
67
- "@dxos/live-object": "0.8.3-main.672df60",
68
- "@dxos/log": "0.8.3-main.672df60",
69
- "@dxos/schema": "0.8.3-main.672df60",
70
- "@dxos/util": "0.8.3-main.672df60"
59
+ "@dxos/ai": "0.8.3-staging.0fa589b",
60
+ "@dxos/client": "0.8.3-staging.0fa589b",
61
+ "@dxos/async": "0.8.3-staging.0fa589b",
62
+ "@dxos/context": "0.8.3-staging.0fa589b",
63
+ "@dxos/crypto": "0.8.3-staging.0fa589b",
64
+ "@dxos/echo-db": "0.8.3-staging.0fa589b",
65
+ "@dxos/echo-protocol": "0.8.3-staging.0fa589b",
66
+ "@dxos/echo": "0.8.3-staging.0fa589b",
67
+ "@dxos/echo-schema": "0.8.3-staging.0fa589b",
68
+ "@dxos/edge-client": "0.8.3-staging.0fa589b",
69
+ "@dxos/keys": "0.8.3-staging.0fa589b",
70
+ "@dxos/invariant": "0.8.3-staging.0fa589b",
71
+ "@dxos/live-object": "0.8.3-staging.0fa589b",
72
+ "@dxos/log": "0.8.3-staging.0fa589b",
73
+ "@dxos/node-std": "0.8.3-staging.0fa589b",
74
+ "@dxos/protocols": "0.8.3-staging.0fa589b",
75
+ "@dxos/util": "0.8.3-staging.0fa589b",
76
+ "@dxos/schema": "0.8.3-staging.0fa589b"
71
77
  },
72
78
  "devDependencies": {
73
79
  "@types/express": "^4.17.17",
74
80
  "@types/ws": "^7.4.0",
75
- "@dxos/agent": "0.8.3-main.672df60"
81
+ "@dxos/agent": "0.8.3-staging.0fa589b"
76
82
  },
77
83
  "publishConfig": {
78
84
  "access": "public"
package/src/handler.ts CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { Schema, type Context, type Effect } from 'effect';
6
6
 
7
- import { type AIServiceClient } from '@dxos/ai';
7
+ import { type AiServiceClient } from '@dxos/ai';
8
8
  // import { type Space } from '@dxos/client/echo';
9
9
  import type { CoreDatabase, EchoDatabase } from '@dxos/echo-db';
10
10
  import { type HasId } from '@dxos/echo-schema';
@@ -50,7 +50,7 @@ export interface FunctionContext {
50
50
  */
51
51
  space: SpaceAPI | undefined;
52
52
 
53
- ai: AIServiceClient;
53
+ ai: AiServiceClient;
54
54
  }
55
55
 
56
56
  export interface FunctionContextAi {
package/src/schema.ts CHANGED
@@ -4,7 +4,8 @@
4
4
 
5
5
  import { Schema } from 'effect';
6
6
 
7
- import { EchoObject, JsonSchemaType, LabelAnnotation, Ref, TypedObject } from '@dxos/echo-schema';
7
+ import { Type } from '@dxos/echo';
8
+ import { JsonSchemaType, LabelAnnotation, Ref } from '@dxos/echo-schema';
8
9
  import { DataType } from '@dxos/schema';
9
10
 
10
11
  /**
@@ -18,22 +19,19 @@ export const ScriptType = Schema.Struct({
18
19
  changed: Schema.optional(Schema.Boolean),
19
20
  source: Ref(DataType.Text),
20
21
  }).pipe(
21
- EchoObject({
22
+ Type.Obj({
22
23
  typename: 'dxos.org/type/Script',
23
24
  version: '0.1.0',
24
25
  }),
25
26
  LabelAnnotation.set(['name']),
26
27
  );
27
28
 
28
- export type ScriptType = Schema.Schema.Type<typeof ScriptType>;
29
+ export interface ScriptType extends Schema.Schema.Type<typeof ScriptType> {}
29
30
 
30
31
  /**
31
32
  * Function deployment.
32
33
  */
33
- export class FunctionType extends TypedObject({
34
- typename: 'dxos.org/type/Function',
35
- version: '0.1.0',
36
- })({
34
+ export const FunctionType = Schema.Struct({
37
35
  // TODO(burdon): Rename to id/uri?
38
36
  name: Schema.NonEmptyString,
39
37
  version: Schema.String,
@@ -49,4 +47,11 @@ export class FunctionType extends TypedObject({
49
47
 
50
48
  // Local binding to a function name.
51
49
  binding: Schema.optional(Schema.String),
52
- }) {}
50
+ }).pipe(
51
+ Type.Obj({
52
+ typename: 'dxos.org/type/Function',
53
+ version: '0.1.0',
54
+ }),
55
+ LabelAnnotation.set(['name']),
56
+ );
57
+ export interface FunctionType extends Schema.Schema.Type<typeof FunctionType> {}
@@ -2,14 +2,31 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Context } from 'effect';
5
+ import { Context, Layer } from 'effect';
6
6
 
7
- import type { AIServiceClient } from '@dxos/ai';
7
+ import type { AiServiceClient } from '@dxos/ai';
8
8
 
9
9
  // TODO(burdon): Move to @dxos/ai.
10
10
  export class AiService extends Context.Tag('AiService')<
11
11
  AiService,
12
12
  {
13
- readonly client: AIServiceClient;
13
+ readonly client: AiServiceClient;
14
14
  }
15
- >() {}
15
+ >() {
16
+ static make = (client: AiServiceClient): Context.Tag.Service<AiService> => {
17
+ return {
18
+ get client() {
19
+ return client;
20
+ },
21
+ };
22
+ };
23
+
24
+ static makeLayer = (client: AiServiceClient): Layer.Layer<AiService> =>
25
+ Layer.succeed(AiService, AiService.make(client));
26
+
27
+ static notAvailable = Layer.succeed(AiService, {
28
+ get client(): AiServiceClient {
29
+ throw new Error('AiService not available');
30
+ },
31
+ });
32
+ }
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Context } from 'effect';
5
+ import { Context, Layer } from 'effect';
6
6
 
7
7
  import type { EchoDatabase } from '@dxos/echo-db';
8
8
 
@@ -11,4 +11,18 @@ export class DatabaseService extends Context.Tag('DatabaseService')<
11
11
  {
12
12
  readonly db: EchoDatabase;
13
13
  }
14
- >() {}
14
+ >() {
15
+ static notAvailable = Layer.succeed(DatabaseService, {
16
+ get db(): EchoDatabase {
17
+ throw new Error('Database not available');
18
+ },
19
+ });
20
+
21
+ static make = (db: EchoDatabase): Context.Tag.Service<DatabaseService> => {
22
+ return {
23
+ get db() {
24
+ return db;
25
+ },
26
+ };
27
+ };
28
+ }