@relayfx/sdk 0.3.1 → 0.3.3

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 (64) hide show
  1. package/dist/ai.js +67 -37
  2. package/dist/http-server.js +22 -0
  3. package/dist/index-25gwk9tj.js +3423 -0
  4. package/dist/{index-3sv8mmz5.js → index-49fm2rdv.js} +23 -30
  5. package/dist/{index-c2skef55.js → index-8pa5e2yn.js} +16521 -18783
  6. package/dist/index-cphmds30.js +2852 -0
  7. package/dist/index-nb39b5ae.js +17 -0
  8. package/dist/index.js +315 -844
  9. package/dist/mysql.js +18 -18
  10. package/dist/postgres.js +724 -24
  11. package/dist/sqlite.js +57 -168
  12. package/dist/types/ai/index.d.ts +2 -1
  13. package/dist/types/ai/language-model/language-model-registration.d.ts +9 -6
  14. package/dist/types/relay/adapter-outbox.d.ts +1 -1
  15. package/dist/types/relay/ai.d.ts +34 -2
  16. package/dist/types/relay/child-fan-out-admission.d.ts +5 -0
  17. package/dist/types/relay/child-fan-out-host.d.ts +73 -0
  18. package/dist/types/relay/client-public.d.ts +481 -0
  19. package/dist/types/relay/client.d.ts +1 -478
  20. package/dist/types/relay/database-identity.d.ts +4 -0
  21. package/dist/types/relay/http-server.d.ts +95 -0
  22. package/dist/types/relay/index.d.ts +37 -14
  23. package/dist/types/relay/internal-client.d.ts +22 -0
  24. package/dist/types/relay/language-model-registration.d.ts +13 -0
  25. package/dist/types/relay/mysql.d.ts +6 -7
  26. package/dist/types/relay/operation.d.ts +4 -4
  27. package/dist/types/relay/postgres.d.ts +10 -7
  28. package/dist/types/relay/runtime-acquisition-error.d.ts +61 -0
  29. package/dist/types/relay/runtime-database-adapter.d.ts +8 -5
  30. package/dist/types/relay/runtime-database-owner.d.ts +13 -0
  31. package/dist/types/relay/runtime-database-public.d.ts +10 -0
  32. package/dist/types/relay/runtime.d.ts +77 -72
  33. package/dist/types/relay/sqlite-runtime.d.ts +5 -18
  34. package/dist/types/relay/sqlite.d.ts +4 -31
  35. package/dist/types/relay/state-version-conflict.d.ts +12 -0
  36. package/dist/types/relay/tool-runtime.d.ts +44 -0
  37. package/dist/types/relay/tool-worker.d.ts +2 -2
  38. package/dist/types/relay/workflow-definition-host.d.ts +32 -0
  39. package/dist/types/runtime/agent/agent-loop-error.d.ts +21 -0
  40. package/dist/types/runtime/agent/agent-loop-service.d.ts +6 -16
  41. package/dist/types/runtime/agent/prompt-assembler-service.d.ts +3 -3
  42. package/dist/types/runtime/cluster/execution-entity.d.ts +3 -3
  43. package/dist/types/runtime/execution/execution-service.d.ts +3 -0
  44. package/dist/types/runtime/index.d.ts +1 -0
  45. package/dist/types/runtime/model/language-model-service.d.ts +5 -12
  46. package/dist/types/runtime/model/model-hub.d.ts +27 -0
  47. package/dist/types/runtime/presence/presence-contract.d.ts +24 -0
  48. package/dist/types/runtime/presence/presence-service.d.ts +6 -24
  49. package/dist/types/runtime/runner/runner-runtime-service.d.ts +29 -13
  50. package/dist/types/runtime/session/session-store-service.d.ts +4 -1
  51. package/dist/types/runtime/tool/tool-runtime-contract.d.ts +121 -0
  52. package/dist/types/runtime/tool/tool-runtime-service.d.ts +6 -120
  53. package/dist/types/runtime/workflow/execution-workflow.d.ts +22 -24
  54. package/dist/types/schema/agent-schema.d.ts +4 -1
  55. package/dist/types/schema/execution-schema.d.ts +13 -2
  56. package/dist/types/schema/index.d.ts +1 -0
  57. package/dist/types/schema/pagination-schema.d.ts +17 -0
  58. package/dist/types/schema/shared-schema.d.ts +4 -0
  59. package/dist/types/store-sql/schema/relay-schema.d.ts +12 -12
  60. package/dist/types/store-sql/session/session-repository.d.ts +54 -11
  61. package/package.json +17 -14
  62. package/dist/index-9k4k3wq1.js +0 -2860
  63. package/dist/index-d3dme13d.js +0 -141
  64. package/dist/types/relay/database.d.ts +0 -16
@@ -1,13 +1,14 @@
1
1
  // @bun
