@dxos/functions 0.8.4-main.84f28bd → 0.8.4-main.8baae0fced

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 (135) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +5 -7
  3. package/dist/lib/neutral/index.mjs +602 -0
  4. package/dist/lib/neutral/index.mjs.map +7 -0
  5. package/dist/lib/neutral/meta.json +1 -0
  6. package/dist/types/src/index.d.ts +3 -6
  7. package/dist/types/src/index.d.ts.map +1 -1
  8. package/dist/types/src/protocol/functions-ai-http-client.d.ts +12 -0
  9. package/dist/types/src/protocol/functions-ai-http-client.d.ts.map +1 -0
  10. package/dist/types/src/protocol/functions-ai-http-client.test.d.ts +2 -0
  11. package/dist/types/src/protocol/functions-ai-http-client.test.d.ts.map +1 -0
  12. package/dist/types/src/protocol/index.d.ts +2 -0
  13. package/dist/types/src/protocol/index.d.ts.map +1 -0
  14. package/dist/types/src/protocol/protocol.d.ts +24 -0
  15. package/dist/types/src/protocol/protocol.d.ts.map +1 -0
  16. package/dist/types/src/protocol/protocol.test.d.ts +2 -0
  17. package/dist/types/src/protocol/protocol.test.d.ts.map +1 -0
  18. package/dist/types/src/sdk.d.ts +10 -0
  19. package/dist/types/src/sdk.d.ts.map +1 -0
  20. package/dist/types/src/services/credentials.d.ts +24 -27
  21. package/dist/types/src/services/credentials.d.ts.map +1 -1
  22. package/dist/types/src/services/function-invocation-service.d.ts +18 -0
  23. package/dist/types/src/services/function-invocation-service.d.ts.map +1 -0
  24. package/dist/types/src/services/index.d.ts +3 -8
  25. package/dist/types/src/services/index.d.ts.map +1 -1
  26. package/dist/types/src/services/queues.d.ts +1 -17
  27. package/dist/types/src/services/queues.d.ts.map +1 -1
  28. package/dist/types/src/services/tracing.d.ts +4 -14
  29. package/dist/types/src/services/tracing.d.ts.map +1 -1
  30. package/dist/types/src/types/index.d.ts +2 -0
  31. package/dist/types/src/types/index.d.ts.map +1 -0
  32. package/dist/types/src/types/url.d.ts +13 -0
  33. package/dist/types/src/types/url.d.ts.map +1 -0
  34. package/dist/types/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +29 -69
  36. package/src/index.ts +3 -8
  37. package/src/protocol/functions-ai-http-client.test.ts +105 -0
  38. package/src/protocol/functions-ai-http-client.ts +141 -0
  39. package/src/{executor → protocol}/index.ts +1 -1
  40. package/src/protocol/protocol.test.ts +58 -0
  41. package/src/protocol/protocol.ts +455 -0
  42. package/src/sdk.ts +31 -0
  43. package/src/services/credentials.ts +95 -35
  44. package/src/services/function-invocation-service.ts +36 -0
  45. package/src/services/index.ts +3 -8
  46. package/src/services/queues.ts +1 -38
  47. package/src/services/tracing.ts +4 -23
  48. package/src/{testing → types}/index.ts +1 -1
  49. package/src/types/url.ts +32 -0
  50. package/dist/lib/browser/bundler/index.mjs +0 -247
  51. package/dist/lib/browser/bundler/index.mjs.map +0 -7
  52. package/dist/lib/browser/chunk-54U464M4.mjs +0 -360
  53. package/dist/lib/browser/chunk-54U464M4.mjs.map +0 -7
  54. package/dist/lib/browser/edge/index.mjs +0 -69
  55. package/dist/lib/browser/edge/index.mjs.map +0 -7
  56. package/dist/lib/browser/index.mjs +0 -492
  57. package/dist/lib/browser/index.mjs.map +0 -7
  58. package/dist/lib/browser/meta.json +0 -1
  59. package/dist/lib/browser/testing/index.mjs +0 -79
  60. package/dist/lib/browser/testing/index.mjs.map +0 -7
  61. package/dist/lib/node-esm/bundler/index.mjs +0 -249
  62. package/dist/lib/node-esm/bundler/index.mjs.map +0 -7
  63. package/dist/lib/node-esm/chunk-XDSX35BS.mjs +0 -362
  64. package/dist/lib/node-esm/chunk-XDSX35BS.mjs.map +0 -7
  65. package/dist/lib/node-esm/edge/index.mjs +0 -71
  66. package/dist/lib/node-esm/edge/index.mjs.map +0 -7
  67. package/dist/lib/node-esm/index.mjs +0 -493
  68. package/dist/lib/node-esm/index.mjs.map +0 -7
  69. package/dist/lib/node-esm/meta.json +0 -1
  70. package/dist/lib/node-esm/testing/index.mjs +0 -80
  71. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  72. package/dist/types/src/bundler/bundler.d.ts +0 -50
  73. package/dist/types/src/bundler/bundler.d.ts.map +0 -1
  74. package/dist/types/src/bundler/bundler.test.d.ts +0 -2
  75. package/dist/types/src/bundler/bundler.test.d.ts.map +0 -1
  76. package/dist/types/src/bundler/index.d.ts +0 -2
  77. package/dist/types/src/bundler/index.d.ts.map +0 -1
  78. package/dist/types/src/edge/functions.d.ts +0 -16
  79. package/dist/types/src/edge/functions.d.ts.map +0 -1
  80. package/dist/types/src/edge/index.d.ts +0 -2
  81. package/dist/types/src/edge/index.d.ts.map +0 -1
  82. package/dist/types/src/executor/executor.d.ts +0 -8
  83. package/dist/types/src/executor/executor.d.ts.map +0 -1
  84. package/dist/types/src/executor/index.d.ts +0 -2
  85. package/dist/types/src/executor/index.d.ts.map +0 -1
  86. package/dist/types/src/handler.d.ts +0 -61
  87. package/dist/types/src/handler.d.ts.map +0 -1
  88. package/dist/types/src/schema.d.ts +0 -38
  89. package/dist/types/src/schema.d.ts.map +0 -1
  90. package/dist/types/src/services/ai.d.ts +0 -12
  91. package/dist/types/src/services/ai.d.ts.map +0 -1
  92. package/dist/types/src/services/database.d.ts +0 -15
  93. package/dist/types/src/services/database.d.ts.map +0 -1
  94. package/dist/types/src/services/event-logger.d.ts +0 -37
  95. package/dist/types/src/services/event-logger.d.ts.map +0 -1
  96. package/dist/types/src/services/function-call-service.d.ts +0 -16
  97. package/dist/types/src/services/function-call-service.d.ts.map +0 -1
  98. package/dist/types/src/services/service-container.d.ts +0 -46
  99. package/dist/types/src/services/service-container.d.ts.map +0 -1
  100. package/dist/types/src/services/tool-resolver.d.ts +0 -14
  101. package/dist/types/src/services/tool-resolver.d.ts.map +0 -1
  102. package/dist/types/src/testing/index.d.ts +0 -2
  103. package/dist/types/src/testing/index.d.ts.map +0 -1
  104. package/dist/types/src/testing/logger.d.ts +0 -5
  105. package/dist/types/src/testing/logger.d.ts.map +0 -1
  106. package/dist/types/src/testing/services.d.ts +0 -71
  107. package/dist/types/src/testing/services.d.ts.map +0 -1
  108. package/dist/types/src/trace.d.ts +0 -124
  109. package/dist/types/src/trace.d.ts.map +0 -1
  110. package/dist/types/src/translations.d.ts +0 -12
  111. package/dist/types/src/translations.d.ts.map +0 -1
  112. package/dist/types/src/types.d.ts +0 -411
  113. package/dist/types/src/types.d.ts.map +0 -1
  114. package/dist/types/src/url.d.ts +0 -17
  115. package/dist/types/src/url.d.ts.map +0 -1
  116. package/src/bundler/bundler.test.ts +0 -59
  117. package/src/bundler/bundler.ts +0 -292
  118. package/src/bundler/index.ts +0 -5
  119. package/src/edge/functions.ts +0 -64
  120. package/src/edge/index.ts +0 -9
  121. package/src/executor/executor.ts +0 -54
  122. package/src/handler.ts +0 -113
  123. package/src/schema.ts +0 -57
  124. package/src/services/ai.ts +0 -32
  125. package/src/services/database.ts +0 -50
  126. package/src/services/event-logger.ts +0 -87
  127. package/src/services/function-call-service.ts +0 -64
  128. package/src/services/service-container.ts +0 -127
  129. package/src/services/tool-resolver.ts +0 -31
  130. package/src/testing/logger.ts +0 -16
  131. package/src/testing/services.ts +0 -174
  132. package/src/trace.ts +0 -180
  133. package/src/translations.ts +0 -20
  134. package/src/types.ts +0 -211
  135. package/src/url.ts +0 -52
