@exulu/backend 5.8.2 → 5.9.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.
|
@@ -659,7 +659,7 @@ var ExuluTool = class _ExuluTool {
|
|
|
659
659
|
if (!agent) {
|
|
660
660
|
throw new Error("Agent not found.");
|
|
661
661
|
}
|
|
662
|
-
const { convertExuluToolsToAiSdkTools: convertExuluToolsToAiSdkTools2 } = await import("./convert-exulu-tools-to-ai-sdk-tools-
|
|
662
|
+
const { convertExuluToolsToAiSdkTools: convertExuluToolsToAiSdkTools2 } = await import("./convert-exulu-tools-to-ai-sdk-tools-PEZCQBM5.js");
|
|
663
663
|
const tools = await convertExuluToolsToAiSdkTools2(
|
|
664
664
|
[this],
|
|
665
665
|
[],
|
|
@@ -3955,6 +3955,7 @@ var listS3ObjectsByPrefix = async (prefix, config) => {
|
|
|
3955
3955
|
} while (continuationToken);
|
|
3956
3956
|
return results;
|
|
3957
3957
|
};
|
|
3958
|
+
var encodeS3KeyForCopySource = (key) => key.split("/").map((segment) => encodeURIComponent(segment)).join("/");
|
|
3958
3959
|
var copyS3Object = async (sourceKey, destKey, config) => {
|
|
3959
3960
|
if (!config.fileUploads) {
|
|
3960
3961
|
throw new Error("File uploads are not configured");
|
|
@@ -3963,7 +3964,7 @@ var copyS3Object = async (sourceKey, destKey, config) => {
|
|
|
3963
3964
|
const bucket = config.fileUploads.s3Bucket;
|
|
3964
3965
|
const command = new CopyObjectCommand({
|
|
3965
3966
|
Bucket: bucket,
|
|
3966
|
-
CopySource: `${bucket}/${sourceKey}`,
|
|
3967
|
+
CopySource: `${bucket}/${encodeS3KeyForCopySource(sourceKey)}`,
|
|
3967
3968
|
Key: destKey
|
|
3968
3969
|
});
|
|
3969
3970
|
await client.send(command);
|
|
@@ -4009,6 +4010,21 @@ var getS3ObjectEtag = async (key, config) => {
|
|
|
4009
4010
|
return null;
|
|
4010
4011
|
}
|
|
4011
4012
|
};
|
|
4013
|
+
var getS3ObjectSize = async (key, config) => {
|
|
4014
|
+
if (!config.fileUploads) {
|
|
4015
|
+
throw new Error("File uploads are not configured");
|
|
4016
|
+
}
|
|
4017
|
+
const client = getS3Client(config);
|
|
4018
|
+
const bucket = config.fileUploads.s3Bucket;
|
|
4019
|
+
try {
|
|
4020
|
+
const response = await client.send(
|
|
4021
|
+
new HeadObjectCommand({ Bucket: bucket, Key: key })
|
|
4022
|
+
);
|
|
4023
|
+
return response.ContentLength ?? null;
|
|
4024
|
+
} catch {
|
|
4025
|
+
return null;
|
|
4026
|
+
}
|
|
4027
|
+
};
|
|
4012
4028
|
var getS3ObjectBytes = async (key, config) => {
|
|
4013
4029
|
if (!config.fileUploads) {
|
|
4014
4030
|
throw new Error("File uploads are not configured");
|
|
@@ -6263,6 +6279,14 @@ var hasAgentsReadAccess = (user) => user?.super_admin === true || user?.role?.ag
|
|
|
6263
6279
|
var hasAgentsWriteAccess = (user) => user?.super_admin === true || user?.role?.agents === "write";
|
|
6264
6280
|
var applyAccessControl = (table, query, user, field_prefix) => {
|
|
6265
6281
|
const tableNamePlural = table.name.plural.toLowerCase();
|
|
6282
|
+
if (user?.type === "api" && user.scope_mode === "agents" && (tableNamePlural === "agent_sessions" || tableNamePlural === "agent_messages")) {
|
|
6283
|
+
console.error(
|
|
6284
|
+
"==== Access control: agents-scoped API key refused on conversation table. ====",
|
|
6285
|
+
user?.id,
|
|
6286
|
+
table.name.plural
|
|
6287
|
+
);
|
|
6288
|
+
return query.whereRaw("1 = 0");
|
|
6289
|
+
}
|
|
6266
6290
|
if (table.name.plural !== "agent_sessions" && user?.super_admin === true) {
|
|
6267
6291
|
return query;
|
|
6268
6292
|
}
|
|
@@ -10049,7 +10073,22 @@ var sharedArtifactsSchema = {
|
|
|
10049
10073
|
// bcrypt; password mode only
|
|
10050
10074
|
{ name: "expires_at", type: "date", required: false },
|
|
10051
10075
|
// null = no expiry
|
|
10052
|
-
{ name: "content_type", type: "text", required: false }
|
|
10076
|
+
{ name: "content_type", type: "text", required: false },
|
|
10077
|
+
// Admin/creator-assigned agent bindings for the artifact's panel (spec
|
|
10078
|
+
// 2026-11-04-artifact-agent-panel). Nullable json; read back as
|
|
10079
|
+
// AgentSlot[] (see shared-artifacts.ts), empty array when null.
|
|
10080
|
+
// Deliberately not cleared when the row leaves "regular" auth mode —
|
|
10081
|
+
// see planShareUpdate's docblock.
|
|
10082
|
+
//
|
|
10083
|
+
// hidden: true for the same reason password_hash two lines up is: the
|
|
10084
|
+
// generic GraphQL shared_artifacts query is read-open to every
|
|
10085
|
+
// authenticated user (apiWrites: "super_admin" only locks the generic
|
|
10086
|
+
// mutations), and a public/password share's rights_mode is forced to
|
|
10087
|
+
// the "public" sentinel, so without this flag agent_slots would leak
|
|
10088
|
+
// through that query for exactly the shares /panel's 404-masking exists
|
|
10089
|
+
// to protect. /settings and /panel are unaffected: both read row.agent_slots
|
|
10090
|
+
// straight off the knex row, not through the generated GraphQL field.
|
|
10091
|
+
{ name: "agent_slots", type: "json", hidden: true }
|
|
10053
10092
|
// `grant_viewer_identity`, `identity_granted_by` and `identity_granted_at`
|
|
10054
10093
|
// were here. The viewer-identity capability is no longer a per-row grant:
|
|
10055
10094
|
// `auth_mode: "regular"` carries it, because such an artifact only renders
|
|
@@ -10832,6 +10871,13 @@ function sessionFilePrefix(ownerId, sessionId, s3prefix) {
|
|
|
10832
10871
|
const general = s3prefix ? `${s3prefix.replace(/\/+$/, "")}/` : "";
|
|
10833
10872
|
return `${general}user_${ownerId}/sessions/${sessionId}/`;
|
|
10834
10873
|
}
|
|
10874
|
+
function sanitizeFilename(name) {
|
|
10875
|
+
const trimmed = name.trim();
|
|
10876
|
+
if (!trimmed) return "";
|
|
10877
|
+
if (trimmed.includes("..")) return "";
|
|
10878
|
+
if (trimmed.startsWith("/") || trimmed.startsWith("\\")) return "";
|
|
10879
|
+
return trimmed.replace(/[\\/]/g, "_");
|
|
10880
|
+
}
|
|
10835
10881
|
|
|
10836
10882
|
// src/utils/check-item-write-access.ts
|
|
10837
10883
|
var checkItemWriteAccess = async (context, record, user) => {
|
|
@@ -14912,6 +14958,7 @@ export {
|
|
|
14912
14958
|
getS3ObjectContent,
|
|
14913
14959
|
getS3ObjectStream,
|
|
14914
14960
|
getS3ObjectEtag,
|
|
14961
|
+
getS3ObjectSize,
|
|
14915
14962
|
getS3ObjectBytes,
|
|
14916
14963
|
deleteS3Object,
|
|
14917
14964
|
getS3SignedUploadUrl,
|
|
@@ -15019,6 +15066,7 @@ export {
|
|
|
15019
15066
|
normalizeRbac,
|
|
15020
15067
|
collectMemoryDecisions,
|
|
15021
15068
|
sessionFilePrefix,
|
|
15069
|
+
sanitizeFilename,
|
|
15022
15070
|
KB_EDITOR_TOOL_ID,
|
|
15023
15071
|
createKbEditorPickerTool,
|
|
15024
15072
|
RBACResolver,
|