2
2
  import {
3
- ConfigFailure,
4
- DatabaseDialect,
5
3
  MigratorError,
6
4
  RuntimeConfigurationError,
7
5
  RuntimeMigrationError,
6
+ RuntimeTopologyError,
7
+ Service,
8
8
  SqlFailure,
9
- exports_runtime_database
10
- } from "./index-9k4k3wq1.js";
9
+ make,
10
+ normalizeAcquisitionCause
11
+ } from "./index-8pa5e2yn.js";
11
12
 
12
13
  // src/migration-errors.ts
13
14
  import { Cause, Effect, Function } from "effect";
@@ -24,46 +25,38 @@ var migrationFailure = Function.dual(3, (dialect, phase, cause) => retain(Runtim
24
25
  var normalizeMigrationCause = Function.dual(3, (effect, dialect, phase) => effect.pipe(Effect.catchCause((cause) => Cause.hasInterrupts(cause) ? Effect.interrupt : Effect.fail(migrationFailure(dialect, phase, cause)))));
25
26
 
26
27
  // src/runtime-database-adapter.ts
27
- import { Cause as Cause2, Effect as Effect2, Layer } from "effect";
28
+ import { Effect as Effect2, Layer, Schema } from "effect";
28
29
  import { SqlClient } from "effect/unstable/sql/SqlClient";
29
- var configurationFailure = (cause) => {
30
- const configFailure = ConfigFailure.make({ reason: "database client layer acquisition failed" });
31
- Object.defineProperty(configFailure, "originalCause", { value: cause, enumerable: false });
32
- return RuntimeConfigurationError.make({
33
- setting: "databaseLayer",
34
- nextAction: "provide-setting",
35
- cause: configFailure
36
- });
37
- };
38
- var normalizeClientLayer = (clientLayer) => clientLayer.pipe(Layer.catchCause((cause) => {
39
- if (Cause2.hasInterrupts(cause)) {
40
- return Layer.unwrap(Effect2.failCause(Cause2.map(cause, configurationFailure)));
41
- }
42
- return Layer.unwrap(Effect2.fail(configurationFailure(Cause2.squash(cause))));
43
- }));
44
- var runtimeDatabaseLayer = (options) => {
30
+ var normalizeClientLayer = (clientLayer) => clientLayer.pipe(Layer.catchCause((cause) => Layer.unwrap(Effect2.failCause(normalizeAcquisitionCause(cause, "database-client", (error) => Schema.is(RuntimeConfigurationError)(error) || Schema.is(RuntimeTopologyError)(error) || Schema.is(RuntimeMigrationError)(error))))));
31
+ var database = (options) => {
45
32
  const normalizedClientLayer = normalizeClientLayer(options.clientLayer);
46
- const databaseLayer = Layer.effect(exports_runtime_database.Service, Effect2.gen(function* () {
33
+ const databaseLayer = Layer.effect(Service, Effect2.gen(function* () {
47
34
  const sql = yield* SqlClient;
48
- const database = options.dialect === "sqlite" ? exports_runtime_database.Service.of({
35
+ const runtimeDatabase = options.dialect === "sqlite" ? Service.of({
49
36
  dialect: "sqlite",
50
37
  databaseIdentity: options.databaseIdentity,
51
38
  ownership: "runtime-exclusive",
52
39
  schemaHead: options.schemaHead,
53
40
  notification: "in-process",
54
- acquireSchema: options.schema.pipe(Effect2.provideService(SqlClient, sql))
55
- }) : exports_runtime_database.Service.of({
41
+ acquireSchema: options.acquire.pipe(Effect2.provideService(SqlClient, sql))
42
+ }) : Service.of({
56
43
  dialect: options.dialect,
57
44
  databaseIdentity: options.databaseIdentity,
58
45
  ownership: "shared-multi-node",
59
46
  schemaHead: options.schemaHead,
60
47
  notification: options.dialect === "pg" ? "pg-listen-notify" : "polling",
61
- verifySchema: options.schema.pipe(Effect2.provideService(SqlClient, sql))
48
+ verifySchema: options.acquire.pipe(Effect2.provideService(SqlClient, sql))
62
49
  });
63
- return database;
50
+ return runtimeDatabase;
64
51
  })).pipe(Layer.provide(normalizedClientLayer));
65
- const layer = Layer.merge(normalizedClientLayer, databaseLayer);
66
- return Object.assign(layer, { [DatabaseDialect]: options.dialect });
52
+ const runtimeLayer = Layer.merge(normalizedClientLayer, databaseLayer);
53
+ const withClient = (effect) => Effect2.scoped(Layer.build(normalizedClientLayer).pipe(Effect2.flatMap((context) => Effect2.provide(effect, context))));
54
+ return make({
55
+ dialect: options.dialect,
56
+ runtimeLayer,
57
+ migrate: withClient(options.migrate),
58
+ verify: withClient(options.verify)
59
+ });
67
60
  };
68
61
 
69
- export { normalizeMigrationCause, normalizeClientLayer, runtimeDatabaseLayer };
62
+ export { normalizeMigrationCause, database };