@@ -1,80 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AiService,
4
- ConfiguredCredentialsService,
5
- DatabaseService,
6
- QueueService,
7
- ServiceContainer,
8
- ToolResolverService,
9
- createEventLogger
10
- } from "../chunk-XDSX35BS.mjs";
11
-
12
- // src/testing/services.ts
13
- import { EdgeAiServiceClient, ToolRegistry } from "@dxos/ai";
14
- import { AI_SERVICE_ENDPOINT, createTestAiServiceClient } from "@dxos/ai/testing";
15
- import { assertArgument } from "@dxos/invariant";
16
-
17
- // src/testing/logger.ts
18
- import { Effect } from "effect";
19
- import { LogLevel } from "@dxos/log";
20
- var noopLogger = {
21
- log: () => Effect.succeed(void 0),
22
- nodeId: void 0
23
- };
24
- var consoleLogger = createEventLogger(LogLevel.INFO);
25
-
26
- // src/testing/services.ts
27
- var createTestServices = ({ ai, credentials, db, logging, queues, space, tracing, toolResolver } = {}) => {
28
- assertArgument(!(!!space && (!!db || !!queues)), "space can be provided only if db and queues are not");
29
- return new ServiceContainer().setServices({
30
- ai: createAiService(ai),
31
- credentials: createCredentialsService(credentials),
32
- database: space || db ? DatabaseService.make(space?.db || db) : void 0,
33
- eventLogger: logging?.logger ?? logging?.enabled ? consoleLogger : noopLogger,
34
- queues: space || queues ? QueueService.make(space?.queues || queues, void 0) : void 0,
35
- tracing: tracing?.service,
36
- toolResolver: toolResolver ?? ToolResolverService.make(new ToolRegistry([]))
37
- });
38
- };
39
- var createAiService = (ai) => {
40
- if (ai?.client != null) {
41
- return AiService.make(ai.client);
42
- }
43
- if (ai?.endpoint != null) {
44
- return AiService.make(new EdgeAiServiceClient({
45
- endpoint: ai.endpoint
46
- }));
47
- }
48
- switch (ai?.provider) {
49
- case "dev":
50
- return AiService.make(new EdgeAiServiceClient({
51
- endpoint: AI_SERVICE_ENDPOINT.LOCAL,
52
- defaultGenerationOptions: {
53
- model: "@anthropic/claude-3-5-sonnet-20241022"
54
- }
55
- }));
56
- case "edge":
57
- return AiService.make(new EdgeAiServiceClient({
58
- endpoint: AI_SERVICE_ENDPOINT.REMOTE,
59
- defaultGenerationOptions: {
60
- model: "@anthropic/claude-3-5-sonnet-20241022"
61
- }
62
- }));
63
- case "ollama":
64
- return AiService.make(createTestAiServiceClient());
65
- case "lmstudio":
66
- throw new Error("LMStudio is not supported");
67
- }
68
- };
69
- var createCredentialsService = (credentials) => {
70
- if (credentials?.services) {
71
- return new ConfiguredCredentialsService(credentials.services);
72
- }
73
- if (credentials?.service) {
74
- return credentials.service;
75
- }
76
- };
77
- export {
78
- createTestServices
79
- };
80
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/testing/services.ts", "../../../../src/testing/logger.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Context } from 'effect';\n\nimport { type AiServiceEdgeClientOptions, EdgeAiServiceClient, type AiServiceClient, ToolRegistry } from '@dxos/ai';\nimport { AI_SERVICE_ENDPOINT, createTestAiServiceClient } from '@dxos/ai/testing';\nimport type { Space } from '@dxos/client/echo';\nimport type { EchoDatabase, QueueFactory } from '@dxos/echo-db';\nimport { assertArgument } from '@dxos/invariant';\n\nimport { consoleLogger, noopLogger } from './logger';\nimport {\n AiService,\n ConfiguredCredentialsService,\n type CredentialsService,\n DatabaseService,\n type EventLogger,\n QueueService,\n ServiceContainer,\n type ServiceCredential,\n ToolResolverService,\n type TracingService,\n} from '../services';\n\n// TODO(burdon): Factor out.\nexport type OneOf<T> = {\n [K in keyof T]: { [P in K]: T[P] } & { [P in Exclude<keyof T, K>]?: never };\n}[keyof T];\n\nexport type AiServiceProvider = 'dev' | 'edge' | 'ollama' | 'lmstudio';\n\nexport type TestServiceOptions = {\n /**\n * AI service configuration.\n */\n ai?: OneOf<{\n /**\n * Custom AI service client.\n */\n client?: AiServiceClient;\n\n /**\n * Edge AI service at specified endpoint.\n */\n endpoint?: AiServiceEdgeClientOptions['endpoint'];\n\n /**\n * Predefined AI service configuration.\n */\n // TODO(burdon): 'dev' and 'edge' are redundant with providing an endpoint.\n provider?: AiServiceProvider;\n }>;\n\n /**\n * Credentials service configuration.\n */\n credentials?: OneOf<{\n /**\n * Predefined credentials list.\n */\n services?: ServiceCredential[];\n\n /**\n * Custom credentials service.\n */\n service?: Context.Tag.Service<CredentialsService>;\n }>;\n\n /**\n * Database configuration.\n */\n db?: EchoDatabase;\n\n /**\n * Gets database and queue services from the space.\n * Exclusive with: `db`, `queues`\n */\n space?: Space;\n\n /**\n * Logging configuration.\n */\n logging?: {\n enabled?: boolean;\n logger?: Context.Tag.Service<EventLogger>;\n };\n\n /**\n * Queue service configuration.\n */\n queues?: QueueFactory;\n\n tracing?: {\n service?: Context.Tag.Service<TracingService>;\n };\n\n toolResolver?: Context.Tag.Service<ToolResolverService>;\n};\n\nexport const createTestServices = ({\n ai,\n credentials,\n db,\n logging,\n queues,\n space,\n tracing,\n toolResolver,\n}: TestServiceOptions = {}): ServiceContainer => {\n assertArgument(!(!!space && (!!db || !!queues)), 'space can be provided only if db and queues are not');\n\n return new ServiceContainer().setServices({\n ai: createAiService(ai),\n credentials: createCredentialsService(credentials),\n database: space || db ? DatabaseService.make(space?.db || db!) : undefined,\n eventLogger: logging?.logger ?? logging?.enabled ? consoleLogger : noopLogger,\n queues: space || queues ? QueueService.make(space?.queues || queues!, undefined) : undefined,\n tracing: tracing?.service,\n toolResolver: toolResolver ?? ToolResolverService.make(new ToolRegistry([])),\n });\n};\n\n// TODO(burdon): Enable model configuration.\nconst createAiService = (ai: TestServiceOptions['ai']): Context.Tag.Service<AiService> | undefined => {\n if (ai?.client != null) {\n return AiService.make(ai.client);\n }\n\n if (ai?.endpoint != null) {\n return AiService.make(new EdgeAiServiceClient({ endpoint: ai.endpoint }));\n }\n\n switch (ai?.provider) {\n case 'dev':\n return AiService.make(\n new EdgeAiServiceClient({\n endpoint: AI_SERVICE_ENDPOINT.LOCAL,\n defaultGenerationOptions: {\n model: '@anthropic/claude-3-5-sonnet-20241022',\n },\n }),\n );\n\n case 'edge':\n return AiService.make(\n new EdgeAiServiceClient({\n endpoint: AI_SERVICE_ENDPOINT.REMOTE,\n defaultGenerationOptions: {\n model: '@anthropic/claude-3-5-sonnet-20241022',\n },\n }),\n );\n\n case 'ollama':\n return AiService.make(createTestAiServiceClient());\n\n case 'lmstudio':\n throw new Error('LMStudio is not supported');\n }\n};\n\nconst createCredentialsService = (\n credentials: TestServiceOptions['credentials'] | undefined,\n): Context.Tag.Service<CredentialsService> | undefined => {\n if (credentials?.services) {\n return new ConfiguredCredentialsService(credentials.services);\n }\n\n if (credentials?.service) {\n return credentials.service;\n }\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Effect, type Context } from 'effect';\n\nimport { LogLevel } from '@dxos/log';\n\nimport { type EventLogger, createEventLogger } from '../services';\n\nexport const noopLogger: Context.Tag.Service<EventLogger> = {\n log: () => Effect.succeed(undefined),\n nodeId: undefined,\n};\n\nexport const consoleLogger: Context.Tag.Service<EventLogger> = createEventLogger(LogLevel.INFO);\n"],
5
- "mappings": ";;;;;;;;;;;;AAMA,SAA0CA,qBAA2CC,oBAAoB;AACzG,SAASC,qBAAqBC,iCAAiC;AAG/D,SAASC,sBAAsB;;;ACN/B,SAASC,cAA4B;AAErC,SAASC,gBAAgB;AAIlB,IAAMC,aAA+C;EAC1DC,KAAK,MAAMC,OAAOC,QAAQC,MAAAA;EAC1BC,QAAQD;AACV;AAEO,IAAME,gBAAkDC,kBAAkBC,SAASC,IAAI;;;ADsFvF,IAAMC,qBAAqB,CAAC,EACjCC,IACAC,aACAC,IACAC,SACAC,QACAC,OACAC,SACAC,aAAY,IACU,CAAC,MAAC;AACxBC,iBAAe,EAAE,CAAC,CAACH,UAAU,CAAC,CAACH,MAAM,CAAC,CAACE,UAAU,qDAAA;AAEjD,SAAO,IAAIK,iBAAAA,EAAmBC,YAAY;IACxCV,IAAIW,gBAAgBX,EAAAA;IACpBC,aAAaW,yBAAyBX,WAAAA;IACtCY,UAAUR,SAASH,KAAKY,gBAAgBC,KAAKV,OAAOH,MAAMA,EAAAA,IAAOc;IACjEC,aAAad,SAASe,UAAUf,SAASgB,UAAUC,gBAAgBC;IACnEjB,QAAQC,SAASD,SAASkB,aAAaP,KAAKV,OAAOD,UAAUA,QAASY,MAAAA,IAAaA;IACnFV,SAASA,SAASiB;IAClBhB,cAAcA,gBAAgBiB,oBAAoBT,KAAK,IAAIU,aAAa,CAAA,CAAE,CAAA;EAC5E,CAAA;AACF;AAGA,IAAMd,kBAAkB,CAACX,OAAAA;AACvB,MAAIA,IAAI0B,UAAU,MAAM;AACtB,WAAOC,UAAUZ,KAAKf,GAAG0B,MAAM;EACjC;AAEA,MAAI1B,IAAI4B,YAAY,MAAM;AACxB,WAAOD,UAAUZ,KAAK,IAAIc,oBAAoB;MAAED,UAAU5B,GAAG4B;IAAS,CAAA,CAAA;EACxE;AAEA,UAAQ5B,IAAI8B,UAAAA;IACV,KAAK;AACH,aAAOH,UAAUZ,KACf,IAAIc,oBAAoB;QACtBD,UAAUG,oBAAoBC;QAC9BC,0BAA0B;UACxBC,OAAO;QACT;MACF,CAAA,CAAA;IAGJ,KAAK;AACH,aAAOP,UAAUZ,KACf,IAAIc,oBAAoB;QACtBD,UAAUG,oBAAoBI;QAC9BF,0BAA0B;UACxBC,OAAO;QACT;MACF,CAAA,CAAA;IAGJ,KAAK;AACH,aAAOP,UAAUZ,KAAKqB,0BAAAA,CAAAA;IAExB,KAAK;AACH,YAAM,IAAIC,MAAM,2BAAA;EACpB;AACF;AAEA,IAAMzB,2BAA2B,CAC/BX,gBAAAA;AAEA,MAAIA,aAAaqC,UAAU;AACzB,WAAO,IAAIC,6BAA6BtC,YAAYqC,QAAQ;EAC9D;AAEA,MAAIrC,aAAasB,SAAS;AACxB,WAAOtB,YAAYsB;EACrB;AACF;",
6
- "names": ["EdgeAiServiceClient", "ToolRegistry", "AI_SERVICE_ENDPOINT", "createTestAiServiceClient", "assertArgument", "Effect", "LogLevel", "noopLogger", "log", "Effect", "succeed", "undefined", "nodeId", "consoleLogger", "createEventLogger", "LogLevel", "INFO", "createTestServices", "ai", "credentials", "db", "logging", "queues", "space", "tracing", "toolResolver", "assertArgument", "ServiceContainer", "setServices", "createAiService", "createCredentialsService", "database", "DatabaseService", "make", "undefined", "eventLogger", "logger", "enabled", "consoleLogger", "noopLogger", "QueueService", "service", "ToolResolverService", "ToolRegistry", "client", "AiService", "endpoint", "EdgeAiServiceClient", "provider", "AI_SERVICE_ENDPOINT", "LOCAL", "defaultGenerationOptions", "model", "REMOTE", "createTestAiServiceClient", "Error", "services", "ConfiguredCredentialsService"]
7
- }
@@ -1,50 +0,0 @@
1
- import { type BuildOptions, type BuildResult } from 'esbuild-wasm';
2
- export type Import = {
3
- moduleUrl: string;
4
- defaultImport: boolean;
5
- namedImports: string[];
6
- };
7
- export type BundleOptions = {
8
- /**
9
- * Path to the source file on the local file system.
10
- * If provided, the path will be used instead of the `source` code.
11
- */
12
- path?: string;
13
- /**
14
- * Source code to bundle.
15
- * Required if `path` is not provided.
16
- */
17
- source?: string;
18
- };
19
- export type BundleResult = {
20
- timestamp: number;
21
- sourceHash?: Buffer;
22
- imports?: Import[];
23
- bundle?: string;
24
- error?: any;
25
- };
26
- export type BundlerOptions = {
27
- platform: BuildOptions['platform'];
28
- sandboxedModules: string[];
29
- remoteModules: Record<string, string>;
30
- };
31
- export declare const initializeBundler: (options: {
32
- wasmUrl: string;
33
- }) => Promise<void>;
34
- /**
35
- * ESBuild bundler.
36
- */
37
- export declare class Bundler {
38
- private readonly _options;
39
- constructor(_options: BundlerOptions);
40
- bundle({ path, source }: BundleOptions): Promise<BundleResult>;
41
- analyzeImports(result: BuildResult): Import[];
42
- analyzeSourceFileImports(code: string): {
43
- defaultImportName: string;
44
- namedImports: string[];
45
- wildcardImportName: string;
46
- moduleIdentifier: string;
47
- quotes: string;
48
- }[];
49
- }
50
- //# sourceMappingURL=bundler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../../../../src/bundler/bundler.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,YAAY,EAAkC,KAAK,WAAW,EAAe,MAAM,cAAc,CAAC;AAOhH,MAAM,MAAM,MAAM,GAAG;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;IACnC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC,CAAC;AAGF,eAAO,MAAM,iBAAiB,GAAU,SAAS;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,kBAInE,CAAC;AAEF;;GAEG;AACH,qBAAa,OAAO;IACN,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,cAAc;IAE/C,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAwFpE,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE;IA2B7C,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG;QACtC,iBAAiB,EAAE,MAAM,CAAC;QAC1B,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,gBAAgB,EAAE,MAAM,CAAC;QACzB,MAAM,EAAE,MAAM,CAAC;KAChB,EAAE;CAaJ"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=bundler.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundler.test.d.ts","sourceRoot":"","sources":["../../../../src/bundler/bundler.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export * from './bundler';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bundler/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
@@ -1,16 +0,0 @@
1
- import { type DID } from 'iso-did/types';
2
- import { type Client } from '@dxos/client';
3
- import type { PublicKey } from '@dxos/keys';
4
- import { type UploadFunctionResponseBody } from '@dxos/protocols';
5
- export type UploadWorkerArgs = {
6
- client: Client;
7
- source: string;
8
- version: string;
9
- name?: string;
10
- functionId?: string;
11
- ownerPublicKey: PublicKey;
12
- };
13
- export declare const uploadWorkerFunction: ({ client, version, source, name, functionId, ownerPublicKey, }: UploadWorkerArgs) => Promise<UploadFunctionResponseBody>;
14
- export declare const incrementSemverPatch: (version: string) => string;
15
- export declare const publicKeyToDid: (key: PublicKey) => DID;
16
- //# sourceMappingURL=functions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../../src/edge/functions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAElE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,SAAS,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAU,gEAOxC,gBAAgB,KAAG,OAAO,CAAC,0BAA0B,CAqBvD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,KAAG,MAKtD,CAAC;AAGF,eAAO,MAAM,cAAc,GAAI,KAAK,SAAS,KAAG,GAE/C,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './functions';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/edge/index.ts"],"names":[],"mappings":"AAQA,cAAc,aAAa,CAAC"}
@@ -1,8 +0,0 @@
1
- import type { FunctionDefinition } from '../handler';
2
- import type { ServiceContainer } from '../services';
3
- export declare class FunctionExecutor {
4
- private readonly _services;
5
- constructor(_services: ServiceContainer);
6
- invoke<F extends FunctionDefinition<any, any>>(fnDef: F, input: F extends FunctionDefinition<infer I, infer _O> ? I : never): Promise<F extends FunctionDefinition<infer _I, infer O> ? O : never>;
7
- }
8
- //# sourceMappingURL=executor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../src/executor/executor.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAmB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAY,MAAM,aAAa,CAAC;AAE9D,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,gBAAgB;IAGlD,MAAM,CAAC,CAAC,SAAS,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,EACjD,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,CAAC,SAAS,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,GACjE,OAAO,CAAC,CAAC,SAAS,kBAAkB,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;CAkCxE"}
@@ -1,2 +0,0 @@
1
- export * from './executor';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/executor/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC"}
@@ -1,61 +0,0 @@
1
- import { Schema, type Context, type Effect } from 'effect';
2
- import { type AiServiceClient } from '@dxos/ai';
3
- import type { EchoDatabase } from '@dxos/echo-db';
4
- import { type HasId } from '@dxos/echo-schema';
5
- import { type SpaceId, type DXN } from '@dxos/keys';
6
- import { type QueryResult } from '@dxos/protocols';
7
- import type { Services } from './services';
8
- /**
9
- * Function handler.
10
- */
11
- export type FunctionHandler<TData = {}, TOutput = any> = (params: {
12
- /**
13
- * Services and context available to the function.
14
- */
15
- context: FunctionContext;
16
- /**
17
- * Data passed as the input to the function.
18
- * Must match the function's input schema.
19
- * This will be the payload from the trigger or other data passed into the function in a workflow.
20
- */
21
- data: TData;
22
- }) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any, Services>;
23
- /**
24
- * Function context.
25
- */
26
- export interface FunctionContext {
27
- /**
28
- * Resolves a service available to the function.
29
- * @throws if the service is not available.
30
- */
31
- getService: <T extends Context.Tag<any, any>>(tag: T) => Context.Tag.Service<T>;
32
- getSpace: (spaceId: SpaceId) => Promise<SpaceAPI>;
33
- /**
34
- * Space from which the function was invoked.
35
- */
36
- space: SpaceAPI | undefined;
37
- ai: AiServiceClient;
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
- }
54
- export type FunctionDefinition<T = {}, O = any> = {
55
- description?: string;
56
- inputSchema: Schema.Schema<T, any>;
57
- outputSchema?: Schema.Schema<O, any>;
58
- handler: FunctionHandler<T, O>;
59
- };
60
- export declare const defineFunction: <T, O>(params: FunctionDefinition<T, O>) => FunctionDefinition<T, O>;
61
- //# sourceMappingURL=handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/handler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE3D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAO3C;;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,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,UAAU,EAAE,CAAC,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAEhF,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAElD;;OAEG;IACH,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;IAE5B,EAAE,EAAE,eAAe,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAEhC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CAC9D;AAQD,MAAM,WAAW,SAAS;IACxB,UAAU,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3D,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,IAAI,OAAO,CAAC;IAElB,IAAI,EAAE,IAAI,YAAY,CAAC;IAGvB,IAAI,MAAM,IAAI,SAAS,CAAC;CACzB;AAOD,MAAM,MAAM,kBAAkB,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACrC,OAAO,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAChC,CAAC;AAGF,eAAO,MAAM,cAAc,GAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAc9F,CAAC"}
@@ -1,38 +0,0 @@
1
- import { Schema } from 'effect';
2
- import { Type } from '@dxos/echo';
3
- import { Ref } from '@dxos/echo-schema';
4
- /**
5
- * Source script.
6
- */
7
- export declare const ScriptType: Type.obj<Schema.Struct<{
8
- name: Schema.optional<typeof Schema.String>;
9
- description: Schema.optional<typeof Schema.String>;
10
- changed: Schema.optional<typeof Schema.Boolean>;
11
- source: import("@dxos/echo-schema").Ref$<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
12
- content: string;
13
- }>;
14
- }>>;
15
- export interface ScriptType extends Schema.Schema.Type<typeof ScriptType> {
16
- }
17
- /**
18
- * Function deployment.
19
- */
20
- export declare const FunctionType: Type.obj<Schema.Struct<{
21
- name: typeof Schema.NonEmptyString;
22
- version: typeof Schema.String;
23
- description: Schema.optional<typeof Schema.String>;
24
- source: Schema.optional<import("@dxos/echo-schema").Ref$<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
25
- name?: string | undefined;
26
- description?: string | undefined;
27
- changed?: boolean | undefined;
28
- source: Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
29
- content: string;
30
- }>;
31
- }>>;
32
- inputSchema: Schema.optional<Schema.Schema<Type.JsonSchema, Type.JsonSchema, never>>;
33
- outputSchema: Schema.optional<Schema.Schema<Type.JsonSchema, Type.JsonSchema, never>>;
34
- binding: Schema.optional<typeof Schema.String>;
35
- }>>;
36
- export interface FunctionType extends Schema.Schema.Type<typeof FunctionType> {
37
- }
38
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAmC,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGzE;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;GAatB,CAAC;AAEF,MAAM,WAAW,UAAW,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC;CAAG;AAE5E;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;GAsBxB,CAAC;AACF,MAAM,WAAW,YAAa,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC;CAAG"}
@@ -1,12 +0,0 @@
1
- import { Context, Layer } from 'effect';
2
- import type { AiServiceClient } from '@dxos/ai';
3
- declare const AiService_base: Context.TagClass<AiService, "AiService", {
4
- readonly client: AiServiceClient;
5
- }>;
6
- export declare class AiService extends AiService_base {
7
- static make: (client: AiServiceClient) => Context.Tag.Service<AiService>;
8
- static makeLayer: (client: AiServiceClient) => Layer.Layer<AiService>;
9
- static notAvailable: Layer.Layer<AiService, never, never>;
10
- }
11
- export {};
12
- //# sourceMappingURL=ai.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../../../src/services/ai.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;;qBAM3B,eAAe;;AAHpC,qBAAa,SAAU,SAAQ,cAK5B;IACD,MAAM,CAAC,IAAI,GAAI,QAAQ,eAAe,KAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAMrE;IAEF,MAAM,CAAC,SAAS,GAAI,QAAQ,eAAe,KAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CACjB;IAEnD,MAAM,CAAC,YAAY,uCAIhB;CACJ"}
@@ -1,15 +0,0 @@
1
- import { Context, Effect, Layer } from 'effect';
2
- import type { Obj, Ref, Relation } from '@dxos/echo';
3
- import type { EchoDatabase } from '@dxos/echo-db';
4
- import type { DXN } from '@dxos/keys';
5
- declare const DatabaseService_base: Context.TagClass<DatabaseService, "DatabaseService", {
6
- readonly db: EchoDatabase;
7
- }>;
8
- export declare class DatabaseService extends DatabaseService_base {
9
- static notAvailable: Layer.Layer<DatabaseService, never, never>;
10
- static make: (db: EchoDatabase) => Context.Tag.Service<DatabaseService>;
11
- static resolve: (dxn: DXN) => Effect.Effect<Obj.Any | Relation.Any, Error, DatabaseService>;
12
- static loadRef: <T>(ref: Ref.Ref<T>) => Effect.Effect<T, Error, never>;
13
- }
14
- export {};
15
- //# sourceMappingURL=database.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../../src/services/database.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;;iBAKrB,YAAY;;AAH7B,qBAAa,eAAgB,SAAQ,oBAKlC;IACD,MAAM,CAAC,YAAY,6CAIhB;IAEH,MAAM,CAAC,IAAI,GAAI,IAAI,YAAY,KAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAMpE;IAEF,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,eAAe,CAAC,CAWzF;IAEF,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAKnE;CACJ"}
@@ -1,37 +0,0 @@
1
- import { Effect, Context } from 'effect';
2
- import { LogLevel } from '@dxos/log';
3
- export type ComputeEvent = {
4
- type: 'begin-compute';
5
- nodeId: string;
6
- inputs: Record<string, any>;
7
- } | {
8
- type: 'end-compute';
9
- nodeId: string;
10
- outputs: Record<string, any>;
11
- } | {
12
- type: 'compute-input';
13
- nodeId: string;
14
- property: string;
15
- value: any;
16
- } | {
17
- type: 'compute-output';
18
- nodeId: string;
19
- property: string;
20
- value: any;
21
- } | {
22
- type: 'custom';
23
- nodeId: string;
24
- event: any;
25
- };
26
- declare const EventLogger_base: Context.TagClass<EventLogger, "EventLogger", {
27
- readonly log: (event: ComputeEvent) => void;
28
- readonly nodeId: string | undefined;
29
- }>;
30
- export declare class EventLogger extends EventLogger_base {
31
- static noop: Context.Tag.Service<EventLogger>;
32
- }
33
- export declare const logCustomEvent: (data: any) => Effect.Effect<void, never, EventLogger>;
34
- 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<EventLogger>;
36
- export {};
37
- //# sourceMappingURL=event-logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-logger.d.ts","sourceRoot":"","sources":["../../../../src/services/event-logger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGzC,OAAO,EAAO,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,MAAM,YAAY,GACpB;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7B,GACD;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B,GACD;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC;CACZ,GACD;IACE,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC;CACZ,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,GAAG,CAAC;CACZ,CAAC;;kBAIY,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI;qBAAmB,MAAM,GAAG,SAAS;;AAFpF,qBAAa,WAAY,SAAQ,gBAG9B;IACD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAG3C;CACH;AAED,eAAO,MAAM,cAAc,GAAI,MAAM,GAAG,4CAWpC,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,GAAI,OAAO,QAAQ,EAAE,UAAS,MAAgB,KAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAiB7G,CAAC"}
@@ -1,16 +0,0 @@
1
- import { Context } from 'effect';
2
- import type { SpaceId } from '@dxos/keys';
3
- declare const FunctionCallService_base: Context.TagClass<FunctionCallService, "FunctionCallService", {
4
- callFunction(deployedFunctionId: string, input: any, spaceId?: SpaceId): Promise<any>;
5
- }>;
6
- /**
7
- * Allows calling into other functions.
8
- */
9
- export declare class FunctionCallService extends FunctionCallService_base {
10
- static fromClient(baseUrl: string, spaceId: SpaceId): Context.Tag.Service<FunctionCallService>;
11
- static mock: () => {
12
- callFunction: (deployedFunctionId: string, input: any) => Promise<any>;
13
- };
14
- }
15
- export {};
16
- //# sourceMappingURL=function-call-service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"function-call-service.d.ts","sourceRoot":"","sources":["../../../../src/services/function-call-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;;qCAQL,MAAM,SAAS,GAAG,YAAY,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;;AANzF;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,wBAKtC;IACD,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC;IAiB9F,MAAM,CAAC,IAAI;2CAEkC,MAAM,SAAS,GAAG;MAI7D;CACH"}
@@ -1,46 +0,0 @@
1
- import { Layer, type Context } from 'effect';
2
- import { AiService } from './ai';
3
- import { CredentialsService } from './credentials';
4
- import { DatabaseService } from './database';
5
- import { EventLogger } from './event-logger';
6
- import { FunctionCallService } from './function-call-service';
7
- import { QueueService } from './queues';
8
- import { ToolResolverService } from './tool-resolver';
9
- import { TracingService } from './tracing';
10
- /**
11
- * List of all service tags and their names.
12
- */
13
- export interface ServiceTagRecord {
14
- ai: AiService;
15
- credentials: CredentialsService;
16
- database: DatabaseService;
17
- eventLogger: EventLogger;
18
- functionCallService: FunctionCallService;
19
- tracing: TracingService;
20
- queues: QueueService;
21
- toolResolver: ToolResolverService;
22
- }
23
- /**
24
- * List of all services and their runtime types.
25
- */
26
- export type ServiceRecord = {
27
- [K in keyof ServiceTagRecord]: Context.Tag.Service<ServiceTagRecord[K]>;
28
- };
29
- /**
30
- * Union of all services.
31
- */
32
- export type Services = ServiceTagRecord[keyof ServiceTagRecord];
33
- export declare const SERVICE_TAGS: Context.Tag<any, any>[];
34
- export declare class ServiceContainer {
35
- private _services;
36
- /**
37
- * Set services.
38
- * @param services - Services to set.
39
- * @returns The container instance.
40
- */
41
- setServices(services: Partial<ServiceRecord>): this;
42
- getService<Id, T>(tag: Context.Tag<Id, T>): T;
43
- clone(): ServiceContainer;
44
- createLayer(): Layer.Layer<Services>;
45
- }
46
- //# sourceMappingURL=service-container.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service-container.d.ts","sourceRoot":"","sources":["../../../../src/services/service-container.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAgC,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,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;IACrB,YAAY,EAAE,mBAAmB,CAAC;CACnC;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;AAahE,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,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC;IAU7C,KAAK,IAAI,gBAAgB;IAKzB,WAAW,IAAI,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC;CAgCrC"}
@@ -1,14 +0,0 @@
1
- import { Context } from 'effect';
2
- import { type ToolResolver } from '@dxos/ai';
3
- declare const ToolResolverService_base: Context.TagClass<ToolResolverService, "ToolResolverService", {
4
- /**
5
- * Tool resolver.
6
- */
7
- readonly toolResolver: ToolResolver;
8
- }>;
9
- export declare class ToolResolverService extends ToolResolverService_base {
10
- static notAvailable: Context.Tag.Service<ToolResolverService>;
11
- static make: (toolResolver: ToolResolver) => Context.Tag.Service<ToolResolverService>;
12
- }
13
- export {};
14
- //# sourceMappingURL=tool-resolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tool-resolver.d.ts","sourceRoot":"","sources":["../../../../src/services/tool-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;;IAKzC;;OAEG;2BACoB,YAAY;;AANvC,qBAAa,mBAAoB,SAAQ,wBAQtC;IACD,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAM3D;IAEF,MAAM,CAAC,IAAI,GAAI,cAAc,YAAY,KAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAIlF;CACH"}
@@ -1,2 +0,0 @@
1
- export * from './services';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC"}
@@ -1,5 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,71 +0,0 @@
1
- import { type Context } from 'effect';
2
- import { type AiServiceEdgeClientOptions, type AiServiceClient } from '@dxos/ai';
3
- import type { Space } from '@dxos/client/echo';
4
- import type { EchoDatabase, QueueFactory } from '@dxos/echo-db';
5
- import { type CredentialsService, type EventLogger, ServiceContainer, type ServiceCredential, ToolResolverService, type TracingService } from '../services';
6
- export type OneOf<T> = {
7
- [K in keyof T]: {
8
- [P in K]: T[P];
9
- } & {
10
- [P in Exclude<keyof T, K>]?: never;
11
- };
12
- }[keyof T];
13
- export type AiServiceProvider = 'dev' | 'edge' | 'ollama' | 'lmstudio';
14
- export type TestServiceOptions = {
15
- /**
16
- * AI service configuration.
17
- */
18
- ai?: OneOf<{
19
- /**
20
- * Custom AI service client.
21
- */
22
- client?: AiServiceClient;
23
- /**
24
- * Edge AI service at specified endpoint.
25
- */
26
- endpoint?: AiServiceEdgeClientOptions['endpoint'];
27
- /**
28
- * Predefined AI service configuration.
29
- */
30
- provider?: AiServiceProvider;
31
- }>;
32
- /**
33
- * Credentials service configuration.
34
- */
35
- credentials?: OneOf<{
36
- /**
37
- * Predefined credentials list.
38
- */
39
- services?: ServiceCredential[];
40
- /**
41
- * Custom credentials service.
42
- */
43
- service?: Context.Tag.Service<CredentialsService>;
44
- }>;
45
- /**
46
- * Database configuration.
47
- */
48
- db?: EchoDatabase;
49
- /**
50
- * Gets database and queue services from the space.
51
- * Exclusive with: `db`, `queues`
52
- */
53
- space?: Space;
54
- /**
55
- * Logging configuration.
56
- */
57
- logging?: {
58
- enabled?: boolean;
59
- logger?: Context.Tag.Service<EventLogger>;
60
- };
61
- /**
62
- * Queue service configuration.
63
- */
64
- queues?: QueueFactory;
65
- tracing?: {
66
- service?: Context.Tag.Service<TracingService>;
67
- };
68
- toolResolver?: Context.Tag.Service<ToolResolverService>;
69
- };
70
- export declare const createTestServices: ({ ai, credentials, db, logging, queues, space, tracing, toolResolver, }?: TestServiceOptions) => ServiceContainer;
71
- //# sourceMappingURL=services.d.ts.map
@@ -1 +0,0 @@
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,EAAE,KAAK,0BAA0B,EAAuB,KAAK,eAAe,EAAgB,MAAM,UAAU,CAAC;AAEpH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAIhE,OAAO,EAGL,KAAK,kBAAkB,EAEvB,KAAK,WAAW,EAEhB,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,mBAAmB,EACnB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAGrB,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;KACpB,CAAC,IAAI,MAAM,CAAC,GAAG;SAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAAE,GAAG;SAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK;KAAE;CAC5E,CAAC,MAAM,CAAC,CAAC,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEvE,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,EAAE,CAAC,EAAE,KAAK,CAAC;QACT;;WAEG;QACH,MAAM,CAAC,EAAE,eAAe,CAAC;QAEzB;;WAEG;QACH,QAAQ,CAAC,EAAE,0BAA0B,CAAC,UAAU,CAAC,CAAC;QAElD;;WAEG;QAEH,QAAQ,CAAC,EAAE,iBAAiB,CAAC;KAC9B,CAAC,CAAC;IAEH;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC;QAClB;;WAEG;QACH,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;QAE/B;;WAEG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;KACnD,CAAC,CAAC;IAEH;;OAEG;IACH,EAAE,CAAC,EAAE,YAAY,CAAC;IAElB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;OAEG;IACH,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,MAAM,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;KAC3C,CAAC;IAEF;;OAEG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IAEtB,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;KAC/C,CAAC;IAEF,YAAY,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACzD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,0EAShC,kBAAuB,KAAG,gBAY5B,CAAC"}