@skein-js/runtime 0.2.1 → 0.3.0

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 (2) hide show
  1. package/dist/index.js +24 -3
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -11,7 +11,10 @@ import {
11
11
  } from "@skein-js/express";
12
12
  import { RedisRunEventBus, RedisRunQueue } from "@skein-js/redis";
13
13
  import { MemoryRunEventBus, MemoryRunQueue, MemorySkeinStore } from "@skein-js/storage-memory";
14
- import { PostgresSkeinStore } from "@skein-js/storage-postgres";
14
+ import {
15
+ createPostgresPool,
16
+ PostgresSkeinStore
17
+ } from "@skein-js/storage-postgres";
15
18
 
16
19
  // src/errors.ts
17
20
  var RuntimeConfigError = class extends Error {
@@ -104,6 +107,20 @@ function requireEnv(name, driver) {
104
107
  }
105
108
  return value;
106
109
  }
110
+ function postgresConnectionOptions() {
111
+ const options = {};
112
+ const rawMax = process.env["PG_POOL_MAX"];
113
+ if (rawMax !== void 0 && rawMax.trim() !== "") {
114
+ const max = Number(rawMax);
115
+ if (!Number.isInteger(max) || max <= 0) {
116
+ throw new RuntimeConfigError(`PG_POOL_MAX must be a positive integer (got "${rawMax}").`);
117
+ }
118
+ options.poolMax = max;
119
+ }
120
+ const noVerify = process.env["DATABASE_SSL_NO_VERIFY"];
121
+ if (noVerify === "1" || noVerify?.toLowerCase() === "true") options.sslNoVerify = true;
122
+ return options;
123
+ }
107
124
  function reroutableGraphResolver(initial) {
108
125
  let current = initial;
109
126
  return {
@@ -155,10 +172,14 @@ async function buildRuntime(options) {
155
172
  configDir: first.configDir,
156
173
  importModule
157
174
  });
158
- const pgStore = await PostgresSkeinStore.connect(databaseUrl, index ? { index } : {});
175
+ const connectionOptions = postgresConnectionOptions();
176
+ const pgStore = await PostgresSkeinStore.connect(databaseUrl, {
177
+ ...index ? { index } : {},
178
+ ...connectionOptions
179
+ });
159
180
  disposers.push(() => pgStore.close());
160
181
  await pgStore.migrate();
161
- const saver = PostgresSaver.fromConnString(databaseUrl);
182
+ const saver = new PostgresSaver(createPostgresPool(databaseUrl, connectionOptions));
162
183
  disposers.push(() => saver.end());
163
184
  await saver.setup();
164
185
  return { skeinStore: pgStore, checkpointer: saver };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skein-js/runtime",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Assembles skein-js ProtocolDeps from langgraph.json + selected drivers (memory/Postgres/Redis).",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Maina Wycliffe <wmmaina7@gmail.com>",
@@ -42,12 +42,12 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "cors": "^2.8.5",
45
- "@skein-js/agent-protocol": "0.2.1",
46
- "@skein-js/express": "0.2.1",
47
- "@skein-js/redis": "0.2.1",
48
- "@skein-js/storage-postgres": "0.2.1",
49
- "@skein-js/storage-memory": "0.2.1",
50
- "@skein-js/config": "0.2.1"
45
+ "@skein-js/agent-protocol": "0.3.0",
46
+ "@skein-js/express": "0.3.0",
47
+ "@skein-js/config": "0.3.0",
48
+ "@skein-js/storage-memory": "0.3.0",
49
+ "@skein-js/storage-postgres": "0.3.0",
50
+ "@skein-js/redis": "0.3.0"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "@langchain/langgraph": "^1.4.0",
@@ -58,7 +58,7 @@
58
58
  "@langchain/langgraph": "^1.4.0",
59
59
  "@langchain/langgraph-checkpoint-postgres": "^1.0.4",
60
60
  "@types/cors": "^2.8.17",
61
- "@skein-js/test-support": "0.2.1"
61
+ "@skein-js/test-support": "0.3.0"
62
62
  },
63
63
  "publishConfig": {
64
64
  "access": "public"