@axiom-lattice/core 2.1.88 → 2.1.90
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 +155 -2
- package/dist/index.d.ts +155 -2
- package/dist/index.js +159 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +150 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1612,6 +1612,7 @@ __export(index_exports, {
|
|
|
1612
1612
|
TaskStatus: () => TaskStatus,
|
|
1613
1613
|
TeamAgentGraphBuilder: () => TeamAgentGraphBuilder,
|
|
1614
1614
|
ThreadStatus: () => ThreadStatus2,
|
|
1615
|
+
TokenCache: () => TokenCache,
|
|
1615
1616
|
ToolLatticeManager: () => ToolLatticeManager,
|
|
1616
1617
|
VectorStoreLatticeManager: () => VectorStoreLatticeManager,
|
|
1617
1618
|
VolumeFilesystem: () => VolumeFilesystem,
|
|
@@ -1649,8 +1650,10 @@ __export(index_exports, {
|
|
|
1649
1650
|
createQuerySqlTool: () => createQuerySqlTool,
|
|
1650
1651
|
createQueryTableDefinitionTool: () => createQueryTableDefinitionTool,
|
|
1651
1652
|
createQueryTablesListTool: () => createQueryTablesListTool,
|
|
1653
|
+
createResourceAddress: () => createResourceAddress,
|
|
1652
1654
|
createSandboxProvider: () => createSandboxProvider,
|
|
1653
1655
|
createSchedulerMiddleware: () => createSchedulerMiddleware,
|
|
1656
|
+
createSharePayload: () => createSharePayload,
|
|
1654
1657
|
createTaskMiddleware: () => createTaskMiddleware,
|
|
1655
1658
|
createTeamMiddleware: () => createTeamMiddleware,
|
|
1656
1659
|
createTeammateTools: () => createTeammateTools,
|
|
@@ -1670,6 +1673,7 @@ __export(index_exports, {
|
|
|
1670
1673
|
formatGrepMatches: () => formatGrepMatches,
|
|
1671
1674
|
formatGrepResults: () => formatGrepResults,
|
|
1672
1675
|
formatReadResponse: () => formatReadResponse,
|
|
1676
|
+
generateToken: () => generateToken,
|
|
1673
1677
|
getAgentClient: () => getAgentClient,
|
|
1674
1678
|
getAgentConfig: () => getAgentConfig,
|
|
1675
1679
|
getAllAgentConfigs: () => getAllAgentConfigs,
|
|
@@ -7482,7 +7486,8 @@ var VolumeFilesystem = class {
|
|
|
7482
7486
|
}).join("\n");
|
|
7483
7487
|
}
|
|
7484
7488
|
async readRaw(filePath) {
|
|
7485
|
-
const
|
|
7489
|
+
const buf = await this.client.readRaw(filePath);
|
|
7490
|
+
const content = buf.toString("utf-8");
|
|
7486
7491
|
const lines = content.split("\n");
|
|
7487
7492
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7488
7493
|
return {
|
|
@@ -7491,6 +7496,12 @@ var VolumeFilesystem = class {
|
|
|
7491
7496
|
modified_at: now
|
|
7492
7497
|
};
|
|
7493
7498
|
}
|
|
7499
|
+
async readBinary(filePath) {
|
|
7500
|
+
return this.client.readRaw(filePath);
|
|
7501
|
+
}
|
|
7502
|
+
async writeBinary(filePath, data) {
|
|
7503
|
+
await this.client.writeRaw(filePath, data);
|
|
7504
|
+
}
|
|
7494
7505
|
grepRaw(_pattern, _path, _glob) {
|
|
7495
7506
|
throw new Error("Not supported on volume backend");
|
|
7496
7507
|
}
|
|
@@ -7725,6 +7736,17 @@ var SandboxLatticeManager = class _SandboxLatticeManager extends BaseLatticeMana
|
|
|
7725
7736
|
}
|
|
7726
7737
|
return provider;
|
|
7727
7738
|
}
|
|
7739
|
+
/**
|
|
7740
|
+
* Returns the first registered (default) sandbox provider.
|
|
7741
|
+
*
|
|
7742
|
+
* Used by the resource sharing system for file resolution
|
|
7743
|
+
* when a specific provider key is not specified.
|
|
7744
|
+
*
|
|
7745
|
+
* @returns The default registered {@link SandboxProvider}.
|
|
7746
|
+
*/
|
|
7747
|
+
getDefaultProvider() {
|
|
7748
|
+
return this._requireProvider();
|
|
7749
|
+
}
|
|
7728
7750
|
};
|
|
7729
7751
|
var sandboxLatticeManager = SandboxLatticeManager.getInstance();
|
|
7730
7752
|
var getSandBoxManager = (key = "default") => {
|
|
@@ -24341,6 +24363,12 @@ var MicrosandboxServiceClient = class {
|
|
|
24341
24363
|
}
|
|
24342
24364
|
};
|
|
24343
24365
|
|
|
24366
|
+
// src/sandbox_lattice/resourceAddressUtils.ts
|
|
24367
|
+
function createResourceAddress(config) {
|
|
24368
|
+
const volume = buildNamedVolumeName("p", "project", config.tenantId, config.workspaceId, config.projectId);
|
|
24369
|
+
return { volume, resourcePath: config.resourcePath };
|
|
24370
|
+
}
|
|
24371
|
+
|
|
24344
24372
|
// src/sandbox_lattice/providers/MicrosandboxRemoteProvider.ts
|
|
24345
24373
|
function parseOptionalNumberEnv(name, fallback) {
|
|
24346
24374
|
const rawValue = process.env[name];
|
|
@@ -24366,6 +24394,7 @@ var MicrosandboxRemoteProvider = class {
|
|
|
24366
24394
|
constructor(config) {
|
|
24367
24395
|
this.config = config;
|
|
24368
24396
|
this.creating = /* @__PURE__ */ new Map();
|
|
24397
|
+
this.createResourceAddress = createResourceAddress;
|
|
24369
24398
|
this.client = config.client ?? new MicrosandboxServiceClient({
|
|
24370
24399
|
baseURL: config.baseURL,
|
|
24371
24400
|
apiKey: config.apiKey ?? process.env.MICROSANDBOX_API_KEY
|
|
@@ -24416,6 +24445,13 @@ var MicrosandboxRemoteProvider = class {
|
|
|
24416
24445
|
async listSandboxes() {
|
|
24417
24446
|
return [];
|
|
24418
24447
|
}
|
|
24448
|
+
getResourceResolver() {
|
|
24449
|
+
return {
|
|
24450
|
+
resolve: async (address) => {
|
|
24451
|
+
return this.client.volumeFsDownload(address.volume, `/project/${address.resourcePath}`);
|
|
24452
|
+
}
|
|
24453
|
+
};
|
|
24454
|
+
}
|
|
24419
24455
|
buildEnsureInput(config) {
|
|
24420
24456
|
const defaultMicrosandboxRemoteConfig = getDefaultMicrosandboxRemoteConfig();
|
|
24421
24457
|
const image = this.config.image ?? defaultMicrosandboxRemoteConfig.image;
|
|
@@ -24651,6 +24687,7 @@ var RemoteSandboxProvider = class {
|
|
|
24651
24687
|
this.creating = /* @__PURE__ */ new Map();
|
|
24652
24688
|
this.workspace = DEFAULT_WORKSPACE;
|
|
24653
24689
|
this.workspaceResolved = false;
|
|
24690
|
+
this.createResourceAddress = createResourceAddress;
|
|
24654
24691
|
this.client = new import_sandbox23.SandboxClient({
|
|
24655
24692
|
baseUrl: config.baseURL,
|
|
24656
24693
|
environment: ""
|
|
@@ -24712,6 +24749,14 @@ var RemoteSandboxProvider = class {
|
|
|
24712
24749
|
async listSandboxes() {
|
|
24713
24750
|
return Array.from(this.instances.values());
|
|
24714
24751
|
}
|
|
24752
|
+
getResourceResolver() {
|
|
24753
|
+
return {
|
|
24754
|
+
resolve: async (address) => {
|
|
24755
|
+
const client = this.createVolumeFsClient(address.volume, `/project`);
|
|
24756
|
+
return client.readRaw(address.resourcePath);
|
|
24757
|
+
}
|
|
24758
|
+
};
|
|
24759
|
+
}
|
|
24715
24760
|
createVolumeFsClient(_volumeName, pathPrefix) {
|
|
24716
24761
|
const workspace = this.workspace;
|
|
24717
24762
|
const resolve4 = (p) => {
|
|
@@ -24903,6 +24948,7 @@ var E2BProvider = class {
|
|
|
24903
24948
|
this.config = config;
|
|
24904
24949
|
this.instances = /* @__PURE__ */ new Map();
|
|
24905
24950
|
this.creating = /* @__PURE__ */ new Map();
|
|
24951
|
+
this.createResourceAddress = createResourceAddress;
|
|
24906
24952
|
}
|
|
24907
24953
|
async createSandbox(name, _config) {
|
|
24908
24954
|
const existing = this.instances.get(name);
|
|
@@ -24960,6 +25006,16 @@ var E2BProvider = class {
|
|
|
24960
25006
|
async listSandboxes() {
|
|
24961
25007
|
return Array.from(this.instances.values());
|
|
24962
25008
|
}
|
|
25009
|
+
getResourceResolver() {
|
|
25010
|
+
const instances = this.instances;
|
|
25011
|
+
return {
|
|
25012
|
+
resolve: async (address) => {
|
|
25013
|
+
const entry = Array.from(instances.values())[0];
|
|
25014
|
+
if (!entry) throw new Error("No sandbox instance available to resolve resource");
|
|
25015
|
+
return entry.file.downloadFile({ file: `/project/${address.resourcePath}` });
|
|
25016
|
+
}
|
|
25017
|
+
};
|
|
25018
|
+
}
|
|
24963
25019
|
};
|
|
24964
25020
|
|
|
24965
25021
|
// src/sandbox_lattice/providers/DaytonaProvider.ts
|
|
@@ -25087,6 +25143,7 @@ var DaytonaProvider = class {
|
|
|
25087
25143
|
this.instances = /* @__PURE__ */ new Map();
|
|
25088
25144
|
this.creating = /* @__PURE__ */ new Map();
|
|
25089
25145
|
this.volumeId = null;
|
|
25146
|
+
this.createResourceAddress = createResourceAddress;
|
|
25090
25147
|
this.daytona = new import_sdk.Daytona({
|
|
25091
25148
|
apiKey: config.apiKey,
|
|
25092
25149
|
apiUrl: config.apiUrl,
|
|
@@ -25271,11 +25328,22 @@ var DaytonaProvider = class {
|
|
|
25271
25328
|
async listSandboxes() {
|
|
25272
25329
|
return Array.from(this.instances.values());
|
|
25273
25330
|
}
|
|
25331
|
+
getResourceResolver() {
|
|
25332
|
+
const instances = this.instances;
|
|
25333
|
+
return {
|
|
25334
|
+
resolve: async (address) => {
|
|
25335
|
+
const entry = Array.from(instances.values())[0];
|
|
25336
|
+
if (!entry) throw new Error("No sandbox instance available to resolve resource");
|
|
25337
|
+
return entry.file.downloadFile({ file: `/project/${address.resourcePath}` });
|
|
25338
|
+
}
|
|
25339
|
+
};
|
|
25340
|
+
}
|
|
25274
25341
|
};
|
|
25275
25342
|
|
|
25276
25343
|
// src/sandbox_lattice/providers/LocalSandboxProvider.ts
|
|
25277
25344
|
var path4 = __toESM(require("path"));
|
|
25278
25345
|
var os = __toESM(require("os"));
|
|
25346
|
+
var fs4 = __toESM(require("fs/promises"));
|
|
25279
25347
|
|
|
25280
25348
|
// src/sandbox_lattice/LocalSandboxInstance.ts
|
|
25281
25349
|
var import_node_child_process = require("child_process");
|
|
@@ -25490,6 +25558,7 @@ var LocalSandboxProvider = class {
|
|
|
25490
25558
|
constructor(config = {}) {
|
|
25491
25559
|
this.instances = /* @__PURE__ */ new Map();
|
|
25492
25560
|
this.creating = /* @__PURE__ */ new Map();
|
|
25561
|
+
this.createResourceAddress = createResourceAddress;
|
|
25493
25562
|
this.basePath = config.basePath ?? path4.join(os.homedir(), ".axiom-local-sandbox");
|
|
25494
25563
|
}
|
|
25495
25564
|
async createSandbox(name, _config) {
|
|
@@ -25542,6 +25611,14 @@ var LocalSandboxProvider = class {
|
|
|
25542
25611
|
async listSandboxes() {
|
|
25543
25612
|
return Array.from(this.instances.values());
|
|
25544
25613
|
}
|
|
25614
|
+
getResourceResolver() {
|
|
25615
|
+
return {
|
|
25616
|
+
resolve: async (address) => {
|
|
25617
|
+
const hostPath = path4.join(this.basePath, "project", address.resourcePath);
|
|
25618
|
+
return fs4.readFile(hostPath);
|
|
25619
|
+
}
|
|
25620
|
+
};
|
|
25621
|
+
}
|
|
25545
25622
|
};
|
|
25546
25623
|
|
|
25547
25624
|
// src/sandbox_lattice/SandboxProviderFactory.ts
|
|
@@ -25598,6 +25675,75 @@ function createSandboxProvider(config) {
|
|
|
25598
25675
|
}
|
|
25599
25676
|
}
|
|
25600
25677
|
|
|
25678
|
+
// src/sandbox_lattice/TokenCache.ts
|
|
25679
|
+
var TokenCache = class {
|
|
25680
|
+
constructor() {
|
|
25681
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
25682
|
+
this.ttlMs = 6e4;
|
|
25683
|
+
}
|
|
25684
|
+
/**
|
|
25685
|
+
* Look up a token in the cache.
|
|
25686
|
+
*
|
|
25687
|
+
* @param token - The share token.
|
|
25688
|
+
* @returns The cached entry, or `null` if the token is absent or expired.
|
|
25689
|
+
*/
|
|
25690
|
+
get(token) {
|
|
25691
|
+
const item = this.cache.get(token);
|
|
25692
|
+
if (!item) return null;
|
|
25693
|
+
if (Date.now() > item.expires) {
|
|
25694
|
+
this.cache.delete(token);
|
|
25695
|
+
return null;
|
|
25696
|
+
}
|
|
25697
|
+
return item.entry;
|
|
25698
|
+
}
|
|
25699
|
+
/**
|
|
25700
|
+
* Store a token → address mapping.
|
|
25701
|
+
*
|
|
25702
|
+
* @param token - The share token.
|
|
25703
|
+
* @param entry - The cache entry to associate with the token.
|
|
25704
|
+
*/
|
|
25705
|
+
set(token, entry) {
|
|
25706
|
+
this.cache.set(token, { entry, expires: Date.now() + this.ttlMs });
|
|
25707
|
+
}
|
|
25708
|
+
/**
|
|
25709
|
+
* Remove a cached entry (e.g. on revocation).
|
|
25710
|
+
*
|
|
25711
|
+
* @param token - The share token to invalidate.
|
|
25712
|
+
*/
|
|
25713
|
+
invalidate(token) {
|
|
25714
|
+
this.cache.delete(token);
|
|
25715
|
+
}
|
|
25716
|
+
};
|
|
25717
|
+
|
|
25718
|
+
// src/sandbox_lattice/ShareService.ts
|
|
25719
|
+
var import_crypto4 = require("crypto");
|
|
25720
|
+
var TOKEN_BYTES = 24;
|
|
25721
|
+
function generateToken() {
|
|
25722
|
+
return (0, import_crypto4.randomBytes)(TOKEN_BYTES).toString("base64url");
|
|
25723
|
+
}
|
|
25724
|
+
function createSharePayload(tenantId, workspaceId, projectId, userId, request) {
|
|
25725
|
+
return {
|
|
25726
|
+
address: createResourceAddress({
|
|
25727
|
+
tenantId,
|
|
25728
|
+
workspaceId,
|
|
25729
|
+
projectId,
|
|
25730
|
+
resourcePath: request.resourcePath
|
|
25731
|
+
}),
|
|
25732
|
+
tenantId,
|
|
25733
|
+
workspaceId,
|
|
25734
|
+
projectId,
|
|
25735
|
+
assistantId: request.assistantId ?? null,
|
|
25736
|
+
vmIsolation: "project",
|
|
25737
|
+
visibility: request.visibility ?? "public",
|
|
25738
|
+
passwordHash: request.visibility === "password" && request.password ? request.password : null,
|
|
25739
|
+
title: request.title ?? null,
|
|
25740
|
+
createdBy: userId,
|
|
25741
|
+
expiresAt: request.expiresAt ? new Date(request.expiresAt) : null,
|
|
25742
|
+
maxAccess: request.maxAccess ?? null,
|
|
25743
|
+
revoked: false
|
|
25744
|
+
};
|
|
25745
|
+
}
|
|
25746
|
+
|
|
25601
25747
|
// src/channel/connectAllChannels.ts
|
|
25602
25748
|
async function connectAllChannels(getAdapter, options = {}) {
|
|
25603
25749
|
const store = getStoreLattice("default", "channelInstallation").store;
|
|
@@ -25638,7 +25784,7 @@ function getMenuRegistry() {
|
|
|
25638
25784
|
var Protocols = __toESM(require("@axiom-lattice/protocols"));
|
|
25639
25785
|
|
|
25640
25786
|
// src/util/encryption.ts
|
|
25641
|
-
var
|
|
25787
|
+
var import_crypto5 = require("crypto");
|
|
25642
25788
|
var ALGORITHM = "aes-256-gcm";
|
|
25643
25789
|
var IV_LENGTH = 16;
|
|
25644
25790
|
var SALT_LENGTH = 32;
|
|
@@ -25651,7 +25797,7 @@ function getEncryptionKey() {
|
|
|
25651
25797
|
return cachedKey;
|
|
25652
25798
|
}
|
|
25653
25799
|
const key = process.env.LATTICE_ENCRYPTION_KEY || DEFAULT_ENCRYPTION_KEY;
|
|
25654
|
-
cachedKey = (0,
|
|
25800
|
+
cachedKey = (0, import_crypto5.pbkdf2Sync)(key, "lattice-encryption-salt", ITERATIONS, 32, "sha256");
|
|
25655
25801
|
if (!keyValidated) {
|
|
25656
25802
|
keyValidated = true;
|
|
25657
25803
|
validateEncryptionKey();
|
|
@@ -25660,10 +25806,10 @@ function getEncryptionKey() {
|
|
|
25660
25806
|
}
|
|
25661
25807
|
function encrypt(plaintext, key) {
|
|
25662
25808
|
const actualKey = key || getEncryptionKey();
|
|
25663
|
-
const salt = (0,
|
|
25664
|
-
const iv = (0,
|
|
25665
|
-
const derivedKey = (0,
|
|
25666
|
-
const cipher = (0,
|
|
25809
|
+
const salt = (0, import_crypto5.randomBytes)(SALT_LENGTH);
|
|
25810
|
+
const iv = (0, import_crypto5.randomBytes)(IV_LENGTH);
|
|
25811
|
+
const derivedKey = (0, import_crypto5.pbkdf2Sync)(actualKey, salt, ITERATIONS, 32, "sha256");
|
|
25812
|
+
const cipher = (0, import_crypto5.createCipheriv)(ALGORITHM, derivedKey, iv);
|
|
25667
25813
|
const encrypted = Buffer.concat([cipher.update(plaintext, "utf8"), cipher.final()]);
|
|
25668
25814
|
const authTag = cipher.getAuthTag();
|
|
25669
25815
|
return Buffer.concat([salt, iv, encrypted, authTag]).toString("base64");
|
|
@@ -25675,8 +25821,8 @@ function decrypt(encrypted, key) {
|
|
|
25675
25821
|
const iv = data.subarray(SALT_LENGTH, SALT_LENGTH + IV_LENGTH);
|
|
25676
25822
|
const authTag = data.subarray(-16);
|
|
25677
25823
|
const ciphertext = data.subarray(SALT_LENGTH + IV_LENGTH, -16);
|
|
25678
|
-
const derivedKey = (0,
|
|
25679
|
-
const decipher = (0,
|
|
25824
|
+
const derivedKey = (0, import_crypto5.pbkdf2Sync)(actualKey, salt, ITERATIONS, 32, "sha256");
|
|
25825
|
+
const decipher = (0, import_crypto5.createDecipheriv)(ALGORITHM, derivedKey, iv);
|
|
25680
25826
|
decipher.setAuthTag(authTag);
|
|
25681
25827
|
return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString("utf8");
|
|
25682
25828
|
}
|
|
@@ -25929,6 +26075,7 @@ PersonalAssistantConfig._config = deepClone(DEFAULT_CONFIG);
|
|
|
25929
26075
|
TaskStatus,
|
|
25930
26076
|
TeamAgentGraphBuilder,
|
|
25931
26077
|
ThreadStatus,
|
|
26078
|
+
TokenCache,
|
|
25932
26079
|
ToolLatticeManager,
|
|
25933
26080
|
VectorStoreLatticeManager,
|
|
25934
26081
|
VolumeFilesystem,
|
|
@@ -25966,8 +26113,10 @@ PersonalAssistantConfig._config = deepClone(DEFAULT_CONFIG);
|
|
|
25966
26113
|
createQuerySqlTool,
|
|
25967
26114
|
createQueryTableDefinitionTool,
|
|
25968
26115
|
createQueryTablesListTool,
|
|
26116
|
+
createResourceAddress,
|
|
25969
26117
|
createSandboxProvider,
|
|
25970
26118
|
createSchedulerMiddleware,
|
|
26119
|
+
createSharePayload,
|
|
25971
26120
|
createTaskMiddleware,
|
|
25972
26121
|
createTeamMiddleware,
|
|
25973
26122
|
createTeammateTools,
|
|
@@ -25987,6 +26136,7 @@ PersonalAssistantConfig._config = deepClone(DEFAULT_CONFIG);
|
|
|
25987
26136
|
formatGrepMatches,
|
|
25988
26137
|
formatGrepResults,
|
|
25989
26138
|
formatReadResponse,
|
|
26139
|
+
generateToken,
|
|
25990
26140
|
getAgentClient,
|
|
25991
26141
|
getAgentConfig,
|
|
25992
26142
|
getAllAgentConfigs,
|