@axiom-lattice/pg-stores 3.3.1 → 3.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @axiom-lattice/pg-stores@3.3.1 build /home/runner/work/agentic/agentic/packages/pg-stores
2
+ > @axiom-lattice/pg-stores@3.3.3 build /home/runner/work/agentic/agentic/packages/pg-stores
3
3
  > tsup src/index.ts --format cjs,esm --dts --sourcemap
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,13 +8,13 @@
8
8
  CLI Target: es2020
9
9
  CJS Build start
10
10
  ESM Build start
11
- ESM dist/index.mjs 425.03 KB
12
- ESM dist/index.mjs.map 790.15 KB
13
- ESM ⚡️ Build success in 910ms
14
- CJS dist/index.js 433.50 KB
15
- CJS dist/index.js.map 790.48 KB
16
- CJS ⚡️ Build success in 981ms
11
+ CJS dist/index.js 434.94 KB
12
+ CJS dist/index.js.map 793.26 KB
13
+ CJS ⚡️ Build success in 1005ms
14
+ ESM dist/index.mjs 426.45 KB
15
+ ESM dist/index.mjs.map 792.92 KB
16
+ ESM ⚡️ Build success in 1062ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 15242ms
18
+ DTS ⚡️ Build success in 13655ms
19
19
  DTS dist/index.d.ts 91.36 KB
20
20
  DTS dist/index.d.mts 91.36 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @axiom-lattice/pg-stores
2
2
 
3
+ ## 3.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @axiom-lattice/core@6.3.3
9
+
10
+ ## 3.3.2
11
+
12
+ ### Patch Changes
13
+
14
+ - bb2614f: Chating composer height, plugin connection-secret encryption, and manage_task compact cards.
15
+
16
+ - react-sdk: keep the Chating composer input from collapsing after a run. In slot mode (Chating always passes an array `slotConfig`) the Sender input is a `contentEditable` whose height comes from `autoSize`; without a `minRows` the empty editor lost its placeholder-driven line box once streaming ended and collapsed to zero height on some platforms (e.g. Windows Chrome), leaving the input unreachable while the footer stayed visible. Pass `autoSize={{ minRows: 1, maxRows: 8 }}` like `ProjectRoomComposer`.
17
+ - protocols/core: add `ConnectionEntry.secretFields`, plus `connectionSecretFields` / `encryptConfigFields` / `decryptConfigFields`.
18
+ - local-stores/pg-stores: encrypt the declared secret fields on save and decrypt on read, so the API and runtime consumers always receive real values. Existing plaintext rows read unchanged and convert on their next save (PG migration v188).
19
+ - gateway: plugin builder self-test discovery + secret redaction.
20
+ - core: `manage_task` `add_activity` now returns the target task alongside the activity (`{ success, data, task }`), so UIs can show which task an activity was written to.
21
+ - react-sdk: every `manage_task` action renders a compact chip in the chat stream and reveals its full card on hover. Fixes `get` and `add_activity`, which previously rendered no UI at all.
22
+
23
+ - Updated dependencies [bb2614f]
24
+ - @axiom-lattice/protocols@4.7.1
25
+ - @axiom-lattice/core@6.3.2
26
+
3
27
  ## 3.3.1
4
28
 
