@axiom-lattice/core 13.2.0 → 13.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.
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +62 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -59
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3534,6 +3534,7 @@ import { createCipheriv, createDecipheriv, randomBytes, pbkdf2Sync } from "crypt
|
|
|
3534
3534
|
var ALGORITHM = "aes-256-gcm";
|
|
3535
3535
|
var IV_LENGTH = 16;
|
|
3536
3536
|
var SALT_LENGTH = 32;
|
|
3537
|
+
var AUTH_TAG_LENGTH = 16;
|
|
3537
3538
|
var ITERATIONS = 1e5;
|
|
3538
3539
|
var DEFAULT_ENCRYPTION_KEY = "lattice-default-encryption-key-dev-only-32b!";
|
|
3539
3540
|
var cachedKey = null;
|
|
@@ -3555,7 +3556,7 @@ function encrypt(plaintext, key6) {
|
|
|
3555
3556
|
const salt = randomBytes(SALT_LENGTH);
|
|
3556
3557
|
const iv = randomBytes(IV_LENGTH);
|
|
3557
3558
|
const derivedKey = pbkdf2Sync(actualKey, salt, ITERATIONS, 32, "sha256");
|
|
3558
|
-
const cipher = createCipheriv(ALGORITHM, derivedKey, iv);
|
|
3559
|
+
const cipher = createCipheriv(ALGORITHM, derivedKey, iv, { authTagLength: AUTH_TAG_LENGTH });
|
|
3559
3560
|
const encrypted = Buffer.concat([cipher.update(plaintext, "utf8"), cipher.final()]);
|
|
3560
3561
|
const authTag = cipher.getAuthTag();
|
|
3561
3562
|
return Buffer.concat([salt, iv, encrypted, authTag]).toString("base64");
|
|
@@ -3565,10 +3566,10 @@ function decrypt(encrypted, key6) {
|
|
|
3565
3566
|
const data = Buffer.from(encrypted, "base64");
|
|
3566
3567
|
const salt = data.subarray(0, SALT_LENGTH);
|
|
3567
3568
|
const iv = data.subarray(SALT_LENGTH, SALT_LENGTH + IV_LENGTH);
|
|
3568
|
-
const authTag = data.subarray(-
|
|
3569
|
-
const ciphertext = data.subarray(SALT_LENGTH + IV_LENGTH, -
|
|
3569
|
+
const authTag = data.subarray(-AUTH_TAG_LENGTH);
|
|
3570
|
+
const ciphertext = data.subarray(SALT_LENGTH + IV_LENGTH, -AUTH_TAG_LENGTH);
|
|
3570
3571
|
const derivedKey = pbkdf2Sync(actualKey, salt, ITERATIONS, 32, "sha256");
|
|
3571
|
-
const decipher = createDecipheriv(ALGORITHM, derivedKey, iv);
|
|
3572
|
+
const decipher = createDecipheriv(ALGORITHM, derivedKey, iv, { authTagLength: AUTH_TAG_LENGTH });
|
|
3572
3573
|
decipher.setAuthTag(authTag);
|
|
3573
3574
|
return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString("utf8");
|
|
3574
3575
|
}
|
|
@@ -7687,7 +7688,7 @@ function serializePluginMeta(plugin) {
|
|
|
7687
7688
|
}
|
|
7688
7689
|
|
|
7689
7690
|
// src/sandbox_lattice/sandboxPaths.ts
|
|
7690
|
-
var NONROOT_SANDBOX_IMAGE = "kioko12520/sandbox:0.2.
|
|
7691
|
+
var NONROOT_SANDBOX_IMAGE = "kioko12520/sandbox:0.2.1";
|
|
7691
7692
|
var LEGACY_ROOT_SANDBOX_IMAGE = "kioko12520/sandbox:0.1.0";
|
|
7692
7693
|
function normalizeSandboxHome(value) {
|
|
7693
7694
|
const trimmed = value.trim();
|
|
@@ -14992,6 +14993,60 @@ function failure(error) {
|
|
|
14992
14993
|
return JSON.stringify({ success: false, error });
|
|
14993
14994
|
}
|
|
14994
14995
|
|
|
14996
|
+
// src/capability/CapabilityRuntimeAccessor.ts
|
|
14997
|
+
function getRuntimeCapabilityConfig(executionConfig, capabilityType) {
|
|
14998
|
+
return readRecordProperty(getRuntimeCapabilityPolicy(executionConfig, capabilityType), "config");
|
|
14999
|
+
}
|
|
15000
|
+
function hasRuntimeCapabilityPolicy(executionConfig, capabilityType) {
|
|
15001
|
+
return getRuntimeCapabilityPolicy(executionConfig, capabilityType) !== void 0;
|
|
15002
|
+
}
|
|
15003
|
+
function getRuntimeCapabilityPolicy(executionConfig, capabilityType) {
|
|
15004
|
+
const configurable = readRecordProperty(executionConfig, "configurable");
|
|
15005
|
+
const context = readRecordProperty(executionConfig, "context");
|
|
15006
|
+
const runConfig = readRecordProperty(configurable, "runConfig") ?? readRecordProperty(context, "runConfig");
|
|
15007
|
+
const runtime = readRecordProperty(runConfig, "capabilityRuntime");
|
|
15008
|
+
const middleware = readRecordProperty(runtime, "middleware");
|
|
15009
|
+
return readRecordProperty(middleware, capabilityType);
|
|
15010
|
+
}
|
|
15011
|
+
function getRuntimeSkillSelection(executionConfig) {
|
|
15012
|
+
const policy = getRuntimeCapabilityPolicy(executionConfig, "skill");
|
|
15013
|
+
if (!policy) return { hasPolicy: false, enabled: true, readAll: false };
|
|
15014
|
+
const config = readRecordProperty(policy, "config") ?? {};
|
|
15015
|
+
const skills = config.skills;
|
|
15016
|
+
return {
|
|
15017
|
+
hasPolicy: true,
|
|
15018
|
+
enabled: policy.enabled !== false,
|
|
15019
|
+
...Array.isArray(skills) && skills.every((skill) => typeof skill === "string") ? { skills: [...skills] } : {},
|
|
15020
|
+
readAll: config.readAll === true
|
|
15021
|
+
};
|
|
15022
|
+
}
|
|
15023
|
+
function readRecordProperty(value, property) {
|
|
15024
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
15025
|
+
const propertyValue = value[property];
|
|
15026
|
+
return typeof propertyValue === "object" && propertyValue !== null && !Array.isArray(propertyValue) ? propertyValue : void 0;
|
|
15027
|
+
}
|
|
15028
|
+
|
|
15029
|
+
// src/tool_lattice/sql/utils.ts
|
|
15030
|
+
function getEffectiveDatabaseKeys(exeConfig, staticDatabaseKeys) {
|
|
15031
|
+
const runtimeConfig = getRuntimeCapabilityConfig(exeConfig, "sql");
|
|
15032
|
+
if (runtimeConfig && Object.prototype.hasOwnProperty.call(runtimeConfig, "databaseKeys")) {
|
|
15033
|
+
const databaseKeys = runtimeConfig.databaseKeys;
|
|
15034
|
+
if (Array.isArray(databaseKeys) && databaseKeys.every((key6) => typeof key6 === "string")) {
|
|
15035
|
+
return databaseKeys;
|
|
15036
|
+
}
|
|
15037
|
+
return [];
|
|
15038
|
+
}
|
|
15039
|
+
return staticDatabaseKeys;
|
|
15040
|
+
}
|
|
15041
|
+
function getTenantIdFromConfig(exeConfig, getTenantId3) {
|
|
15042
|
+
const runConfig = exeConfig?.configurable?.runConfig || {};
|
|
15043
|
+
return runConfig.tenantId || (getTenantId3 ? getTenantId3() : "default");
|
|
15044
|
+
}
|
|
15045
|
+
function buildSslConfig(ssl, rejectUnauthorized) {
|
|
15046
|
+
if (!ssl) return void 0;
|
|
15047
|
+
return { rejectUnauthorized: rejectUnauthorized !== false };
|
|
15048
|
+
}
|
|
15049
|
+
|
|
14995
15050
|
// src/tool_lattice/sql/SqlDatabaseManager.ts
|
|
14996
15051
|
function splitQualifiedTableName(qualifiedName) {
|
|
14997
15052
|
const parts = [];
|
|
@@ -15045,7 +15100,7 @@ var PostgresDatabase = class {
|
|
|
15045
15100
|
database: this.config.database,
|
|
15046
15101
|
user: this.config.user,
|
|
15047
15102
|
password: this.config.password,
|
|
15048
|
-
ssl: this.config.ssl
|
|
15103
|
+
ssl: buildSslConfig(this.config.ssl, this.config.sslRejectUnauthorized)
|
|
15049
15104
|
};
|
|
15050
15105
|
this.pool = new Pool(poolConfig);
|
|
15051
15106
|
const client = await this.pool.connect();
|
|
@@ -15205,7 +15260,7 @@ var MysqlDatabase = class {
|
|
|
15205
15260
|
database: this.config.database,
|
|
15206
15261
|
user: this.config.user,
|
|
15207
15262
|
password: this.config.password,
|
|
15208
|
-
ssl: this.config.ssl
|
|
15263
|
+
ssl: buildSslConfig(this.config.ssl, this.config.sslRejectUnauthorized)
|
|
15209
15264
|
};
|
|
15210
15265
|
this.pool = mysql.createPool({
|
|
15211
15266
|
...poolConfig,
|
|
@@ -15569,58 +15624,6 @@ var sqlDatabaseManager = SqlDatabaseManager.getInstance();
|
|
|
15569
15624
|
// src/tool_lattice/sql/list_tables_sql.ts
|
|
15570
15625
|
import z4 from "zod";
|
|
15571
15626
|
import { tool as tool2 } from "langchain";
|
|
15572
|
-
|
|
15573
|
-
// src/capability/CapabilityRuntimeAccessor.ts
|
|
15574
|
-
function getRuntimeCapabilityConfig(executionConfig, capabilityType) {
|
|
15575
|
-
return readRecordProperty(getRuntimeCapabilityPolicy(executionConfig, capabilityType), "config");
|
|
15576
|
-
}
|
|
15577
|
-
function hasRuntimeCapabilityPolicy(executionConfig, capabilityType) {
|
|
15578
|
-
return getRuntimeCapabilityPolicy(executionConfig, capabilityType) !== void 0;
|
|
15579
|
-
}
|
|
15580
|
-
function getRuntimeCapabilityPolicy(executionConfig, capabilityType) {
|
|
15581
|
-
const configurable = readRecordProperty(executionConfig, "configurable");
|
|
15582
|
-
const context = readRecordProperty(executionConfig, "context");
|
|
15583
|
-
const runConfig = readRecordProperty(configurable, "runConfig") ?? readRecordProperty(context, "runConfig");
|
|
15584
|
-
const runtime = readRecordProperty(runConfig, "capabilityRuntime");
|
|
15585
|
-
const middleware = readRecordProperty(runtime, "middleware");
|
|
15586
|
-
return readRecordProperty(middleware, capabilityType);
|
|
15587
|
-
}
|
|
15588
|
-
function getRuntimeSkillSelection(executionConfig) {
|
|
15589
|
-
const policy = getRuntimeCapabilityPolicy(executionConfig, "skill");
|
|
15590
|
-
if (!policy) return { hasPolicy: false, enabled: true, readAll: false };
|
|
15591
|
-
const config = readRecordProperty(policy, "config") ?? {};
|
|
15592
|
-
const skills = config.skills;
|
|
15593
|
-
return {
|
|
15594
|
-
hasPolicy: true,
|
|
15595
|
-
enabled: policy.enabled !== false,
|
|
15596
|
-
...Array.isArray(skills) && skills.every((skill) => typeof skill === "string") ? { skills: [...skills] } : {},
|
|
15597
|
-
readAll: config.readAll === true
|
|
15598
|
-
};
|
|
15599
|
-
}
|
|
15600
|
-
function readRecordProperty(value, property) {
|
|
15601
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
15602
|
-
const propertyValue = value[property];
|
|
15603
|
-
return typeof propertyValue === "object" && propertyValue !== null && !Array.isArray(propertyValue) ? propertyValue : void 0;
|
|
15604
|
-
}
|
|
15605
|
-
|
|
15606
|
-
// src/tool_lattice/sql/utils.ts
|
|
15607
|
-
function getEffectiveDatabaseKeys(exeConfig, staticDatabaseKeys) {
|
|
15608
|
-
const runtimeConfig = getRuntimeCapabilityConfig(exeConfig, "sql");
|
|
15609
|
-
if (runtimeConfig && Object.prototype.hasOwnProperty.call(runtimeConfig, "databaseKeys")) {
|
|
15610
|
-
const databaseKeys = runtimeConfig.databaseKeys;
|
|
15611
|
-
if (Array.isArray(databaseKeys) && databaseKeys.every((key6) => typeof key6 === "string")) {
|
|
15612
|
-
return databaseKeys;
|
|
15613
|
-
}
|
|
15614
|
-
return [];
|
|
15615
|
-
}
|
|
15616
|
-
return staticDatabaseKeys;
|
|
15617
|
-
}
|
|
15618
|
-
function getTenantIdFromConfig(exeConfig, getTenantId3) {
|
|
15619
|
-
const runConfig = exeConfig?.configurable?.runConfig || {};
|
|
15620
|
-
return runConfig.tenantId || (getTenantId3 ? getTenantId3() : "default");
|
|
15621
|
-
}
|
|
15622
|
-
|
|
15623
|
-
// src/tool_lattice/sql/list_tables_sql.ts
|
|
15624
15627
|
var LIST_TABLES_SQL_DESCRIPTION = `List all tables in the connected SQL database. Returns a comma-separated list of table names. Use this tool first to understand what tables are available before querying the database.`;
|
|
15625
15628
|
var SIMPLE_IDENTIFIER = /^[a-z_][a-z0-9_]*$/;
|
|
15626
15629
|
function formatIdentifier(identifier) {
|