@dxos/functions 0.8.4-main.b97322e → 0.8.4-main.bcb3aa67d6
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/README.md +4 -6
- package/dist/lib/neutral/Trace.mjs +34 -0
- package/dist/lib/neutral/Trace.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BHLSCAA2.mjs +123 -0
- package/dist/lib/neutral/chunk-BHLSCAA2.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-Z2XDJJVH.mjs +49 -0
- package/dist/lib/neutral/chunk-Z2XDJJVH.mjs.map +7 -0
- package/dist/lib/neutral/fib-S6PPI4UW.mjs +23 -0
- package/dist/lib/neutral/fib-S6PPI4UW.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +1245 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/reply-TOHXEG7V.mjs +19 -0
- package/dist/lib/neutral/reply-TOHXEG7V.mjs.map +7 -0
- package/dist/lib/neutral/sleep-QPSZDPEH.mjs +15 -0
- package/dist/lib/neutral/sleep-QPSZDPEH.mjs.map +7 -0
- package/dist/types/src/Trace.d.ts +135 -0
- package/dist/types/src/Trace.d.ts.map +1 -0
- package/dist/types/src/errors.d.ts +91 -38
- package/dist/types/src/errors.d.ts.map +1 -1
- package/dist/types/src/example/definitions.d.ts +11 -0
- package/dist/types/src/example/definitions.d.ts.map +1 -0
- package/dist/types/src/example/fib.d.ts +8 -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 +4 -0
- package/dist/types/src/example/index.d.ts.map +1 -0
- package/dist/types/src/example/reply.d.ts +4 -0
- package/dist/types/src/example/reply.d.ts.map +1 -0
- package/dist/types/src/example/sleep.d.ts +6 -0
- package/dist/types/src/example/sleep.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +9 -7
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/process/Process.d.ts +247 -0
- package/dist/types/src/process/Process.d.ts.map +1 -0
- package/dist/types/src/process/ServiceResolver.d.ts +74 -0
- package/dist/types/src/process/ServiceResolver.d.ts.map +1 -0
- package/dist/types/src/process/StorageService.d.ts +58 -0
- package/dist/types/src/process/StorageService.d.ts.map +1 -0
- package/dist/types/src/protocol/functions-ai-http-client.d.ts +12 -0
- package/dist/types/src/protocol/functions-ai-http-client.d.ts.map +1 -0
- package/dist/types/src/protocol/index.d.ts +2 -0
- package/dist/types/src/protocol/index.d.ts.map +1 -0
- package/dist/types/src/protocol/protocol.d.ts +7 -0
- package/dist/types/src/protocol/protocol.d.ts.map +1 -0
- package/dist/types/src/protocol/protocol.test.d.ts +2 -0
- package/dist/types/src/protocol/protocol.test.d.ts.map +1 -0
- package/dist/types/src/sdk.d.ts +14 -0
- package/dist/types/src/sdk.d.ts.map +1 -0
- package/dist/types/src/services/credentials.d.ts +22 -3
- package/dist/types/src/services/credentials.d.ts.map +1 -1
- package/dist/types/src/services/event-logger.d.ts +74 -30
- package/dist/types/src/services/event-logger.d.ts.map +1 -1
- package/dist/types/src/services/function-invocation-service.d.ts +17 -0
- package/dist/types/src/services/function-invocation-service.d.ts.map +1 -0
- package/dist/types/src/services/index.d.ts +5 -5
- package/dist/types/src/services/index.d.ts.map +1 -1
- package/dist/types/src/services/queues.d.ts +26 -7
- package/dist/types/src/services/queues.d.ts.map +1 -1
- package/dist/types/src/services/tracing.d.ts +93 -7
- package/dist/types/src/services/tracing.d.ts.map +1 -1
- package/dist/types/src/types/Script.d.ts +22 -0
- package/dist/types/src/types/Script.d.ts.map +1 -0
- package/dist/types/src/types/Trigger.d.ts +120 -0
- package/dist/types/src/types/Trigger.d.ts.map +1 -0
- package/dist/types/src/types/TriggerEvent.d.ts +75 -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/types/url.d.ts +13 -0
- package/dist/types/src/types/url.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -69
- package/src/Trace.ts +162 -0
- package/src/errors.ts +13 -5
- package/src/example/definitions.ts +48 -0
- package/src/example/fib.ts +22 -0
- package/src/example/forex-effect.ts +40 -0
- package/src/example/index.ts +12 -0
- package/src/example/reply.ts +18 -0
- package/src/example/sleep.ts +15 -0
- package/src/index.ts +9 -9
- package/src/process/Process.ts +457 -0
- package/src/process/ServiceResolver.ts +173 -0
- package/src/process/StorageService.ts +99 -0
- package/src/protocol/functions-ai-http-client.ts +67 -0
- package/src/{executor → protocol}/index.ts +1 -1
- package/src/protocol/protocol.test.ts +59 -0
- package/src/protocol/protocol.ts +268 -0
- package/src/sdk.ts +39 -0
- package/src/services/credentials.ts +101 -3
- package/src/services/event-logger.ts +77 -37
- package/src/services/function-invocation-service.ts +38 -0
- package/src/services/index.ts +5 -5
- package/src/services/queues.ts +46 -11
- package/src/services/tracing.ts +172 -14
- package/src/types/Script.ts +38 -0
- package/src/types/Trigger.ts +154 -0
- package/src/types/TriggerEvent.ts +62 -0
- package/src/types/index.ts +8 -0
- package/src/types/url.ts +32 -0
- 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/index.mjs +0 -503
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- 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/index.mjs +0 -504
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- 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/handler.d.ts +0 -62
- package/dist/types/src/handler.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/dist/types/src/url.d.ts +0 -17
- package/dist/types/src/url.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/handler.ts +0 -120
- 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
- package/src/url.ts +0 -52
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as Pipeable from 'effect/Pipeable';
|
|
2
|
+
import * as Context from 'effect/Context';
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
import * as Option from 'effect/Option';
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
export interface Service {
|
|
7
|
+
/** Read a value by key. Returns `None` if key does not exist. */
|
|
8
|
+
get<S extends Schema.Schema<any, string, any>>(schema: S, key: string): Effect.Effect<Option.Option<Schema.Schema.Type<S>>, never, Schema.Schema.Context<S>>;
|
|
9
|
+
/** Write a value for the given key. */
|
|
10
|
+
set<S extends Schema.Schema<any, string, any>>(schema: S, key: string, value: Schema.Schema.Type<S>): Effect.Effect<void, never, Schema.Schema.Context<S>>;
|
|
11
|
+
/** Remove a key. */
|
|
12
|
+
delete(key: string): Effect.Effect<void>;
|
|
13
|
+
/** List all keys, optionally filtered by prefix. */
|
|
14
|
+
list(prefix?: string): Effect.Effect<readonly string[]>;
|
|
15
|
+
/** Remove all keys managed by this scoped store. */
|
|
16
|
+
clear(): Effect.Effect<void>;
|
|
17
|
+
}
|
|
18
|
+
declare const StorageService_base: Context.TagClass<StorageService, "@dxos/functions/StorageService", Service>;
|
|
19
|
+
/**
|
|
20
|
+
* Scoped key-value storage service for processes.
|
|
21
|
+
* Each process receives its own namespaced instance via the process manager.
|
|
22
|
+
* Construct a live implementation with `StorageService.layer` from `@dxos/functions-runtime`.
|
|
23
|
+
*/
|
|
24
|
+
export declare class StorageService extends StorageService_base {
|
|
25
|
+
}
|
|
26
|
+
export declare const get: <S extends Schema.Schema<any, string, any>>(schema: S, key: string) => Effect.Effect<Option.Option<Schema.Schema.Type<S>>, never, Schema.Schema.Context<S> | StorageService>;
|
|
27
|
+
export declare const set: <S extends Schema.Schema<any, string, any>>(schema: S, key: string, value: Schema.Schema.Type<S>) => Effect.Effect<void, never, Schema.Schema.Context<S> | StorageService>;
|
|
28
|
+
export declare const deleteKey: (key: string) => Effect.Effect<void, never, StorageService>;
|
|
29
|
+
export declare const list: (prefix?: string | undefined) => Effect.Effect<readonly string[], never, StorageService>;
|
|
30
|
+
export declare const clear: () => Effect.Effect<void, never, StorageService>;
|
|
31
|
+
/**
|
|
32
|
+
* Typed key in a storage service.
|
|
33
|
+
*/
|
|
34
|
+
export interface Key<T> extends Pipeable.Pipeable {
|
|
35
|
+
readonly key: string;
|
|
36
|
+
get: Effect.Effect<Option.Option<T>, never, StorageService>;
|
|
37
|
+
set(value: T): Effect.Effect<void, never, StorageService>;
|
|
38
|
+
delete(): Effect.Effect<void, never, StorageService>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create a typed key in a storage service.
|
|
42
|
+
*/
|
|
43
|
+
export declare const key: <S extends Schema.Schema<any, string, any>>(schema: S, key: string) => Key<Schema.Schema.Type<S>>;
|
|
44
|
+
/**
|
|
45
|
+
* Typed key in a storage service with a default value.
|
|
46
|
+
*/
|
|
47
|
+
export interface KeyWithDefault<T, U> extends Pipeable.Pipeable {
|
|
48
|
+
readonly key: string;
|
|
49
|
+
get: Effect.Effect<T | U, never, StorageService>;
|
|
50
|
+
set(value: U): Effect.Effect<void, never, StorageService>;
|
|
51
|
+
delete(): Effect.Effect<void, never, StorageService>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Assign a default value to a key if it is not present.
|
|
55
|
+
*/
|
|
56
|
+
export declare const withDefault: <T>(getDefault: () => NoInfer<T>) => (key: Key<T>) => KeyWithDefault<T, T>;
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=StorageService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StorageService.d.ts","sourceRoot":"","sources":["../../../../src/process/StorageService.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,MAAM,WAAW,OAAO;IACtB,iEAAiE;IACjE,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,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C,EAAE,YAAY,MAAM,OAAO,CAAC,CAAC,CAAC,MAC/B,KAAK,GAAG,CAAC,CAAC,CAAC,KAAG,cAAc,CAAC,CAAC,EAAE,CAAC,CAUjC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as HttpClient from '@effect/platform/HttpClient';
|
|
2
|
+
import * as Layer from 'effect/Layer';
|
|
3
|
+
import { type EdgeFunctionEnv } from '@dxos/protocols';
|
|
4
|
+
/**
|
|
5
|
+
* Copy pasted from https://github.com/Effect-TS/effect/blob/main/packages/platform/src/internal/fetchHttpClient.ts
|
|
6
|
+
*/
|
|
7
|
+
export declare const requestInitTagKey = "@effect/platform/FetchHttpClient/FetchOptions";
|
|
8
|
+
export declare class FunctionsAiHttpClient {
|
|
9
|
+
static make: (service: EdgeFunctionEnv.FunctionsAiService) => HttpClient.HttpClient;
|
|
10
|
+
static layer: (service: EdgeFunctionEnv.FunctionsAiService) => Layer.Layer<HttpClient.HttpClient, never, never>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=functions-ai-http-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions-ai-http-client.d.ts","sourceRoot":"","sources":["../../../../src/protocol/functions-ai-http-client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAK1D,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,OAAO,EAAE,KAAK,eAAe,EAAc,MAAM,iBAAiB,CAAC;AACnE;;GAEG;AACH,eAAO,MAAM,iBAAiB,kDAAkD,CAAC;AAEjF,qBAAa,qBAAqB;IAChC,MAAM,CAAC,IAAI,GAAI,SAAS,eAAe,CAAC,kBAAkB,2BAyCrD;IAEL,MAAM,CAAC,KAAK,GAAI,SAAS,eAAe,CAAC,kBAAkB,sDACiB;CAC7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/protocol/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type FunctionProtocol } from '@dxos/protocols';
|
|
2
|
+
import { Operation } from '@dxos/operation';
|
|
3
|
+
/**
|
|
4
|
+
* Wraps a function handler made with `defineFunction` to a protocol that the functions-runtime expects.
|
|
5
|
+
*/
|
|
6
|
+
export declare const wrapFunctionHandler: (func: Operation.WithHandler<Operation.Definition.Any>) => FunctionProtocol.Func;
|
|
7
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../../src/protocol/protocol.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAMxD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,KAAG,gBAAgB,CAAC,IAwE5G,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.test.d.ts","sourceRoot":"","sources":["../../../../src/protocol/protocol.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type AiService } from '@dxos/ai';
|
|
2
|
+
import { type Database, type Feed } from '@dxos/echo';
|
|
3
|
+
import { type Trace } from '@dxos/functions';
|
|
4
|
+
import { type CredentialsService, type FunctionInvocationService, type QueueService, type TracingService } from './services';
|
|
5
|
+
/**
|
|
6
|
+
* Services that are provided at the function call site by the caller.
|
|
7
|
+
*/
|
|
8
|
+
export type InvocationServices = TracingService;
|
|
9
|
+
/**
|
|
10
|
+
* Services that are available to invoked functions.
|
|
11
|
+
* @deprecated
|
|
12
|
+
*/
|
|
13
|
+
export type FunctionServices = InvocationServices | AiService.AiService | CredentialsService | Database.Service | QueueService | Feed.Service | Trace.TraceService | FunctionInvocationService;
|
|
14
|
+
//# sourceMappingURL=sdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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;AACtD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,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;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,kBAAkB,GAClB,SAAS,CAAC,SAAS,GACnB,kBAAkB,GAClB,QAAQ,CAAC,OAAO,GAEhB,YAAY,GACZ,IAAI,CAAC,OAAO,GACZ,KAAK,CAAC,YAAY,GAClB,yBAAyB,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 { Database } from '@dxos/echo';
|
|
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,15 @@ 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: ({ caching }?: {
|
|
35
|
+
caching?: boolean;
|
|
36
|
+
}) => Layer.Layer<CredentialsService, never, Database.Service>;
|
|
22
37
|
}
|
|
23
38
|
export declare class ConfiguredCredentialsService implements Context.Tag.Service<CredentialsService> {
|
|
24
39
|
private readonly credentials;
|
|
@@ -27,5 +42,9 @@ export declare class ConfiguredCredentialsService implements Context.Tag.Service
|
|
|
27
42
|
queryCredentials(query: CredentialQuery): Promise<ServiceCredential[]>;
|
|
28
43
|
getCredential(query: CredentialQuery): Promise<ServiceCredential>;
|
|
29
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Maps the request to include the given token in the Authorization header.
|
|
47
|
+
*/
|
|
48
|
+
export declare const withAuthorization: (token: string, kind?: "Bearer" | "Basic") => <E, R>(self: HttpClient.HttpClient.With<E, R>) => HttpClient.HttpClient.With<E, R>;
|
|
30
49
|
export {};
|
|
31
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,
|
|
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,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,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,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAIvG;IAEL,MAAM,CAAC,SAAS,GAAI,OAAO,eAAe,KAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAO3G;IAEL,MAAM,CAAC,eAAe,GAAI,aAAa,iBAAiB,EAAE,mDACyB;IAEnF,MAAM,CAAC,WAAW,GAChB,aAAa;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;KAClD,EAAE,sFAgBD;IAEJ,MAAM,CAAC,iBAAiB,GAAI,cAAqB;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAO,8DA0CvE;CACL;AAED,qBAAa,4BAA6B,YAAW,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC;IAC9E,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,GAAE,iBAAiB,EAAO;IAElE,cAAc,CAAC,WAAW,EAAE,iBAAiB,EAAE,GAAG,4BAA4B;IAKxE,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAItE,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAQxE;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,MAAM,EAAE,OAAO,QAAQ,GAAG,OAAO,uFAItE,CAAC"}
|
|
@@ -1,37 +1,81 @@
|
|
|
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<{
|
|
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 type: "compute-input";
|
|
49
|
+
readonly value: any;
|
|
50
|
+
readonly property: string;
|
|
51
|
+
readonly nodeId: string;
|
|
52
|
+
} | {
|
|
53
|
+
readonly type: "compute-output";
|
|
54
|
+
readonly value: any;
|
|
55
|
+
readonly property: string;
|
|
56
|
+
readonly nodeId: string;
|
|
57
|
+
} | {
|
|
58
|
+
readonly type: "custom";
|
|
59
|
+
readonly nodeId: string;
|
|
60
|
+
readonly event: any;
|
|
61
|
+
};
|
|
62
|
+
}, Schema.Struct.Fields>;
|
|
63
|
+
declare const ComputeEventLogger_base: Context.TagClass<ComputeEventLogger, "@dxos/functions/ComputeEventLogger", {
|
|
64
|
+
readonly log: (event: ComputeEventPayload) => void;
|
|
28
65
|
readonly nodeId: string | undefined;
|
|
29
66
|
}>;
|
|
30
|
-
|
|
31
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Logs event for the compute workflows.
|
|
69
|
+
*/
|
|
70
|
+
export declare class ComputeEventLogger extends ComputeEventLogger_base {
|
|
71
|
+
static noop: Context.Tag.Service<ComputeEventLogger>;
|
|
72
|
+
/**
|
|
73
|
+
* Implements ComputeEventLogger using TracingService.
|
|
74
|
+
*/
|
|
75
|
+
static layerFromTracing: Layer.Layer<ComputeEventLogger, never, TracingService>;
|
|
32
76
|
}
|
|
33
|
-
export declare const logCustomEvent: (data: any) => Effect.Effect<void, never,
|
|
77
|
+
export declare const logCustomEvent: (data: any) => Effect.Effect<void, never, ComputeEventLogger>;
|
|
34
78
|
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<
|
|
79
|
+
export declare const createEventLogger: (level: LogLevel, message?: string) => Context.Tag.Service<ComputeEventLogger>;
|
|
36
80
|
export {};
|
|
37
81
|
//# 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":"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;;;;;;;;;;;;;;;;;;;;;;;;wBAEyD,CAAC;;kBAOjE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI;qBAAmB,MAAM,GAAG,SAAS;;AAL3F;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,uBAGrC;IACD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAGlD;IAEF;;OAEG;IACH,MAAM,CAAC,gBAAgB,yDAWrB;CACH;AAED,eAAO,MAAM,cAAc,GAAI,MAAM,GAAG,mDAWpC,CAAC;AAEL,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,OAAK,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAMrG,CAAC;AAEJ,eAAO,MAAM,iBAAiB,GAC5B,OAAO,QAAQ,EACf,UAAS,MAAgB,KACxB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAiBxC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as Context from 'effect/Context';
|
|
2
|
+
import * as Effect from 'effect/Effect';
|
|
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';
|
|
7
|
+
declare const FunctionInvocationService_base: Context.TagClass<FunctionInvocationService, "@dxos/functions/FunctionInvocationService", {
|
|
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>;
|
|
10
|
+
}>;
|
|
11
|
+
export declare class FunctionInvocationService extends FunctionInvocationService_base {
|
|
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>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# 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;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,8 +1,8 @@
|
|
|
1
|
-
export * from './database';
|
|
2
|
-
export * from './queues';
|
|
3
|
-
export * from './service-container';
|
|
4
1
|
export * from './credentials';
|
|
5
|
-
export
|
|
2
|
+
export { ConfiguredCredentialsService, type ServiceCredential } from './credentials';
|
|
6
3
|
export * from './event-logger';
|
|
7
|
-
export
|
|
4
|
+
export { createEventLogger, createDefectLogger } from './event-logger';
|
|
5
|
+
export * from './function-invocation-service';
|
|
6
|
+
export * from './queues';
|
|
7
|
+
export * from './tracing';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/index.ts"],"names":[],"mappings":"AAIA,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,6 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import * as Context from 'effect/Context';
|
|
2
|
+
import * as Effect from 'effect/Effect';
|
|
3
|
+
import * as Layer from 'effect/Layer';
|
|
4
|
+
import { type Entity } from '@dxos/echo';
|
|
5
|
+
import { type Queue, type QueueAPI, type QueueFactory } from '@dxos/echo-db';
|
|
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,37 @@ 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.
|
|
20
|
+
* @deprecated Use FeedService instead.
|
|
16
21
|
*/
|
|
17
22
|
export declare class QueueService extends QueueService_base {
|
|
18
23
|
static notAvailable: Layer.Layer<QueueService, never, never>;
|
|
19
|
-
static make: (queues: QueueFactory,
|
|
24
|
+
static make: (queues: QueueFactory, queue?: Queue) => Context.Tag.Service<QueueService>;
|
|
25
|
+
static layer: (queues: QueueFactory, queue?: Queue) => Layer.Layer<QueueService>;
|
|
26
|
+
/**
|
|
27
|
+
* Gets a queue by its DXN.
|
|
28
|
+
*/
|
|
29
|
+
static getQueue: <T extends Entity.Unknown = Entity.Unknown>(dxn: DXN) => Effect.Effect<Queue<T>, never, QueueService>;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new queue.
|
|
32
|
+
*/
|
|
33
|
+
static createQueue: <T extends Entity.Unknown = Entity.Unknown>(options?: {
|
|
34
|
+
subspaceTag?: QueueSubspaceTag;
|
|
35
|
+
}) => Effect.Effect<Queue<T>, never, QueueService>;
|
|
36
|
+
static append: <T extends Entity.Unknown = Entity.Unknown>(queue: Queue<T>, objects: T[]) => Effect.Effect<void>;
|
|
20
37
|
}
|
|
21
|
-
declare const ContextQueueService_base: Context.TagClass<ContextQueueService, "ContextQueueService", {
|
|
22
|
-
readonly
|
|
38
|
+
declare const ContextQueueService_base: Context.TagClass<ContextQueueService, "@dxos/functions/ContextQueueService", {
|
|
39
|
+
readonly queue: Queue;
|
|
23
40
|
}>;
|
|
24
41
|
/**
|
|
25
42
|
* Gives access to a specific queue passed as a context.
|
|
26
43
|
*/
|
|
27
44
|
export declare class ContextQueueService extends ContextQueueService_base {
|
|
45
|
+
static layer: (queue: Queue) => Layer.Layer<ContextQueueService, never, never>;
|
|
28
46
|
}
|
|
47
|
+
export declare const feedServiceFromQueueServiceLayer: Layer.Layer<import("@dxos/echo/Feed").Service, never, QueueService>;
|
|
29
48
|
export {};
|
|
30
49
|
//# sourceMappingURL=queues.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queues.d.ts","sourceRoot":"","sources":["../../../../src/services/que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AC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAC2B;IAE3E,MAAM,CAAC,MAAM,GAAI,CAAC,SAAS,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CACjE;CAC/C;;oBAQmB,KAAK;;AANzB;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,wBAKtC;IACD,MAAM,CAAC,KAAK,GAAI,OAAO,KAAK,oDAAmD;CAChF;AAED,eAAO,MAAM,gCAAgC,qEAK5C,CAAC"}
|
|
@@ -1,25 +1,111 @@
|
|
|
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
|
-
import { Obj } from '@dxos/echo';
|
|
4
|
-
import
|
|
5
|
-
|
|
5
|
+
import { type DXN, Obj, Ref } from '@dxos/echo';
|
|
6
|
+
import { ObjectId } from '@dxos/keys';
|
|
7
|
+
import { Message } from '@dxos/types';
|
|
8
|
+
import type { Trigger } from '../types';
|
|
9
|
+
declare const TracingService_base: Context.TagClass<TracingService, "@dxos/functions/TracingService", {
|
|
10
|
+
/**
|
|
11
|
+
* Gets the parent message ID.
|
|
12
|
+
*/
|
|
13
|
+
getTraceContext: () => TracingService.TraceContext;
|
|
6
14
|
/**
|
|
7
15
|
* Write an event to the tracing queue.
|
|
8
16
|
* @param event - The event to write. Must be an a typed object.
|
|
9
17
|
*/
|
|
10
|
-
write(event:
|
|
18
|
+
write: (event: Obj.Unknown, traceContext: TracingService.TraceContext) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Write an ephemeral event.
|
|
21
|
+
*/
|
|
22
|
+
ephemeral: (event: Obj.Unknown, traceContext: TracingService.TraceContext) => void;
|
|
23
|
+
traceInvocationStart({ payload, target, }: {
|
|
24
|
+
payload: TracingService.FunctionInvocationPayload;
|
|
25
|
+
target?: DXN;
|
|
26
|
+
}): Effect.Effect<TracingService.InvocationTraceData>;
|
|
27
|
+
traceInvocationEnd({ trace, exception, }: {
|
|
28
|
+
trace: TracingService.InvocationTraceData;
|
|
29
|
+
exception?: any;
|
|
30
|
+
}): Effect.Effect<void>;
|
|
11
31
|
}>;
|
|
12
32
|
/**
|
|
13
33
|
* Provides a way for compute primitives (functions, workflows, tools)
|
|
14
34
|
* to emit an execution trace as a series of structured ECHO objects.
|
|
35
|
+
* @deprecated Use Trace.TraceService instead.
|
|
15
36
|
*/
|
|
16
37
|
export declare class TracingService extends TracingService_base {
|
|
17
38
|
static noop: Context.Tag.Service<TracingService>;
|
|
18
|
-
static
|
|
39
|
+
static layerNoop: Layer.Layer<TracingService>;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a TracingService layer that emits events to the parent tracing service.
|
|
42
|
+
*/
|
|
43
|
+
static layerSubframe: (mapContext: (currentContext: TracingService.TraceContext) => TracingService.TraceContext) => Layer.Layer<TracingService, never, TracingService>;
|
|
44
|
+
/**
|
|
45
|
+
* Create sublayer to trace an invocation.
|
|
46
|
+
* @param data
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
49
|
+
static layerInvocation: (data: TracingService.InvocationTraceData) => Layer.Layer<TracingService, never, TracingService>;
|
|
19
50
|
/**
|
|
20
51
|
* Emit the current human-readable execution status.
|
|
21
52
|
*/
|
|
22
|
-
static emitStatus: (data: Obj.MakeProps<typeof AgentStatus>) => Effect.Effect<
|
|
53
|
+
static emitStatus: (data: Omit<Obj.MakeProps<typeof AgentStatus>, 'created'>) => Effect.Effect<void, never, TracingService>;
|
|
54
|
+
static emitConverationMessage: (data: Obj.MakeProps<typeof Message.Message> | Message.Message) => Effect.Effect<void, never, TracingService>;
|
|
55
|
+
static emitEphemeralMessage: (data: Message.Message) => Effect.Effect<void, never, TracingService>;
|
|
23
56
|
}
|
|
57
|
+
export declare namespace TracingService {
|
|
58
|
+
interface TraceContext {
|
|
59
|
+
currentInvocation?: InvocationTraceData;
|
|
60
|
+
/**
|
|
61
|
+
* If this thread sprung from a tool call, this is the ID of the message containing the tool call.
|
|
62
|
+
*/
|
|
63
|
+
parentMessage?: ObjectId;
|
|
64
|
+
/**
|
|
65
|
+
* If the current thread is a byproduct of a tool call, this is the ID of the tool call.
|
|
66
|
+
*/
|
|
67
|
+
toolCallId?: string;
|
|
68
|
+
debugInfo?: unknown;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Trace data for a function/trigger invocation.
|
|
72
|
+
*/
|
|
73
|
+
interface InvocationTraceData {
|
|
74
|
+
invocationId: ObjectId;
|
|
75
|
+
invocationTraceQueue?: DXN.String;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Payload for a function/trigger invocation.
|
|
79
|
+
*/
|
|
80
|
+
interface FunctionInvocationPayload {
|
|
81
|
+
data?: any;
|
|
82
|
+
inputNodeId?: string;
|
|
83
|
+
trigger?: {
|
|
84
|
+
id: string;
|
|
85
|
+
kind: Trigger.Kind;
|
|
86
|
+
};
|
|
87
|
+
chat?: Ref.Ref<Obj.Unknown>;
|
|
88
|
+
process?: {
|
|
89
|
+
pid: string;
|
|
90
|
+
parentPid?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Key of the executable.
|
|
93
|
+
*/
|
|
94
|
+
key: string;
|
|
95
|
+
/**
|
|
96
|
+
* Process name.
|
|
97
|
+
*/
|
|
98
|
+
name?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Target object that the process is assigned to.
|
|
101
|
+
*/
|
|
102
|
+
target?: string;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Goes into {@link Message['properties']}
|
|
108
|
+
*/
|
|
109
|
+
export declare const MESSAGE_PROPERTY_TOOL_CALL_ID: "toolCallId";
|
|
24
110
|
export {};
|
|
25
111
|
//# 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,KAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;;IAUpC;;OAEG;qBACc,MAAM,cAAc,CAAC,YAAY;IAElD;;;OAGG;WACI,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,YAAY,EAAE,cAAc,CAAC,YAAY,KAAK,IAAI;IAE9E;;OAEG;eACQ,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,YAAY,EAAE,cAAc,CAAC,YAAY,KAAK,IAAI;+CAK/E;QACD,OAAO,EAAE,cAAc,CAAC,yBAAyB,CAAC;QAClD,MAAM,CAAC,EAAE,GAAG,CAAC;KACd,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,mBAAmB,CAAC;8CAKlD;QACD,KAAK,EAAE,cAAc,CAAC,mBAAmB,CAAC;QAC1C,SAAS,CAAC,EAAE,GAAG,CAAC;KACjB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;;AAtC3B;;;;GAIG;AACH,qBAAa,cAAe,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AAoB,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;QAC5B,OAAO,CAAC,EAAE;YACR,GAAG,EAAE,MAAM,CAAC;YACZ,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB;;eAEG;YACH,GAAG,EAAE,MAAM,CAAC;YAEZ;;eAEG;YACH,IAAI,CAAC,EAAE,MAAM,CAAC;YAEd;;eAEG;YACH,MAAM,CAAC,EAAE,MAAM,CAAC;SACjB,CAAC;KACH;CACF;AAED;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAG,YAAqB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
2
|
+
import { Obj, Type } from '@dxos/echo';
|
|
3
|
+
/**
|
|
4
|
+
* Source script.
|
|
5
|
+
*/
|
|
6
|
+
export declare const Script: Type.Obj<{
|
|
7
|
+
readonly description?: string | undefined;
|
|
8
|
+
readonly name?: string | undefined;
|
|
9
|
+
readonly changed?: boolean | undefined;
|
|
10
|
+
readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
11
|
+
readonly name?: string | undefined;
|
|
12
|
+
readonly content: string;
|
|
13
|
+
}>;
|
|
14
|
+
}, Schema.Struct.Fields>;
|
|
15
|
+
export interface Script extends Schema.Schema.Type<typeof Script> {
|
|
16
|
+
}
|
|
17
|
+
type Props = Omit<Obj.MakeProps<typeof Script>, 'source'> & {
|
|
18
|
+
source?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const make: ({ source, ...props }?: Props) => Script;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=Script.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Script.d.ts","sourceRoot":"","sources":["../../../../src/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,MACqB,CAAC"}
|