@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.mjs
CHANGED
|
@@ -5741,7 +5741,8 @@ var VolumeFilesystem = class {
|
|
|
5741
5741
|
}).join("\n");
|
|
5742
5742
|
}
|
|
5743
5743
|
async readRaw(filePath) {
|
|
5744
|
-
const
|
|
5744
|
+
const buf = await this.client.readRaw(filePath);
|
|
5745
|
+
const content = buf.toString("utf-8");
|
|
5745
5746
|
const lines = content.split("\n");
|
|
5746
5747
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5747
5748
|
return {
|
|
@@ -5750,6 +5751,12 @@ var VolumeFilesystem = class {
|
|
|
5750
5751
|
modified_at: now
|
|
5751
5752
|
};
|
|
5752
5753
|
}
|
|
5754
|
+
async readBinary(filePath) {
|
|
5755
|
+
return this.client.readRaw(filePath);
|
|
5756
|
+
}
|
|
5757
|
+
async writeBinary(filePath, data) {
|
|
5758
|
+
await this.client.writeRaw(filePath, data);
|
|
5759
|
+
}
|
|
5753
5760
|
grepRaw(_pattern, _path, _glob) {
|
|
5754
5761
|
throw new Error("Not supported on volume backend");
|
|
5755
5762
|
}
|
|
@@ -5984,6 +5991,17 @@ var SandboxLatticeManager = class _SandboxLatticeManager extends BaseLatticeMana
|
|
|
5984
5991
|
}
|
|
5985
5992
|
return provider;
|
|
5986
5993
|
}
|
|
5994
|
+
/**
|
|
5995
|
+
* Returns the first registered (default) sandbox provider.
|
|
5996
|
+
*
|
|
5997
|
+
* Used by the resource sharing system for file resolution
|
|
5998
|
+
* when a specific provider key is not specified.
|
|
5999
|
+
*
|
|
6000
|
+
* @returns The default registered {@link SandboxProvider}.
|
|
6001
|
+
*/
|
|
6002
|
+
getDefaultProvider() {
|
|
6003
|
+
return this._requireProvider();
|
|
6004
|
+
}
|
|
5987
6005
|
};
|
|
5988
6006
|
var sandboxLatticeManager = SandboxLatticeManager.getInstance();
|
|
5989
6007
|
var getSandBoxManager = (key = "default") => {
|
|
@@ -22627,6 +22645,12 @@ var MicrosandboxServiceClient = class {
|
|
|
22627
22645
|
}
|
|
22628
22646
|
};
|
|
22629
22647
|
|
|
22648
|
+
// src/sandbox_lattice/resourceAddressUtils.ts
|
|
22649
|
+
function createResourceAddress(config) {
|
|
22650
|
+
const volume = buildNamedVolumeName("p", "project", config.tenantId, config.workspaceId, config.projectId);
|
|
22651
|
+
return { volume, resourcePath: config.resourcePath };
|
|
22652
|
+
}
|
|
22653
|
+
|
|
22630
22654
|
// src/sandbox_lattice/providers/MicrosandboxRemoteProvider.ts
|
|
22631
22655
|
function parseOptionalNumberEnv(name, fallback) {
|
|
22632
22656
|
const rawValue = process.env[name];
|
|
@@ -22652,6 +22676,7 @@ var MicrosandboxRemoteProvider = class {
|
|
|
22652
22676
|
constructor(config) {
|
|
22653
22677
|
this.config = config;
|
|
22654
22678
|
this.creating = /* @__PURE__ */ new Map();
|
|
22679
|
+
this.createResourceAddress = createResourceAddress;
|
|
22655
22680
|
this.client = config.client ?? new MicrosandboxServiceClient({
|
|
22656
22681
|
baseURL: config.baseURL,
|
|
22657
22682
|
apiKey: config.apiKey ?? process.env.MICROSANDBOX_API_KEY
|
|
@@ -22702,6 +22727,13 @@ var MicrosandboxRemoteProvider = class {
|
|
|
22702
22727
|
async listSandboxes() {
|
|
22703
22728
|
return [];
|
|
22704
22729
|
}
|
|
22730
|
+
getResourceResolver() {
|
|
22731
|
+
return {
|
|
22732
|
+
resolve: async (address) => {
|
|
22733
|
+
return this.client.volumeFsDownload(address.volume, `/project/${address.resourcePath}`);
|
|
22734
|
+
}
|
|
22735
|
+
};
|
|
22736
|
+
}
|
|
22705
22737
|
buildEnsureInput(config) {
|
|
22706
22738
|
const defaultMicrosandboxRemoteConfig = getDefaultMicrosandboxRemoteConfig();
|
|
22707
22739
|
const image = this.config.image ?? defaultMicrosandboxRemoteConfig.image;
|
|
@@ -22937,6 +22969,7 @@ var RemoteSandboxProvider = class {
|
|
|
22937
22969
|
this.creating = /* @__PURE__ */ new Map();
|
|
22938
22970
|
this.workspace = DEFAULT_WORKSPACE;
|
|
22939
22971
|
this.workspaceResolved = false;
|
|
22972
|
+
this.createResourceAddress = createResourceAddress;
|
|
22940
22973
|
this.client = new SandboxClient23({
|
|
22941
22974
|
baseUrl: config.baseURL,
|
|
22942
22975
|
environment: ""
|
|
@@ -22998,6 +23031,14 @@ var RemoteSandboxProvider = class {
|
|
|
22998
23031
|
async listSandboxes() {
|
|
22999
23032
|
return Array.from(this.instances.values());
|
|
23000
23033
|
}
|
|
23034
|
+
getResourceResolver() {
|
|
23035
|
+
return {
|
|
23036
|
+
resolve: async (address) => {
|
|
23037
|
+
const client = this.createVolumeFsClient(address.volume, `/project`);
|
|
23038
|
+
return client.readRaw(address.resourcePath);
|
|
23039
|
+
}
|
|
23040
|
+
};
|
|
23041
|
+
}
|
|
23001
23042
|
createVolumeFsClient(_volumeName, pathPrefix) {
|
|
23002
23043
|
const workspace = this.workspace;
|
|
23003
23044
|
const resolve4 = (p) => {
|
|
@@ -23189,6 +23230,7 @@ var E2BProvider = class {
|
|
|
23189
23230
|
this.config = config;
|
|
23190
23231
|
this.instances = /* @__PURE__ */ new Map();
|
|
23191
23232
|
this.creating = /* @__PURE__ */ new Map();
|
|
23233
|
+
this.createResourceAddress = createResourceAddress;
|
|
23192
23234
|
}
|
|
23193
23235
|
async createSandbox(name, _config) {
|
|
23194
23236
|
const existing = this.instances.get(name);
|
|
@@ -23246,6 +23288,16 @@ var E2BProvider = class {
|
|
|
23246
23288
|
async listSandboxes() {
|
|
23247
23289
|
return Array.from(this.instances.values());
|
|
23248
23290
|
}
|
|
23291
|
+
getResourceResolver() {
|
|
23292
|
+
const instances = this.instances;
|
|
23293
|
+
return {
|
|
23294
|
+
resolve: async (address) => {
|
|
23295
|
+
const entry = Array.from(instances.values())[0];
|
|
23296
|
+
if (!entry) throw new Error("No sandbox instance available to resolve resource");
|
|
23297
|
+
return entry.file.downloadFile({ file: `/project/${address.resourcePath}` });
|
|
23298
|
+
}
|
|
23299
|
+
};
|
|
23300
|
+
}
|
|
23249
23301
|
};
|
|
23250
23302
|
|
|
23251
23303
|
// src/sandbox_lattice/providers/DaytonaProvider.ts
|
|
@@ -23373,6 +23425,7 @@ var DaytonaProvider = class {
|
|
|
23373
23425
|
this.instances = /* @__PURE__ */ new Map();
|
|
23374
23426
|
this.creating = /* @__PURE__ */ new Map();
|
|
23375
23427
|
this.volumeId = null;
|
|
23428
|
+
this.createResourceAddress = createResourceAddress;
|
|
23376
23429
|
this.daytona = new Daytona({
|
|
23377
23430
|
apiKey: config.apiKey,
|
|
23378
23431
|
apiUrl: config.apiUrl,
|
|
@@ -23557,11 +23610,22 @@ var DaytonaProvider = class {
|
|
|
23557
23610
|
async listSandboxes() {
|
|
23558
23611
|
return Array.from(this.instances.values());
|
|
23559
23612
|
}
|
|
23613
|
+
getResourceResolver() {
|
|
23614
|
+
const instances = this.instances;
|
|
23615
|
+
return {
|
|
23616
|
+
resolve: async (address) => {
|
|
23617
|
+
const entry = Array.from(instances.values())[0];
|
|
23618
|
+
if (!entry) throw new Error("No sandbox instance available to resolve resource");
|
|
23619
|
+
return entry.file.downloadFile({ file: `/project/${address.resourcePath}` });
|
|
23620
|
+
}
|
|
23621
|
+
};
|
|
23622
|
+
}
|
|
23560
23623
|
};
|
|
23561
23624
|
|
|
23562
23625
|
// src/sandbox_lattice/providers/LocalSandboxProvider.ts
|
|
23563
23626
|
import * as path4 from "path";
|
|
23564
23627
|
import * as os from "os";
|
|
23628
|
+
import * as fs4 from "fs/promises";
|
|
23565
23629
|
|
|
23566
23630
|
// src/sandbox_lattice/LocalSandboxInstance.ts
|
|
23567
23631
|
import { execFile } from "child_process";
|
|
@@ -23776,6 +23840,7 @@ var LocalSandboxProvider = class {
|
|
|
23776
23840
|
constructor(config = {}) {
|
|
23777
23841
|
this.instances = /* @__PURE__ */ new Map();
|
|
23778
23842
|
this.creating = /* @__PURE__ */ new Map();
|
|
23843
|
+
this.createResourceAddress = createResourceAddress;
|
|
23779
23844
|
this.basePath = config.basePath ?? path4.join(os.homedir(), ".axiom-local-sandbox");
|
|
23780
23845
|
}
|
|
23781
23846
|
async createSandbox(name, _config) {
|
|
@@ -23828,6 +23893,14 @@ var LocalSandboxProvider = class {
|
|
|
23828
23893
|
async listSandboxes() {
|
|
23829
23894
|
return Array.from(this.instances.values());
|
|
23830
23895
|
}
|
|
23896
|
+
getResourceResolver() {
|
|
23897
|
+
return {
|
|
23898
|
+
resolve: async (address) => {
|
|
23899
|
+
const hostPath = path4.join(this.basePath, "project", address.resourcePath);
|
|
23900
|
+
return fs4.readFile(hostPath);
|
|
23901
|
+
}
|
|
23902
|
+
};
|
|
23903
|
+
}
|
|
23831
23904
|
};
|
|
23832
23905
|
|
|
23833
23906
|
// src/sandbox_lattice/SandboxProviderFactory.ts
|
|
@@ -23884,6 +23957,75 @@ function createSandboxProvider(config) {
|
|
|
23884
23957
|
}
|
|
23885
23958
|
}
|
|
23886
23959
|
|
|
23960
|
+
// src/sandbox_lattice/TokenCache.ts
|
|
23961
|
+
var TokenCache = class {
|
|
23962
|
+
constructor() {
|
|
23963
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
23964
|
+
this.ttlMs = 6e4;
|
|
23965
|
+
}
|
|
23966
|
+
/**
|
|
23967
|
+
* Look up a token in the cache.
|
|
23968
|
+
*
|
|
23969
|
+
* @param token - The share token.
|
|
23970
|
+
* @returns The cached entry, or `null` if the token is absent or expired.
|
|
23971
|
+
*/
|
|
23972
|
+
get(token) {
|
|
23973
|
+
const item = this.cache.get(token);
|
|
23974
|
+
if (!item) return null;
|
|
23975
|
+
if (Date.now() > item.expires) {
|
|
23976
|
+
this.cache.delete(token);
|
|
23977
|
+
return null;
|
|
23978
|
+
}
|
|
23979
|
+
return item.entry;
|
|
23980
|
+
}
|
|
23981
|
+
/**
|
|
23982
|
+
* Store a token → address mapping.
|
|
23983
|
+
*
|
|
23984
|
+
* @param token - The share token.
|
|
23985
|
+
* @param entry - The cache entry to associate with the token.
|
|
23986
|
+
*/
|
|
23987
|
+
set(token, entry) {
|
|
23988
|
+
this.cache.set(token, { entry, expires: Date.now() + this.ttlMs });
|
|
23989
|
+
}
|
|
23990
|
+
/**
|
|
23991
|
+
* Remove a cached entry (e.g. on revocation).
|
|
23992
|
+
*
|
|
23993
|
+
* @param token - The share token to invalidate.
|
|
23994
|
+
*/
|
|
23995
|
+
invalidate(token) {
|
|
23996
|
+
this.cache.delete(token);
|
|
23997
|
+
}
|
|
23998
|
+
};
|
|
23999
|
+
|
|
24000
|
+
// src/sandbox_lattice/ShareService.ts
|
|
24001
|
+
import { randomBytes } from "crypto";
|
|
24002
|
+
var TOKEN_BYTES = 24;
|
|
24003
|
+
function generateToken() {
|
|
24004
|
+
return randomBytes(TOKEN_BYTES).toString("base64url");
|
|
24005
|
+
}
|
|
24006
|
+
function createSharePayload(tenantId, workspaceId, projectId, userId, request) {
|
|
24007
|
+
return {
|
|
24008
|
+
address: createResourceAddress({
|
|
24009
|
+
tenantId,
|
|
24010
|
+
workspaceId,
|
|
24011
|
+
projectId,
|
|
24012
|
+
resourcePath: request.resourcePath
|
|
24013
|
+
}),
|
|
24014
|
+
tenantId,
|
|
24015
|
+
workspaceId,
|
|
24016
|
+
projectId,
|
|
24017
|
+
assistantId: request.assistantId ?? null,
|
|
24018
|
+
vmIsolation: "project",
|
|
24019
|
+
visibility: request.visibility ?? "public",
|
|
24020
|
+
passwordHash: request.visibility === "password" && request.password ? request.password : null,
|
|
24021
|
+
title: request.title ?? null,
|
|
24022
|
+
createdBy: userId,
|
|
24023
|
+
expiresAt: request.expiresAt ? new Date(request.expiresAt) : null,
|
|
24024
|
+
maxAccess: request.maxAccess ?? null,
|
|
24025
|
+
revoked: false
|
|
24026
|
+
};
|
|
24027
|
+
}
|
|
24028
|
+
|
|
23887
24029
|
// src/channel/connectAllChannels.ts
|
|
23888
24030
|
async function connectAllChannels(getAdapter, options = {}) {
|
|
23889
24031
|
const store = getStoreLattice("default", "channelInstallation").store;
|
|
@@ -23924,7 +24066,7 @@ function getMenuRegistry() {
|
|
|
23924
24066
|
import * as Protocols from "@axiom-lattice/protocols";
|
|
23925
24067
|
|
|
23926
24068
|
// src/util/encryption.ts
|
|
23927
|
-
import { createCipheriv, createDecipheriv, randomBytes, pbkdf2Sync } from "crypto";
|
|
24069
|
+
import { createCipheriv, createDecipheriv, randomBytes as randomBytes2, pbkdf2Sync } from "crypto";
|
|
23928
24070
|
var ALGORITHM = "aes-256-gcm";
|
|
23929
24071
|
var IV_LENGTH = 16;
|
|
23930
24072
|
var SALT_LENGTH = 32;
|
|
@@ -23946,8 +24088,8 @@ function getEncryptionKey() {
|
|
|
23946
24088
|
}
|
|
23947
24089
|
function encrypt(plaintext, key) {
|
|
23948
24090
|
const actualKey = key || getEncryptionKey();
|
|
23949
|
-
const salt =
|
|
23950
|
-
const iv =
|
|
24091
|
+
const salt = randomBytes2(SALT_LENGTH);
|
|
24092
|
+
const iv = randomBytes2(IV_LENGTH);
|
|
23951
24093
|
const derivedKey = pbkdf2Sync(actualKey, salt, ITERATIONS, 32, "sha256");
|
|
23952
24094
|
const cipher = createCipheriv(ALGORITHM, derivedKey, iv);
|
|
23953
24095
|
const encrypted = Buffer.concat([cipher.update(plaintext, "utf8"), cipher.final()]);
|
|
@@ -24208,6 +24350,7 @@ export {
|
|
|
24208
24350
|
TaskStatus,
|
|
24209
24351
|
TeamAgentGraphBuilder,
|
|
24210
24352
|
ThreadStatus2 as ThreadStatus,
|
|
24353
|
+
TokenCache,
|
|
24211
24354
|
ToolLatticeManager,
|
|
24212
24355
|
VectorStoreLatticeManager,
|
|
24213
24356
|
VolumeFilesystem,
|
|
@@ -24245,8 +24388,10 @@ export {
|
|
|
24245
24388
|
createQuerySqlTool,
|
|
24246
24389
|
createQueryTableDefinitionTool,
|
|
24247
24390
|
createQueryTablesListTool,
|
|
24391
|
+
createResourceAddress,
|
|
24248
24392
|
createSandboxProvider,
|
|
24249
24393
|
createSchedulerMiddleware,
|
|
24394
|
+
createSharePayload,
|
|
24250
24395
|
createTaskMiddleware,
|
|
24251
24396
|
createTeamMiddleware,
|
|
24252
24397
|
createTeammateTools,
|
|
@@ -24266,6 +24411,7 @@ export {
|
|
|
24266
24411
|
formatGrepMatches,
|
|
24267
24412
|
formatGrepResults,
|
|
24268
24413
|
formatReadResponse,
|
|
24414
|
+
generateToken,
|
|
24269
24415
|
getAgentClient,
|
|
24270
24416
|
getAgentConfig,
|
|
24271
24417
|
getAllAgentConfigs,
|