@dxos/functions 0.8.4-main.3f58842 → 0.8.4-main.548089c
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.
- package/dist/lib/browser/index.mjs +663 -363
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +663 -363
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/errors.d.ts +81 -28
- package/dist/types/src/errors.d.ts.map +1 -1
- package/dist/types/src/example/fib.d.ts +7 -0
- package/dist/types/src/example/fib.d.ts.map +1 -0
- package/dist/types/src/example/forex-effect.d.ts +3 -0
- package/dist/types/src/example/forex-effect.d.ts.map +1 -0
- package/dist/types/src/example/index.d.ts +12 -0
- package/dist/types/src/example/index.d.ts.map +1 -0
- package/dist/types/src/example/reply.d.ts +3 -0
- package/dist/types/src/example/reply.d.ts.map +1 -0
- package/dist/types/src/example/sleep.d.ts +5 -0
- package/dist/types/src/example/sleep.d.ts.map +1 -0
- package/dist/types/src/handler.d.ts +56 -36
- package/dist/types/src/handler.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/services/credentials.d.ts +20 -3
- package/dist/types/src/services/credentials.d.ts.map +1 -1
- package/dist/types/src/services/event-logger.d.ts +80 -30
- package/dist/types/src/services/event-logger.d.ts.map +1 -1
- package/dist/types/src/services/function-invocation-service.d.ts +11 -0
- package/dist/types/src/services/function-invocation-service.d.ts.map +1 -0
- package/dist/types/src/services/index.d.ts +6 -5
- package/dist/types/src/services/index.d.ts.map +1 -1
- package/dist/types/src/services/queues.d.ts +23 -6
- package/dist/types/src/services/queues.d.ts.map +1 -1
- package/dist/types/src/services/tracing.d.ts +35 -6
- package/dist/types/src/services/tracing.d.ts.map +1 -1
- package/dist/types/src/types/Function.d.ts +52 -0
- package/dist/types/src/types/Function.d.ts.map +1 -0
- package/dist/types/src/types/Script.d.ts +28 -0
- package/dist/types/src/types/Script.d.ts.map +1 -0
- package/dist/types/src/types/Trigger.d.ts +139 -0
- package/dist/types/src/types/Trigger.d.ts.map +1 -0
- package/dist/types/src/types/TriggerEvent.d.ts +44 -0
- package/dist/types/src/types/TriggerEvent.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +5 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/url.d.ts +7 -12
- package/dist/types/src/url.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -68
- package/src/errors.ts +13 -5
- package/src/example/fib.ts +32 -0
- package/src/example/forex-effect.ts +40 -0
- package/src/example/index.ts +13 -0
- package/src/example/reply.ts +21 -0
- package/src/example/sleep.ts +24 -0
- package/src/handler.ts +145 -64
- package/src/index.ts +3 -7
- package/src/services/credentials.ts +85 -3
- package/src/services/event-logger.ts +77 -37
- package/src/services/function-invocation-service.ts +20 -0
- package/src/services/index.ts +7 -5
- package/src/services/queues.ts +39 -10
- package/src/services/tracing.ts +82 -16
- package/src/types/Function.ts +56 -0
- package/src/types/Script.ts +33 -0
- package/src/types/Trigger.ts +139 -0
- package/src/types/TriggerEvent.ts +62 -0
- package/src/types/index.ts +8 -0
- package/src/url.ts +12 -33
- package/dist/lib/browser/bundler/index.mjs +0 -247
- package/dist/lib/browser/bundler/index.mjs.map +0 -7
- package/dist/lib/browser/chunk-3NGCSUEW.mjs +0 -328
- package/dist/lib/browser/chunk-3NGCSUEW.mjs.map +0 -7
- package/dist/lib/browser/edge/index.mjs +0 -69
- package/dist/lib/browser/edge/index.mjs.map +0 -7
- package/dist/lib/browser/testing/index.mjs +0 -91
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/bundler/index.mjs +0 -249
- package/dist/lib/node-esm/bundler/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FJ2MU7TL.mjs +0 -330
- package/dist/lib/node-esm/chunk-FJ2MU7TL.mjs.map +0 -7
- package/dist/lib/node-esm/edge/index.mjs +0 -71
- package/dist/lib/node-esm/edge/index.mjs.map +0 -7
- package/dist/lib/node-esm/testing/index.mjs +0 -92
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/bundler/bundler.d.ts +0 -50
- package/dist/types/src/bundler/bundler.d.ts.map +0 -1
- package/dist/types/src/bundler/bundler.test.d.ts +0 -2
- package/dist/types/src/bundler/bundler.test.d.ts.map +0 -1
- package/dist/types/src/bundler/index.d.ts +0 -2
- package/dist/types/src/bundler/index.d.ts.map +0 -1
- package/dist/types/src/edge/functions.d.ts +0 -16
- package/dist/types/src/edge/functions.d.ts.map +0 -1
- package/dist/types/src/edge/index.d.ts +0 -2
- package/dist/types/src/edge/index.d.ts.map +0 -1
- package/dist/types/src/executor/executor.d.ts +0 -8
- package/dist/types/src/executor/executor.d.ts.map +0 -1
- package/dist/types/src/executor/index.d.ts +0 -2
- package/dist/types/src/executor/index.d.ts.map +0 -1
- package/dist/types/src/schema.d.ts +0 -38
- package/dist/types/src/schema.d.ts.map +0 -1
- package/dist/types/src/services/database.d.ts +0 -29
- package/dist/types/src/services/database.d.ts.map +0 -1
- package/dist/types/src/services/function-call-service.d.ts +0 -16
- package/dist/types/src/services/function-call-service.d.ts.map +0 -1
- package/dist/types/src/services/service-container.d.ts +0 -56
- package/dist/types/src/services/service-container.d.ts.map +0 -1
- package/dist/types/src/services/service-registry.d.ts +0 -29
- package/dist/types/src/services/service-registry.d.ts.map +0 -1
- package/dist/types/src/services/service-registry.test.d.ts +0 -2
- package/dist/types/src/services/service-registry.test.d.ts.map +0 -1
- package/dist/types/src/testing/index.d.ts +0 -3
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/dist/types/src/testing/layer.d.ts +0 -10
- package/dist/types/src/testing/layer.d.ts.map +0 -1
- package/dist/types/src/testing/logger.d.ts +0 -5
- package/dist/types/src/testing/logger.d.ts.map +0 -1
- package/dist/types/src/testing/services.d.ts +0 -70
- package/dist/types/src/testing/services.d.ts.map +0 -1
- package/dist/types/src/trace.d.ts +0 -124
- package/dist/types/src/trace.d.ts.map +0 -1
- package/dist/types/src/translations.d.ts +0 -12
- package/dist/types/src/translations.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -411
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/bundler/bundler.test.ts +0 -59
- package/src/bundler/bundler.ts +0 -292
- package/src/bundler/index.ts +0 -5
- package/src/edge/functions.ts +0 -64
- package/src/edge/index.ts +0 -9
- package/src/executor/executor.ts +0 -54
- package/src/executor/index.ts +0 -5
- package/src/schema.ts +0 -57
- package/src/services/database.ts +0 -70
- package/src/services/function-call-service.ts +0 -64
- package/src/services/service-container.ts +0 -113
- package/src/services/service-registry.test.ts +0 -42
- package/src/services/service-registry.ts +0 -56
- package/src/testing/index.ts +0 -6
- package/src/testing/layer.ts +0 -31
- package/src/testing/logger.ts +0 -16
- package/src/testing/services.ts +0 -168
- package/src/trace.ts +0 -180
- package/src/translations.ts +0 -20
- package/src/types.ts +0 -211
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import type
|
|
4
|
-
import { type
|
|
5
|
-
import { type
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import * as Schema from 'effect/Schema';
|
|
3
|
+
import { type AiService } from '@dxos/ai';
|
|
4
|
+
import { type DatabaseService } from '@dxos/echo-db';
|
|
5
|
+
import { type CredentialsService, type FunctionInvocationService, type QueueService, type TracingService } from './services';
|
|
6
|
+
import { Function } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* Services that are provided at the function call site by the caller.
|
|
9
|
+
*/
|
|
10
|
+
export type InvocationServices = TracingService;
|
|
11
|
+
/**
|
|
12
|
+
* Services that are available to invoked functions.
|
|
13
|
+
*/
|
|
14
|
+
export type FunctionServices = InvocationServices | AiService.AiService | CredentialsService | DatabaseService | QueueService | FunctionInvocationService;
|
|
8
15
|
/**
|
|
9
16
|
* Function handler.
|
|
10
17
|
*/
|
|
@@ -19,44 +26,57 @@ export type FunctionHandler<TData = {}, TOutput = any> = (params: {
|
|
|
19
26
|
* This will be the payload from the trigger or other data passed into the function in a workflow.
|
|
20
27
|
*/
|
|
21
28
|
data: TData;
|
|
22
|
-
}) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any,
|
|
29
|
+
}) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any, FunctionServices>;
|
|
23
30
|
/**
|
|
24
31
|
* Function context.
|
|
25
32
|
*/
|
|
26
33
|
export interface FunctionContext {
|
|
27
|
-
/**
|
|
28
|
-
* Space from which the function was invoked.
|
|
29
|
-
*/
|
|
30
|
-
space: SpaceAPI | undefined;
|
|
31
|
-
ai: AiServiceClient;
|
|
32
|
-
/**
|
|
33
|
-
* Resolves a service available to the function.
|
|
34
|
-
* @throws if the service is not available.
|
|
35
|
-
*/
|
|
36
|
-
getService: <T extends Context.Tag<any, any>>(tag: T) => Context.Tag.Service<T>;
|
|
37
|
-
getSpace: (spaceId: SpaceId) => Promise<SpaceAPI>;
|
|
38
|
-
}
|
|
39
|
-
export interface FunctionContextAi {
|
|
40
|
-
run(model: string, inputs: any, options?: any): Promise<any>;
|
|
41
|
-
}
|
|
42
|
-
export interface QueuesAPI {
|
|
43
|
-
queryQueue(queue: DXN, options?: {}): Promise<QueryResult>;
|
|
44
|
-
insertIntoQueue(queue: DXN, objects: HasId[]): Promise<void>;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Space interface available to functions.
|
|
48
|
-
*/
|
|
49
|
-
export interface SpaceAPI {
|
|
50
|
-
get id(): SpaceId;
|
|
51
|
-
get db(): EchoDatabase;
|
|
52
|
-
get queues(): QueuesAPI;
|
|
53
34
|
}
|
|
54
|
-
|
|
35
|
+
declare const typeId: unique symbol;
|
|
36
|
+
export type FunctionDefinition<T = any, O = any> = {
|
|
37
|
+
[typeId]: true;
|
|
38
|
+
key: string;
|
|
55
39
|
name: string;
|
|
56
40
|
description?: string;
|
|
57
41
|
inputSchema: Schema.Schema<T, any>;
|
|
58
42
|
outputSchema?: Schema.Schema<O, any>;
|
|
59
43
|
handler: FunctionHandler<T, O>;
|
|
44
|
+
meta?: {
|
|
45
|
+
/**
|
|
46
|
+
* Tools that are projected from functions have this annotation.
|
|
47
|
+
*
|
|
48
|
+
* deployedFunctionId:
|
|
49
|
+
* - Backend deployment ID assigned by the EDGE function service (typically a UUID).
|
|
50
|
+
* - Used for remote invocation via `FunctionInvocationService` → `RemoteFunctionExecutionService`.
|
|
51
|
+
* - Persisted on the corresponding ECHO `Function.Function` object's metadata under the
|
|
52
|
+
* `FUNCTIONS_META_KEY` and retrieved with `getUserFunctionIdInMetadata`.
|
|
53
|
+
*/
|
|
54
|
+
deployedFunctionId?: string;
|
|
55
|
+
};
|
|
60
56
|
};
|
|
61
|
-
export
|
|
57
|
+
export type FunctionProps<T, O> = {
|
|
58
|
+
key: string;
|
|
59
|
+
name: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
inputSchema: Schema.Schema<T, any>;
|
|
62
|
+
outputSchema?: Schema.Schema<O, any>;
|
|
63
|
+
handler: FunctionHandler<T, O>;
|
|
64
|
+
};
|
|
65
|
+
export declare const defineFunction: {
|
|
66
|
+
<I, O>(params: FunctionProps<I, O>): FunctionDefinition<I, O>;
|
|
67
|
+
};
|
|
68
|
+
export declare const FunctionDefinition: {
|
|
69
|
+
make: <I, O>(params: FunctionProps<I, O>) => FunctionDefinition<I, O>;
|
|
70
|
+
isFunction: (value: unknown) => value is FunctionDefinition.Any;
|
|
71
|
+
serialize: (functionDef: FunctionDefinition.Any) => Function.Function;
|
|
72
|
+
deserialize: (functionObj: Function.Function) => FunctionDefinition.Any;
|
|
73
|
+
};
|
|
74
|
+
export declare namespace FunctionDefinition {
|
|
75
|
+
type Any = FunctionDefinition<any, any>;
|
|
76
|
+
type Input<T extends FunctionDefinition> = T extends FunctionDefinition<infer I, any> ? I : never;
|
|
77
|
+
type Output<T extends FunctionDefinition> = T extends FunctionDefinition<any, infer O> ? O : never;
|
|
78
|
+
}
|
|
79
|
+
export declare const serializeFunction: (functionDef: FunctionDefinition<any, any>) => Function.Function;
|
|
80
|
+
export declare const deserializeFunction: (functionObj: Function.Function) => FunctionDefinition<unknown, unknown>;
|
|
81
|
+
export {};
|
|
62
82
|
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/handler.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/handler.ts"],"names":[],"mappings":"AAIA,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,IAAI,CAAC,MAAM,EAAE;IAChE;;OAEG;IACH,OAAO,EAAE,eAAe,CAAC;IAEzB;;;;OAIG;IACH,IAAI,EAAE,KAAK,CAAC;CACb,K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CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CA+C/D,CAAC;AAEF,eAAO,MAAM,kBAAkB;WAjD5B,CAAC,EAAE,CAAC,UAAU,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC;wBAmDzC,OAAO,KAAG,KAAK,IAAI,kBAAkB,CAAC,GAAG;6BAGpC,kBAAkB,CAAC,GAAG,KAAG,QAAQ,CAAC,QAAQ;+BAIxC,QAAQ,CAAC,QAAQ,KAAG,kBAAkB,CAAC,GAAG;CAItE,CAAC;AACF,MAAM,CAAC,OAAO,WAAW,kBAAkB,CAAC;IAC1C,KAAY,GAAG,GAAG,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC/C,KAAY,KAAK,CAAC,CAAC,SAAS,kBAAkB,IAAI,CAAC,SAAS,kBAAkB,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACzG,KAAY,MAAM,CAAC,CAAC,SAAS,kBAAkB,IAAI,CAAC,SAAS,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;CAC3G;AAED,eAAO,MAAM,iBAAiB,GAAI,aAAa,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,KAAG,QAAQ,CAAC,QAatF,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,aAAa,QAAQ,CAAC,QAAQ,KAAG,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAevG,CAAC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
+
export * from './errors';
|
|
2
|
+
export * from './example';
|
|
1
3
|
export * from './handler';
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './trace';
|
|
4
|
+
export * from './services';
|
|
4
5
|
export * from './types';
|
|
5
6
|
export * from './url';
|
|
6
|
-
export * from './services';
|
|
7
|
-
export * from './executor';
|
|
8
|
-
export * from './errors';
|
|
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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
type
|
|
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 = {
|
|
3
9
|
service?: string;
|
|
4
10
|
};
|
|
5
11
|
export type ServiceCredential = {
|
|
6
12
|
service: string;
|
|
7
13
|
apiKey?: string;
|
|
8
14
|
};
|
|
9
|
-
declare const CredentialsService_base: Context.TagClass<CredentialsService, "CredentialsService", {
|
|
15
|
+
declare const CredentialsService_base: Context.TagClass<CredentialsService, "@dxos/functions/CredentialsService", {
|
|
10
16
|
/**
|
|
11
17
|
* Query all.
|
|
12
18
|
*/
|
|
@@ -19,6 +25,13 @@ declare const CredentialsService_base: Context.TagClass<CredentialsService, "Cre
|
|
|
19
25
|
}>;
|
|
20
26
|
export declare class CredentialsService extends CredentialsService_base {
|
|
21
27
|
static getCredential: (query: CredentialQuery) => Effect.Effect<ServiceCredential, never, CredentialsService>;
|
|
28
|
+
static getApiKey: (query: CredentialQuery) => Effect.Effect<Redacted.Redacted<string>, never, CredentialsService>;
|
|
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>;
|
|
34
|
+
static layerFromDatabase: () => Layer.Layer<CredentialsService, never, DatabaseService>;
|
|
22
35
|
}
|
|
23
36
|
export declare class ConfiguredCredentialsService implements Context.Tag.Service<CredentialsService> {
|
|
24
37
|
private readonly credentials;
|
|
@@ -27,5 +40,9 @@ export declare class ConfiguredCredentialsService implements Context.Tag.Service
|
|
|
27
40
|
queryCredentials(query: CredentialQuery): Promise<ServiceCredential[]>;
|
|
28
41
|
getCredential(query: CredentialQuery): Promise<ServiceCredential>;
|
|
29
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>;
|
|
30
47
|
export {};
|
|
31
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,
|
|
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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,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,37 +1,87 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Context from 'effect/Context';
|
|
2
|
+
import * as Effect from 'effect/Effect';
|
|
3
|
+
import * as Layer from 'effect/Layer';
|
|
4
|
+
import * as Schema from 'effect/Schema';
|
|
5
|
+
import { Type } from '@dxos/echo';
|
|
2
6
|
import { LogLevel } from '@dxos/log';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
type:
|
|
13
|
-
nodeId:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
7
|
+
import { TracingService } from './tracing';
|
|
8
|
+
export declare const ComputeEventPayload: Schema.Union<[Schema.Struct<{
|
|
9
|
+
type: Schema.Literal<["begin-compute"]>;
|
|
10
|
+
nodeId: typeof Schema.String;
|
|
11
|
+
/**
|
|
12
|
+
* Names of the inputs begin computed.
|
|
13
|
+
*/
|
|
14
|
+
inputs: Schema.Array$<typeof Schema.String>;
|
|
15
|
+
}>, Schema.Struct<{
|
|
16
|
+
type: Schema.Literal<["end-compute"]>;
|
|
17
|
+
nodeId: typeof Schema.String;
|
|
18
|
+
/**
|
|
19
|
+
* Names of the outputs computed.
|
|
20
|
+
*/
|
|
21
|
+
outputs: Schema.Array$<typeof Schema.String>;
|
|
22
|
+
}>, Schema.Struct<{
|
|
23
|
+
type: Schema.Literal<["compute-input"]>;
|
|
24
|
+
nodeId: typeof Schema.String;
|
|
25
|
+
property: typeof Schema.String;
|
|
26
|
+
value: typeof Schema.Any;
|
|
27
|
+
}>, Schema.Struct<{
|
|
28
|
+
type: Schema.Literal<["compute-output"]>;
|
|
29
|
+
nodeId: typeof Schema.String;
|
|
30
|
+
property: typeof Schema.String;
|
|
31
|
+
value: typeof Schema.Any;
|
|
32
|
+
}>, Schema.Struct<{
|
|
33
|
+
type: Schema.Literal<["custom"]>;
|
|
34
|
+
nodeId: typeof Schema.String;
|
|
35
|
+
event: typeof Schema.Any;
|
|
36
|
+
}>]>;
|
|
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
|
+
}>>;
|
|
69
|
+
declare const ComputeEventLogger_base: Context.TagClass<ComputeEventLogger, "@dxos/functions/ComputeEventLogger", {
|
|
70
|
+
readonly log: (event: ComputeEventPayload) => void;
|
|
28
71
|
readonly nodeId: string | undefined;
|
|
29
72
|
}>;
|
|
30
|
-
|
|
31
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Logs event for the compute workflows.
|
|
75
|
+
*/
|
|
76
|
+
export declare class ComputeEventLogger extends ComputeEventLogger_base {
|
|
77
|
+
static noop: Context.Tag.Service<ComputeEventLogger>;
|
|
78
|
+
/**
|
|
79
|
+
* Implements ComputeEventLogger using TracingService.
|
|
80
|
+
*/
|
|
81
|
+
static layerFromTracing: Layer.Layer<ComputeEventLogger, never, TracingService>;
|
|
32
82
|
}
|
|
33
|
-
export declare const logCustomEvent: (data: any) => Effect.Effect<void, never,
|
|
83
|
+
export declare const logCustomEvent: (data: any) => Effect.Effect<void, never, ComputeEventLogger>;
|
|
34
84
|
export declare const createDefectLogger: <A, E, R>() => ((self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>);
|
|
35
|
-
export declare const createEventLogger: (level: LogLevel, message?: string) => Context.Tag.Service<
|
|
85
|
+
export declare const createEventLogger: (level: LogLevel, message?: string) => Context.Tag.Service<ComputeEventLogger>;
|
|
36
86
|
export {};
|
|
37
87
|
//# sourceMappingURL=event-logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-logger.d.ts","sourceRoot":"","sources":["../../../../src/services/event-logger.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"event-logger.d.ts","sourceRoot":"","sources":["../../../../src/services/event-logger.ts"],"names":[],"mappings":"AAI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AAC,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 '../handler';
|
|
4
|
+
declare const FunctionInvocationService_base: Context.TagClass<FunctionInvocationService, "@dxos/functions/FunctionInvocationService", {
|
|
5
|
+
invokeFunction<I, O>(functionDef: FunctionDefinition<I, O>, 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>, 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,YAAY,CAAC;;mBAK3D,CAAC,EAAE,CAAC,eAAe,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC;;AAHtH,qBAAa,yBAA0B,SAAQ,8BAK5C;IACD,MAAM,CAAC,cAAc,GAAI,CAAC,EAAE,CAAC,EAC3B,aAAa,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,EACrC,OAAO,CAAC,KACP,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,yBAAyB,GAAG,kBAAkB,CAAC,CACyC;CACpH"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from './queues';
|
|
3
|
-
export * from './service-container';
|
|
1
|
+
export { DatabaseService } from '@dxos/echo-db';
|
|
4
2
|
export * from './credentials';
|
|
5
|
-
export
|
|
3
|
+
export { ConfiguredCredentialsService, type ServiceCredential } from './credentials';
|
|
6
4
|
export * from './event-logger';
|
|
7
|
-
export
|
|
5
|
+
export { createEventLogger, createDefectLogger } from './event-logger';
|
|
6
|
+
export * from './function-invocation-service';
|
|
7
|
+
export * from './queues';
|
|
8
|
+
export * from './tracing';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/index.ts"],"names":[],"mappings":"AAIA,
|
|
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,6 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Context from 'effect/Context';
|
|
2
|
+
import * as Effect from 'effect/Effect';
|
|
3
|
+
import * as Layer from 'effect/Layer';
|
|
4
|
+
import type { Obj, Relation } from '@dxos/echo';
|
|
2
5
|
import type { Queue, QueueAPI, QueueFactory } from '@dxos/echo-db';
|
|
3
|
-
|
|
6
|
+
import type { DXN, QueueSubspaceTag } from '@dxos/keys';
|
|
7
|
+
declare const QueueService_base: Context.TagClass<QueueService, "@dxos/functions/QueueService", {
|
|
4
8
|
/**
|
|
5
9
|
* API to access the queues.
|
|
6
10
|
*/
|
|
@@ -9,22 +13,35 @@ declare const QueueService_base: Context.TagClass<QueueService, "QueueService",
|
|
|
9
13
|
* The queue that is used to store the context of the current research.
|
|
10
14
|
* @deprecated Use `ContextQueueService` instead.
|
|
11
15
|
*/
|
|
12
|
-
readonly
|
|
16
|
+
readonly queue: Queue | undefined;
|
|
13
17
|
}>;
|
|
14
18
|
/**
|
|
15
19
|
* Gives access to all queues.
|
|
16
20
|
*/
|
|
17
21
|
export declare class QueueService extends QueueService_base {
|
|
18
22
|
static notAvailable: Layer.Layer<QueueService, never, never>;
|
|
19
|
-
static make: (queues: QueueFactory,
|
|
23
|
+
static make: (queues: QueueFactory, queue?: Queue) => Context.Tag.Service<QueueService>;
|
|
24
|
+
static layer: (queues: QueueFactory, queue?: Queue) => Layer.Layer<QueueService>;
|
|
25
|
+
/**
|
|
26
|
+
* Gets a queue by its DXN.
|
|
27
|
+
*/
|
|
28
|
+
static getQueue: <T extends Obj.Any | Relation.Any = Obj.Any | Relation.Any>(dxn: DXN) => Effect.Effect<Queue<T>, never, QueueService>;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new queue.
|
|
31
|
+
*/
|
|
32
|
+
static createQueue: <T extends Obj.Any | Relation.Any = Obj.Any | Relation.Any>(options?: {
|
|
33
|
+
subspaceTag?: QueueSubspaceTag;
|
|
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>;
|
|
20
36
|
}
|
|
21
|
-
declare const ContextQueueService_base: Context.TagClass<ContextQueueService, "ContextQueueService", {
|
|
22
|
-
readonly
|
|
37
|
+
declare const ContextQueueService_base: Context.TagClass<ContextQueueService, "@dxos/functions/ContextQueueService", {
|
|
38
|
+
readonly queue: Queue;
|
|
23
39
|
}>;
|
|
24
40
|
/**
|
|
25
41
|
* Gives access to a specific queue passed as a context.
|
|
26
42
|
*/
|
|
27
43
|
export declare class ContextQueueService extends ContextQueueService_base {
|
|
44
|
+
static layer: (queue: Queue) => Layer.Layer<ContextQueueService, never, never>;
|
|
28
45
|
}
|
|
29
46
|
export {};
|
|
30
47
|
//# sourceMappingURL=queues.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queues.d.ts","sourceRoot":"","sources":["../../../../src/services/queues.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
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,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,EAC1E,KAAK,GAAG,KACP,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAAsE;IAErH;;OAEG;IACH,MAAM,CAAC,WAAW,GAAI,CAAC,SAAS,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,UAAU;QACzF,WAAW,CAAC,EAAE,gBAAgB,CAAC;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
|
|
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 {
|
|
5
|
-
|
|
6
|
+
import type { ObjectId } from '@dxos/echo/internal';
|
|
7
|
+
import { Message } from '@dxos/types';
|
|
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:
|
|
17
|
+
write: (event: Obj.Any) => void;
|
|
11
18
|
}>;
|
|
12
19
|
/**
|
|
13
20
|
* Provides a way for compute primitives (functions, workflows, tools)
|
|
@@ -15,11 +22,33 @@ declare const TracingService_base: Context.TagClass<TracingService, "TracingServ
|
|
|
15
22
|
*/
|
|
16
23
|
export declare class TracingService extends TracingService_base {
|
|
17
24
|
static noop: Context.Tag.Service<TracingService>;
|
|
18
|
-
static
|
|
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>;
|
|
19
30
|
/**
|
|
20
31
|
* Emit the current human-readable execution status.
|
|
21
32
|
*/
|
|
22
|
-
static emitStatus: (data: Obj.MakeProps<typeof AgentStatus>) => Effect.Effect<
|
|
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>;
|
|
23
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";
|
|
24
53
|
export {};
|
|
25
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,
|
|
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,aAAa,GAAI,YAAY,CAAC,cAAc,EAAE,cAAc,CAAC,YAAY,KAAK,cAAc,CAAC,YAAY,wDAW5G;IAEJ;;OAEG;IACH,MAAM,CAAC,UAAU,EAAE,CACjB,IAAI,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,52 @@
|
|
|
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
|
+
binding: Schema.optional<typeof Schema.String>;
|
|
31
|
+
}>>;
|
|
32
|
+
export interface Function extends Schema.Schema.Type<typeof Function> {
|
|
33
|
+
}
|
|
34
|
+
export declare const make: (props: Obj.MakeProps<typeof Function>) => import("@dxos/live-object").Live<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
35
|
+
description?: string | undefined;
|
|
36
|
+
version: string;
|
|
37
|
+
source?: Ref<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
38
|
+
description?: string | undefined;
|
|
39
|
+
source: Ref<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
40
|
+
content: string;
|
|
41
|
+
}>;
|
|
42
|
+
name?: string | undefined;
|
|
43
|
+
changed?: boolean | undefined;
|
|
44
|
+
}> | undefined;
|
|
45
|
+
name: string;
|
|
46
|
+
key?: string | undefined;
|
|
47
|
+
updated?: string | undefined;
|
|
48
|
+
inputSchema?: Type.JsonSchema | undefined;
|
|
49
|
+
outputSchema?: Type.JsonSchema | undefined;
|
|
50
|
+
binding?: string | undefined;
|
|
51
|
+
}>;
|
|
52
|
+
//# 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;;;;;;;;;;;;;GAkBJ,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"}
|