5
29
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1378,6 +1378,7 @@ var PostgreSQLDatabaseConfigStore = class {
1378
1378
 
1379
1379
  // src/stores/PostgreSQLConnectionStore.ts
1380
1380
  var import_uuid = require("uuid");
1381
+ var import_core2 = require("@axiom-lattice/core");
1381
1382
  var TABLE = "lattice_connection_configs";
1382
1383
  var PostgreSQLConnectionStore = class {
1383
1384
  constructor(db) {
@@ -1408,9 +1409,10 @@ var PostgreSQLConnectionStore = class {
1408
1409
  async create(entry) {
1409
1410
  const id = (0, import_uuid.v4)();
1410
1411
  const now = (/* @__PURE__ */ new Date()).toISOString();
1412
+ const secretFields = entry.secretFields?.length ? entry.secretFields : void 0;
1411
1413
  await this.db.query(
1412
- `INSERT INTO ${TABLE} (id, tenant_id, type, key, name, description, config, status, created_at, updated_at)
1413
- VALUES ($1, $2, $3, $4, $5, $6, $7, 'active', $8::timestamp, $9::timestamp)`,
1414
+ `INSERT INTO ${TABLE} (id, tenant_id, type, key, name, description, config, secret_fields, status, created_at, updated_at)
1415
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8::jsonb, 'active', $9::timestamp, $10::timestamp)`,
1414
1416
  [
1415
1417
  id,
1416
1418
  entry.tenantId,
@@ -1418,12 +1420,13 @@ var PostgreSQLConnectionStore = class {
1418
1420
  entry.key,
1419
1421
  entry.name,
1420
1422
  entry.description || null,
1421
- JSON.stringify(entry.config),
1423
+ JSON.stringify((0, import_core2.encryptConfigFields)(entry.config, secretFields)),
1424
+ secretFields ? JSON.stringify(secretFields) : null,
1422
1425
  now,
1423
1426
  now
1424
1427
  ]
1425
1428
  );
1426
- return { id, ...entry, createdAt: now, updatedAt: now };
1429
+ return { id, ...entry, secretFields, createdAt: now, updatedAt: now };
1427
1430
  }
1428
1431
  async update(tenantId, type, key, updates) {
1429
1432
  const existing = await this.getByKey(tenantId, type, key);
@@ -1440,8 +1443,11 @@ var PostgreSQLConnectionStore = class {
1440
1443
  values.push(updates.description || null);
1441
1444
  }
1442
1445
  if (updates.config !== void 0) {
1446
+ const secretFields = updates.secretFields?.length ? updates.secretFields : existing.secretFields?.length ? existing.secretFields : void 0;
1443
1447
  setClauses.push(`config = $${paramIndex++}`);
1444
- values.push(JSON.stringify(updates.config));
1448
+ values.push(JSON.stringify((0, import_core2.encryptConfigFields)(updates.config, secretFields)));
1449
+ setClauses.push(`secret_fields = $${paramIndex++}::jsonb`);
1450
+ values.push(secretFields ? JSON.stringify(secretFields) : null);
1445
1451
  }
1446
1452
  if (setClauses.length === 0) return existing;
1447
1453
  setClauses.push(`updated_at = $${paramIndex++}::timestamp`);
@@ -1464,6 +1470,9 @@ var PostgreSQLConnectionStore = class {
1464
1470
  return (result.rowCount ?? 0) > 0;
1465
1471
  }
1466
1472
  mapRow(row) {
1473
+ const parsedSecretFields = typeof row.secret_fields === "string" ? JSON.parse(row.secret_fields) : row.secret_fields;
1474
+ const secretFields = Array.isArray(parsedSecretFields) && parsedSecretFields.length > 0 ? parsedSecretFields.filter((field) => typeof field === "string") : void 0;
1475
+ const storedConfig = typeof row.config === "string" ? JSON.parse(row.config) : row.config;
1467
1476
  return {
1468
1477
  id: row.id,
1469
1478
  tenantId: row.tenant_id,
@@ -1471,7 +1480,8 @@ var PostgreSQLConnectionStore = class {
1471
1480
  key: row.key,
1472
1481
  name: row.name,
1473
1482
  description: row.description || void 0,
1474
- config: typeof row.config === "string" ? JSON.parse(row.config) : row.config,
1483
+ config: (0, import_core2.decryptConfigFields)(storedConfig, secretFields),
1484
+ secretFields,
1475
1485
  createdAt: row.created_at instanceof Date ? row.created_at.toISOString() : String(row.created_at),
1476
1486
  updatedAt: row.updated_at instanceof Date ? row.updated_at.toISOString() : String(row.updated_at)
1477
1487
  };
@@ -1518,7 +1528,7 @@ var createMetricsConfigsTable = {
1518
1528
  };
1519
1529
 
1520
1530
  // src/stores/PostgreSQLMetricsServerConfigStore.ts
1521
- var import_core2 = require("@axiom-lattice/core");
1531
+ var import_core3 = require("@axiom-lattice/core");
1522
1532
  var PostgreSQLMetricsServerConfigStore = class {
1523
1533
  constructor(options) {
1524
1534
  this.initialized = false;
@@ -1774,7 +1784,7 @@ var PostgreSQLMetricsServerConfigStore = class {
1774
1784
  const config = typeof row.config === "string" ? JSON.parse(row.config) : row.config;
1775
1785
  if (config.apiKey) {
1776
1786
  try {
1777
- config.apiKey = (0, import_core2.decrypt)(config.apiKey);
1787
+ config.apiKey = (0, import_core3.decrypt)(config.apiKey);
1778
1788
  } catch (error) {
1779
1789
  console.error("Failed to decrypt apiKey:", error);
1780
1790
  throw new Error("Failed to decrypt metrics server configuration");
@@ -1782,7 +1792,7 @@ var PostgreSQLMetricsServerConfigStore = class {
1782
1792
  }
1783
1793
  if (config.password) {
1784
1794
  try {
1785
- config.password = (0, import_core2.decrypt)(config.password);
1795
+ config.password = (0, import_core3.decrypt)(config.password);
1786
1796
  } catch (error) {
1787
1797
  console.error("Failed to decrypt password:", error);
1788
1798
  throw new Error("Failed to decrypt metrics server configuration");
@@ -1805,10 +1815,10 @@ var PostgreSQLMetricsServerConfigStore = class {
1805
1815
  encryptSecretsInConfig(config) {
1806
1816
  const configCopy = { ...config };
1807
1817
  if (configCopy.apiKey) {
1808
- configCopy.apiKey = (0, import_core2.encrypt)(configCopy.apiKey);
1818
+ configCopy.apiKey = (0, import_core3.encrypt)(configCopy.apiKey);
1809
1819
  }
1810
1820
  if (configCopy.password) {
1811
- configCopy.password = (0, import_core2.encrypt)(configCopy.password);
1821
+ configCopy.password = (0, import_core3.encrypt)(configCopy.password);
1812
1822
  }
1813
1823
  return configCopy;
1814
1824
  }
@@ -1862,7 +1872,7 @@ var createMcpServerConfigsTable = {
1862
1872
  };
1863
1873
 
1864
1874
  // src/stores/PostgreSQLMcpServerConfigStore.ts
1865
- var import_core3 = require("@axiom-lattice/core");
1875
+ var import_core4 = require("@axiom-lattice/core");
1866
1876
  var PostgreSQLMcpServerConfigStore = class {
1867
1877
  constructor(options) {
1868
1878
  this.initialized = false;
@@ -2136,7 +2146,7 @@ var PostgreSQLMcpServerConfigStore = class {
2136
2146
  try {
2137
2147
  const decryptedEnv = {};
2138
2148
  for (const [key, value] of Object.entries(config.env)) {
2139
- decryptedEnv[key] = (0, import_core3.decrypt)(value);
2149
+ decryptedEnv[key] = (0, import_core4.decrypt)(value);
2140
2150
  }
2141
2151
  config.env = decryptedEnv;
2142
2152
  } catch (error) {
@@ -2148,7 +2158,7 @@ var PostgreSQLMcpServerConfigStore = class {
2148
2158
  try {
2149
2159
  const decryptedHeaders = {};
2150
2160
  for (const [key, value] of Object.entries(config.headers)) {
2151
- decryptedHeaders[key] = (0, import_core3.decrypt)(value);
2161
+ decryptedHeaders[key] = (0, import_core4.decrypt)(value);
2152
2162
  }
2153
2163
  config.headers = decryptedHeaders;
2154
2164
  } catch (error) {
@@ -2179,7 +2189,7 @@ var PostgreSQLMcpServerConfigStore = class {
2179
2189
  if (configCopy.env && Object.keys(configCopy.env).length > 0) {
2180
2190
  const encryptedEnv = {};
2181
2191
  for (const [key, value] of Object.entries(configCopy.env)) {
2182
- encryptedEnv[key] = (0, import_core3.encrypt)(value);
2192
+ encryptedEnv[key] = (0, import_core4.encrypt)(value);
2183
2193
  }
2184
2194
  configCopy.env = encryptedEnv;
2185
2195
  isEnvEncrypted = true;
@@ -2187,7 +2197,7 @@ var PostgreSQLMcpServerConfigStore = class {
2187
2197
  if (configCopy.headers && Object.keys(configCopy.headers).length > 0) {
2188
2198
  const encryptedHeaders = {};
2189
2199
  for (const [key, value] of Object.entries(configCopy.headers)) {
2190
- encryptedHeaders[key] = (0, import_core3.encrypt)(value);
2200
+ encryptedHeaders[key] = (0, import_core4.encrypt)(value);
2191
2201
  }
2192
2202
  configCopy.headers = encryptedHeaders;
2193
2203
  isEnvEncrypted = true;
@@ -6038,7 +6048,7 @@ var alterChannelInstallationsTable = {
6038
6048
  };
6039
6049
 
6040
6050
  // src/stores/PostgreSQLChannelInstallationStore.ts
6041
- var import_core4 = require("@axiom-lattice/core");
6051
+ var import_core5 = require("@axiom-lattice/core");
6042
6052
  var PostgreSQLChannelInstallationStore = class {
6043
6053
  constructor(options) {
6044
6054
  this.initialized = false;
@@ -6260,17 +6270,17 @@ var PostgreSQLChannelInstallationStore = class {
6260
6270
  encryptSecrets(config) {
6261
6271
  return {
6262
6272
  ...config,
6263
- ...typeof config.appSecret === "string" ? { appSecret: (0, import_core4.encrypt)(config.appSecret) } : {},
6264
- ...typeof config.verificationToken === "string" ? { verificationToken: (0, import_core4.encrypt)(config.verificationToken) } : {},
6265
- ...typeof config.encryptKey === "string" ? { encryptKey: (0, import_core4.encrypt)(config.encryptKey) } : {}
6273
+ ...typeof config.appSecret === "string" ? { appSecret: (0, import_core5.encrypt)(config.appSecret) } : {},
6274
+ ...typeof config.verificationToken === "string" ? { verificationToken: (0, import_core5.encrypt)(config.verificationToken) } : {},
6275
+ ...typeof config.encryptKey === "string" ? { encryptKey: (0, import_core5.encrypt)(config.encryptKey) } : {}
6266
6276
  };
6267
6277
  }
6268
6278
  decryptSecrets(config) {
6269
6279
  return {
6270
6280
  ...config,
6271
- ...typeof config.appSecret === "string" ? { appSecret: (0, import_core4.decrypt)(config.appSecret) } : {},
6272
- ...typeof config.verificationToken === "string" ? { verificationToken: (0, import_core4.decrypt)(config.verificationToken) } : {},
6273
- ...typeof config.encryptKey === "string" ? { encryptKey: (0, import_core4.decrypt)(config.encryptKey) } : {}
6281
+ ...typeof config.appSecret === "string" ? { appSecret: (0, import_core5.decrypt)(config.appSecret) } : {},
6282
+ ...typeof config.verificationToken === "string" ? { verificationToken: (0, import_core5.decrypt)(config.verificationToken) } : {},
6283
+ ...typeof config.encryptKey === "string" ? { encryptKey: (0, import_core5.decrypt)(config.encryptKey) } : {}
6274
6284
  };
6275
6285
  }
6276
6286
  };
@@ -6348,7 +6358,7 @@ var addApiKeyGrants = {
6348
6358
  };
6349
6359
 
6350
6360
  // src/stores/PostgreSQLA2AApiKeyStore.ts
6351
- var import_core5 = require("@axiom-lattice/core");
6361
+ var import_core6 = require("@axiom-lattice/core");
6352
6362
  var import_crypto2 = require("crypto");
6353
6363
  function generateApiKey() {
6354
6364
  return `a2a_${(0, import_crypto2.randomUUID)().replace(/-/g, "")}`;
@@ -6356,7 +6366,7 @@ function generateApiKey() {
6356
6366
  function mapRowToRecord(row) {
6357
6367
  return {
6358
6368
  id: row.id,
6359
- key: (0, import_core5.decrypt)(row.key_value),
6369
+ key: (0, import_core6.decrypt)(row.key_value),
6360
6370
  tenantId: row.tenant_id,
6361
6371
  projectId: row.project_id,
6362
6372
  assistantIds: row.assistant_ids ?? void 0,
@@ -6431,7 +6441,7 @@ var PostgreSQLA2AApiKeyStore = class {
6431
6441
  );
6432
6442
  for (const row of all.rows) {
6433
6443
  try {
6434
- if ((0, import_core5.decrypt)(row.key_value) === key) return mapRowToRecord(row);
6444
+ if ((0, import_core6.decrypt)(row.key_value) === key) return mapRowToRecord(row);
6435
6445
  } catch {
6436
6446
  continue;
6437
6447
  }
@@ -6475,7 +6485,7 @@ var PostgreSQLA2AApiKeyStore = class {
6475
6485
  `INSERT INTO lattice_a2a_api_keys (key_value, tenant_id, project_id, assistant_ids, grants, label)
6476
6486
  VALUES ($1, $2, $3, $4, $5, $6) RETURNING *`,
6477
6487
  [
6478
- (0, import_core5.encrypt)(key),
6488
+ (0, import_core6.encrypt)(key),
6479
6489
  input.tenantId,
6480
6490
  input.projectId,
6481
6491
  input.assistantIds ? JSON.stringify(input.assistantIds) : null,
@@ -6544,7 +6554,7 @@ var PostgreSQLA2AApiKeyStore = class {
6544
6554
  const key = generateApiKey();
6545
6555
  const result = await this.pool.query(
6546
6556
  `UPDATE lattice_a2a_api_keys SET key_value = $1, updated_at = NOW() WHERE id = $2 RETURNING *`,
6547
- [(0, import_core5.encrypt)(key), id]
6557
+ [(0, import_core6.encrypt)(key), id]
6548
6558
  );
6549
6559
  if (result.rows.length === 0) throw new Error(`A2A API key not found: ${id}`);
6550
6560
  const record = mapRowToRecord(result.rows[0]);
@@ -6563,7 +6573,7 @@ var PostgreSQLA2AApiKeyStore = class {
6563
6573
  const map2 = /* @__PURE__ */ new Map();
6564
6574
  for (const row of result.rows) {
6565
6575
  try {
6566
- const key = (0, import_core5.decrypt)(row.key_value);
6576
+ const key = (0, import_core6.decrypt)(row.key_value);
6567
6577
  map2.set(key, {
6568
6578
  key,
6569
6579
  tenantId: row.tenant_id,
@@ -9609,7 +9619,7 @@ var import_langgraph_checkpoint_postgres = require("@langchain/langgraph-checkpo
9609
9619
  var import_pg25 = require("pg");
9610
9620
  var import_pgvector = require("@langchain/community/vectorstores/pgvector");
9611
9621
  var import_documents = require("@langchain/core/documents");
9612
- var import_core6 = require("@axiom-lattice/core");
9622
+ var import_core7 = require("@axiom-lattice/core");
9613
9623
  function safeTableName(name) {
9614
9624
  if (!/^[a-z][a-z0-9_-]*$/.test(name)) {
9615
9625
  throw new Error(`Invalid table name: ${name}`);
@@ -9625,10 +9635,10 @@ var PGVectorStoreProvider = class {
9625
9635
  const { tableName, embeddingKey } = params;
9626
9636
  let embeddings;
9627
9637
  try {
9628
- embeddings = import_core6.embeddingsLatticeManager.getEmbeddingsClient(embeddingKey);
9638
+ embeddings = import_core7.embeddingsLatticeManager.getEmbeddingsClient(embeddingKey);
9629
9639
  } catch {
9630
9640
  try {
9631
- embeddings = import_core6.embeddingsLatticeManager.getEmbeddingsClient("default");
9641
+ embeddings = import_core7.embeddingsLatticeManager.getEmbeddingsClient("default");
9632
9642
  } catch {
9633
9643
  throw new Error(
9634
9644
  `No embedding model registered. Register one first:
@@ -9934,6 +9944,22 @@ var createConnectionConfigsTable = {
9934
9944
  await client.query("DROP TABLE IF EXISTS lattice_connection_configs");
9935
9945
  }
9936
9946
  };
9947
+ var addConnectionSecretFields = {
9948
+ version: 188,
9949
+ name: "add_connection_secret_fields",
9950
+ up: async (client) => {
9951
+ await client.query(`
9952
+ ALTER TABLE lattice_connection_configs
9953
+ ADD COLUMN IF NOT EXISTS secret_fields JSONB
9954
+ `);
9955
+ },
9956
+ down: async (client) => {
9957
+ await client.query(`
9958
+ ALTER TABLE lattice_connection_configs
9959
+ DROP COLUMN IF EXISTS secret_fields
9960
+ `);
9961
+ }
9962
+ };
9937
9963
 
9938
9964
  // src/migrations/add_share_open_grants.ts
9939
9965
  var addShareOpenGrants = {
@@ -11318,7 +11344,7 @@ var PostgreSQLUserPushSubscriptionStore = class {
11318
11344
 
11319
11345
  // src/stores/PostgreSQLModelProviderStore.ts
11320
11346
  var import_pg27 = require("pg");
11321
- var import_core7 = require("@axiom-lattice/core");
11347
+ var import_core8 = require("@axiom-lattice/core");
11322
11348
  var PostgreSQLModelProviderStore = class {
11323
11349
  constructor(options) {
11324
11350
  this.initialized = false;
@@ -11433,7 +11459,7 @@ var PostgreSQLModelProviderStore = class {
11433
11459
  await this.ensureInitialized();
11434
11460
  const now = /* @__PURE__ */ new Date();
11435
11461
  const nowString = now.toISOString();
11436
- const apiKeyEnc = data.apiKey ? (0, import_core7.encrypt)(data.apiKey) : null;
11462
+ const apiKeyEnc = data.apiKey ? (0, import_core8.encrypt)(data.apiKey) : null;
11437
11463
  const apiKeyHint = data.apiKey ? data.apiKey.slice(-4) : null;
11438
11464
  await this.pool.query(
11439
11465
  `
@@ -11509,7 +11535,7 @@ var PostgreSQLModelProviderStore = class {
11509
11535
  updateData.api_key_enc = null;
11510
11536
  updateData.api_key_hint = null;
11511
11537
  } else if (updates.apiKey) {
11512
- updateData.api_key_enc = (0, import_core7.encrypt)(updates.apiKey);
11538
+ updateData.api_key_enc = (0, import_core8.encrypt)(updates.apiKey);
11513
11539
  updateData.api_key_hint = updates.apiKey.slice(-4);
11514
11540
  }
11515
11541
  if (updates.enabled !== void 0) {
@@ -11775,7 +11801,7 @@ var PostgreSQLModelProviderStore = class {
11775
11801
  let apiKey;
11776
11802
  if (row.api_key_enc) {
11777
11803
  try {
11778
- apiKey = (0, import_core7.decrypt)(row.api_key_enc);
11804
+ apiKey = (0, import_core8.decrypt)(row.api_key_enc);
11779
11805
  } catch (error) {
11780
11806
  console.error("Failed to decrypt model provider API key:", error);
11781
11807
  throw new Error("Failed to decrypt model provider API key");
@@ -12099,6 +12125,7 @@ async function createPgStoreConfig(connectionString) {
12099
12125
  mm.register(addModelProviderModelStale);
12100
12126
  mm.register(createDistributedLeases);
12101
12127
  mm.register(createOutboxTable);
12128
+ mm.register(addConnectionSecretFields);
12102
12129
  await mm.migrate();
12103
12130
  const checkpoint = import_langgraph_checkpoint_postgres.PostgresSaver.fromConnString(connectionString);
12104
12131
  checkpoint.setup().catch((err) => {