@exulu/backend 5.7.0 → 5.7.2
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/{chunk-TAXHJJ5R.js → chunk-RELZZYVA.js} +44 -3
- package/dist/{convert-exulu-tools-to-ai-sdk-tools-BPZSN22N.js → convert-exulu-tools-to-ai-sdk-tools-L6SESYPH.js} +1 -1
- package/dist/index.cjs +63 -7
- package/dist/index.js +12 -6
- package/ee/invoke-skills/binary-file-guard.test.ts +0 -0
- package/ee/invoke-skills/binary-file-guard.ts +0 -0
- package/ee/invoke-skills/create-sandbox.ts +13 -2
- package/ee/workers.ts +6 -4
- package/package.json +1 -1
|
@@ -1723,7 +1723,7 @@ var ExuluTool = class _ExuluTool {
|
|
|
1723
1723
|
if (!agent) {
|
|
1724
1724
|
throw new Error("Agent not found.");
|
|
1725
1725
|
}
|
|
1726
|
-
const { convertExuluToolsToAiSdkTools: convertExuluToolsToAiSdkTools2 } = await import("./convert-exulu-tools-to-ai-sdk-tools-
|
|
1726
|
+
const { convertExuluToolsToAiSdkTools: convertExuluToolsToAiSdkTools2 } = await import("./convert-exulu-tools-to-ai-sdk-tools-L6SESYPH.js");
|
|
1727
1727
|
const tools = await convertExuluToolsToAiSdkTools2(
|
|
1728
1728
|
[this],
|
|
1729
1729
|
[],
|
|
@@ -13285,6 +13285,41 @@ var buildSkillEnv = ({
|
|
|
13285
13285
|
};
|
|
13286
13286
|
};
|
|
13287
13287
|
|
|
13288
|
+
// ee/invoke-skills/binary-file-guard.ts
|
|
13289
|
+
var BINARY_DOCUMENT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
13290
|
+
".pdf",
|
|
13291
|
+
".doc",
|
|
13292
|
+
".docx",
|
|
13293
|
+
".xls",
|
|
13294
|
+
".xlsx",
|
|
13295
|
+
".ppt",
|
|
13296
|
+
".pptx",
|
|
13297
|
+
".odt",
|
|
13298
|
+
".ods",
|
|
13299
|
+
".odp",
|
|
13300
|
+
".zip",
|
|
13301
|
+
".gz",
|
|
13302
|
+
".png",
|
|
13303
|
+
".jpg",
|
|
13304
|
+
".jpeg",
|
|
13305
|
+
".gif",
|
|
13306
|
+
".bmp",
|
|
13307
|
+
".tif",
|
|
13308
|
+
".tiff",
|
|
13309
|
+
".webp"
|
|
13310
|
+
]);
|
|
13311
|
+
function isBinaryDocumentPath(path3) {
|
|
13312
|
+
const dot = path3.lastIndexOf(".");
|
|
13313
|
+
if (dot < 0) return false;
|
|
13314
|
+
return BINARY_DOCUMENT_EXTENSIONS.has(path3.slice(dot).toLowerCase());
|
|
13315
|
+
}
|
|
13316
|
+
function looksBinary(content) {
|
|
13317
|
+
return content.slice(0, 8192).includes("\0");
|
|
13318
|
+
}
|
|
13319
|
+
function binaryReadHint(path3) {
|
|
13320
|
+
return `"${path3}" is a binary file \u2014 readFile would return raw bytes that cannot be interpreted and would flood the context. The text of mail attachments is already in the conversation (the <file file name=\u2026> block); for other documents use parse_document to extract the text first, then read within that extracted text.`;
|
|
13321
|
+
}
|
|
13322
|
+
|
|
13288
13323
|
// ee/invoke-skills/variable-grants.ts
|
|
13289
13324
|
var selectRowsToDecrypt = (rows) => rows.filter((row) => Boolean(row?.name) && row.allow_skill_access === true);
|
|
13290
13325
|
var deriveWithheldNames = (rows, granted) => [
|
|
@@ -14381,7 +14416,7 @@ Probe error: ${probe.reason ?? "(no detail)"}`
|
|
|
14381
14416
|
destination: sessionDir
|
|
14382
14417
|
});
|
|
14383
14418
|
const writeFileTool = tool2({
|
|
14384
|
-
description: 'Write content to a file in the sandbox. Creates parent directories if needed. Paths are always resolved against the session sandbox root \u2014 both relative paths ("skills
|
|
14419
|
+
description: 'Write content to a file in the sandbox. Creates parent directories if needed. Paths are always resolved against the session sandbox root \u2014 both relative paths ("skills/<Skill name>/SKILL.md") and leading-slash paths ("/skills/<Skill name>/SKILL.md") work and reach the same file. When the path is under the session artifact tree, the file is also uploaded to S3 and a short-lived presigned URL is returned in the tool output.',
|
|
14385
14420
|
inputSchema: z13.object({
|
|
14386
14421
|
path: z13.string().describe("The path where the file should be written. Relative paths and leading-slash paths are both resolved against the session sandbox root."),
|
|
14387
14422
|
content: z13.string().describe("The content to write to the file")
|
|
@@ -14402,13 +14437,19 @@ Probe error: ${probe.reason ?? "(no detail)"}`
|
|
|
14402
14437
|
}
|
|
14403
14438
|
});
|
|
14404
14439
|
const readFileTool = tool2({
|
|
14405
|
-
description: 'Read the contents of a file from the sandbox. Paths are always resolved against the session sandbox root \u2014 both relative paths ("skills
|
|
14440
|
+
description: 'Read the contents of a file from the sandbox. Paths are always resolved against the session sandbox root \u2014 both relative paths ("skills/<Skill name>/SKILL.md") and leading-slash paths ("/skills/<Skill name>/SKILL.md") work and reach the same file. Skills live in a folder per skill: "skills/<Skill name>/SKILL.md", never "skills/<Skill name>.md". If the file does not exist, the error message is surfaced verbatim.',
|
|
14406
14441
|
inputSchema: z13.object({
|
|
14407
14442
|
path: z13.string().describe("The path of the file to read. Relative paths and leading-slash paths are both resolved against the session sandbox root.")
|
|
14408
14443
|
}),
|
|
14409
14444
|
execute: async ({ path: path3 }) => {
|
|
14410
14445
|
const resolvedPath = resolveSessionPath(path3, sessionDir);
|
|
14446
|
+
if (isBinaryDocumentPath(resolvedPath)) {
|
|
14447
|
+
return { content: "", error: binaryReadHint(path3) };
|
|
14448
|
+
}
|
|
14411
14449
|
const content = await customSandbox.readFile(resolvedPath);
|
|
14450
|
+
if (looksBinary(content)) {
|
|
14451
|
+
return { content: "", error: binaryReadHint(path3) };
|
|
14452
|
+
}
|
|
14412
14453
|
return { content };
|
|
14413
14454
|
}
|
|
14414
14455
|
});
|
package/dist/index.cjs
CHANGED
|
@@ -11308,6 +11308,48 @@ var init_skill_env = __esm({
|
|
|
11308
11308
|
}
|
|
11309
11309
|
});
|
|
11310
11310
|
|
|
11311
|
+
// ee/invoke-skills/binary-file-guard.ts
|
|
11312
|
+
function isBinaryDocumentPath(path4) {
|
|
11313
|
+
const dot = path4.lastIndexOf(".");
|
|
11314
|
+
if (dot < 0) return false;
|
|
11315
|
+
return BINARY_DOCUMENT_EXTENSIONS.has(path4.slice(dot).toLowerCase());
|
|
11316
|
+
}
|
|
11317
|
+
function looksBinary(content) {
|
|
11318
|
+
return content.slice(0, 8192).includes("\0");
|
|
11319
|
+
}
|
|
11320
|
+
function binaryReadHint(path4) {
|
|
11321
|
+
return `"${path4}" is a binary file \u2014 readFile would return raw bytes that cannot be interpreted and would flood the context. The text of mail attachments is already in the conversation (the <file file name=\u2026> block); for other documents use parse_document to extract the text first, then read within that extracted text.`;
|
|
11322
|
+
}
|
|
11323
|
+
var BINARY_DOCUMENT_EXTENSIONS;
|
|
11324
|
+
var init_binary_file_guard = __esm({
|
|
11325
|
+
"ee/invoke-skills/binary-file-guard.ts"() {
|
|
11326
|
+
"use strict";
|
|
11327
|
+
init_cjs_shims();
|
|
11328
|
+
BINARY_DOCUMENT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
11329
|
+
".pdf",
|
|
11330
|
+
".doc",
|
|
11331
|
+
".docx",
|
|
11332
|
+
".xls",
|
|
11333
|
+
".xlsx",
|
|
11334
|
+
".ppt",
|
|
11335
|
+
".pptx",
|
|
11336
|
+
".odt",
|
|
11337
|
+
".ods",
|
|
11338
|
+
".odp",
|
|
11339
|
+
".zip",
|
|
11340
|
+
".gz",
|
|
11341
|
+
".png",
|
|
11342
|
+
".jpg",
|
|
11343
|
+
".jpeg",
|
|
11344
|
+
".gif",
|
|
11345
|
+
".bmp",
|
|
11346
|
+
".tif",
|
|
11347
|
+
".tiff",
|
|
11348
|
+
".webp"
|
|
11349
|
+
]);
|
|
11350
|
+
}
|
|
11351
|
+
});
|
|
11352
|
+
|
|
11311
11353
|
// ee/invoke-skills/variable-grants.ts
|
|
11312
11354
|
var selectRowsToDecrypt, deriveWithheldNames, selectGrantedVariables;
|
|
11313
11355
|
var init_variable_grants = __esm({
|
|
@@ -12663,7 +12705,7 @@ Probe error: ${probe.reason ?? "(no detail)"}`
|
|
|
12663
12705
|
destination: sessionDir
|
|
12664
12706
|
});
|
|
12665
12707
|
const writeFileTool = (0, import_ai2.tool)({
|
|
12666
|
-
description: 'Write content to a file in the sandbox. Creates parent directories if needed. Paths are always resolved against the session sandbox root \u2014 both relative paths ("skills
|
|
12708
|
+
description: 'Write content to a file in the sandbox. Creates parent directories if needed. Paths are always resolved against the session sandbox root \u2014 both relative paths ("skills/<Skill name>/SKILL.md") and leading-slash paths ("/skills/<Skill name>/SKILL.md") work and reach the same file. When the path is under the session artifact tree, the file is also uploaded to S3 and a short-lived presigned URL is returned in the tool output.',
|
|
12667
12709
|
inputSchema: import_zod7.z.object({
|
|
12668
12710
|
path: import_zod7.z.string().describe("The path where the file should be written. Relative paths and leading-slash paths are both resolved against the session sandbox root."),
|
|
12669
12711
|
content: import_zod7.z.string().describe("The content to write to the file")
|
|
@@ -12684,13 +12726,19 @@ Probe error: ${probe.reason ?? "(no detail)"}`
|
|
|
12684
12726
|
}
|
|
12685
12727
|
});
|
|
12686
12728
|
const readFileTool = (0, import_ai2.tool)({
|
|
12687
|
-
description: 'Read the contents of a file from the sandbox. Paths are always resolved against the session sandbox root \u2014 both relative paths ("skills
|
|
12729
|
+
description: 'Read the contents of a file from the sandbox. Paths are always resolved against the session sandbox root \u2014 both relative paths ("skills/<Skill name>/SKILL.md") and leading-slash paths ("/skills/<Skill name>/SKILL.md") work and reach the same file. Skills live in a folder per skill: "skills/<Skill name>/SKILL.md", never "skills/<Skill name>.md". If the file does not exist, the error message is surfaced verbatim.',
|
|
12688
12730
|
inputSchema: import_zod7.z.object({
|
|
12689
12731
|
path: import_zod7.z.string().describe("The path of the file to read. Relative paths and leading-slash paths are both resolved against the session sandbox root.")
|
|
12690
12732
|
}),
|
|
12691
12733
|
execute: async ({ path: path4 }) => {
|
|
12692
12734
|
const resolvedPath = resolveSessionPath(path4, sessionDir);
|
|
12735
|
+
if (isBinaryDocumentPath(resolvedPath)) {
|
|
12736
|
+
return { content: "", error: binaryReadHint(path4) };
|
|
12737
|
+
}
|
|
12693
12738
|
const content = await customSandbox.readFile(resolvedPath);
|
|
12739
|
+
if (looksBinary(content)) {
|
|
12740
|
+
return { content: "", error: binaryReadHint(path4) };
|
|
12741
|
+
}
|
|
12694
12742
|
return { content };
|
|
12695
12743
|
}
|
|
12696
12744
|
});
|
|
@@ -12788,6 +12836,7 @@ var init_create_sandbox = __esm({
|
|
|
12788
12836
|
init_artifact_filter();
|
|
12789
12837
|
init_system_dependencies();
|
|
12790
12838
|
init_skill_env();
|
|
12839
|
+
init_binary_file_guard();
|
|
12791
12840
|
init_variable_grants();
|
|
12792
12841
|
init_os_environ_names();
|
|
12793
12842
|
init_logger();
|
|
@@ -21330,6 +21379,12 @@ var bullmq = {
|
|
|
21330
21379
|
}
|
|
21331
21380
|
};
|
|
21332
21381
|
|
|
21382
|
+
// src/utils/jsonb-safe.ts
|
|
21383
|
+
init_cjs_shims();
|
|
21384
|
+
function jsonbSafeStringify(value) {
|
|
21385
|
+
return JSON.stringify(value).replace(/\\u0000/g, "");
|
|
21386
|
+
}
|
|
21387
|
+
|
|
21333
21388
|
// src/exulu/turn-metadata.ts
|
|
21334
21389
|
init_cjs_shims();
|
|
21335
21390
|
function finishTurnMetadata(opts) {
|
|
@@ -23284,7 +23339,7 @@ async function runGuardChain(opts) {
|
|
|
23284
23339
|
|
|
23285
23340
|
// src/exulu/email-inbound/intake-warnings.ts
|
|
23286
23341
|
init_cjs_shims();
|
|
23287
|
-
var MENTIONS_ATTACHMENT = /\b(anbei|anliegend|beigef[üu]gt|im anhang|als anhang|anhang|anlage|attached|attachment|enclosed)\b/i;
|
|
23342
|
+
var MENTIONS_ATTACHMENT = /\b(anbei|anliegend|beigef[üu]gt|im anhang|als anhang|anhang|als anlage|attached|attachment|enclosed)\b/i;
|
|
23288
23343
|
var INTAKE_WARNING_TEXTS = {
|
|
23289
23344
|
attachment_mentioned_but_none_received: "Die E-Mail erw\xE4hnt einen Anhang, es wurde aber kein Anhang \xFCbermittelt (0 Dateien im Payload). Nicht raten, welches Teil gemeint ist: um den Anhang oder die konkreten Positionen bitten."
|
|
23290
23345
|
};
|
|
@@ -24442,8 +24497,8 @@ var createWorkers = async (queues2, config, contexts, evals, tools, tracer) => {
|
|
|
24442
24497
|
);
|
|
24443
24498
|
if (result.pausedAtStepIndex !== void 0) {
|
|
24444
24499
|
await db2.from("job_results").where({ id: jobResultId }).update({
|
|
24445
|
-
result: messages.length > 0 ?
|
|
24446
|
-
metadata:
|
|
24500
|
+
result: messages.length > 0 ? jsonbSafeStringify(messages[messages.length - 1]) : null,
|
|
24501
|
+
metadata: jsonbSafeStringify({
|
|
24447
24502
|
messages,
|
|
24448
24503
|
...metadata,
|
|
24449
24504
|
tokens,
|
|
@@ -24931,8 +24986,9 @@ var createWorkers = async (queues2, config, contexts, evals, tools, tracer) => {
|
|
|
24931
24986
|
const { db: db2 } = await postgresClient();
|
|
24932
24987
|
await db2.from("job_results").where({ job_id: job.id, state: JOB_STATUS_ENUM.active }).update({
|
|
24933
24988
|
state: JOB_STATUS_ENUM.completed,
|
|
24934
|
-
|
|
24935
|
-
|
|
24989
|
+
// jsonb rejects the NUL escape; a raw attachment read can carry it (2026-10-29).
|
|
24990
|
+
result: returnvalue.result != null ? jsonbSafeStringify(returnvalue.result) : null,
|
|
24991
|
+
metadata: returnvalue.metadata != null ? jsonbSafeStringify(returnvalue.metadata) : null
|
|
24936
24992
|
});
|
|
24937
24993
|
void maybePruneJobResults(db2);
|
|
24938
24994
|
}
|
package/dist/index.js
CHANGED
|
@@ -208,7 +208,7 @@ import {
|
|
|
208
208
|
willEmbedOnQueue,
|
|
209
209
|
withRetry,
|
|
210
210
|
workflowTemplatesSchema
|
|
211
|
-
} from "./chunk-
|
|
211
|
+
} from "./chunk-RELZZYVA.js";
|
|
212
212
|
import {
|
|
213
213
|
LiteLLMAdminError,
|
|
214
214
|
findLiteLLMModel,
|
|
@@ -3963,6 +3963,11 @@ var bullmq = {
|
|
|
3963
3963
|
}
|
|
3964
3964
|
};
|
|
3965
3965
|
|
|
3966
|
+
// src/utils/jsonb-safe.ts
|
|
3967
|
+
function jsonbSafeStringify(value) {
|
|
3968
|
+
return JSON.stringify(value).replace(/\\u0000/g, "");
|
|
3969
|
+
}
|
|
3970
|
+
|
|
3966
3971
|
// src/exulu/turn-metadata.ts
|
|
3967
3972
|
function finishTurnMetadata(opts) {
|
|
3968
3973
|
const now = opts.now ?? Date.now();
|
|
@@ -5821,7 +5826,7 @@ async function runGuardChain(opts) {
|
|
|
5821
5826
|
}
|
|
5822
5827
|
|
|
5823
5828
|
// src/exulu/email-inbound/intake-warnings.ts
|
|
5824
|
-
var MENTIONS_ATTACHMENT = /\b(anbei|anliegend|beigef[üu]gt|im anhang|als anhang|anhang|anlage|attached|attachment|enclosed)\b/i;
|
|
5829
|
+
var MENTIONS_ATTACHMENT = /\b(anbei|anliegend|beigef[üu]gt|im anhang|als anhang|anhang|als anlage|attached|attachment|enclosed)\b/i;
|
|
5825
5830
|
var INTAKE_WARNING_TEXTS = {
|
|
5826
5831
|
attachment_mentioned_but_none_received: "Die E-Mail erw\xE4hnt einen Anhang, es wurde aber kein Anhang \xFCbermittelt (0 Dateien im Payload). Nicht raten, welches Teil gemeint ist: um den Anhang oder die konkreten Positionen bitten."
|
|
5827
5832
|
};
|
|
@@ -6965,8 +6970,8 @@ var createWorkers = async (queues2, config, contexts, evals, tools, tracer) => {
|
|
|
6965
6970
|
);
|
|
6966
6971
|
if (result.pausedAtStepIndex !== void 0) {
|
|
6967
6972
|
await db.from("job_results").where({ id: jobResultId }).update({
|
|
6968
|
-
result: messages.length > 0 ?
|
|
6969
|
-
metadata:
|
|
6973
|
+
result: messages.length > 0 ? jsonbSafeStringify(messages[messages.length - 1]) : null,
|
|
6974
|
+
metadata: jsonbSafeStringify({
|
|
6970
6975
|
messages,
|
|
6971
6976
|
...metadata,
|
|
6972
6977
|
tokens,
|
|
@@ -7454,8 +7459,9 @@ var createWorkers = async (queues2, config, contexts, evals, tools, tracer) => {
|
|
|
7454
7459
|
const { db } = await postgresClient();
|
|
7455
7460
|
await db.from("job_results").where({ job_id: job.id, state: JOB_STATUS_ENUM.active }).update({
|
|
7456
7461
|
state: JOB_STATUS_ENUM.completed,
|
|
7457
|
-
|
|
7458
|
-
|
|
7462
|
+
// jsonb rejects the NUL escape; a raw attachment read can carry it (2026-10-29).
|
|
7463
|
+
result: returnvalue.result != null ? jsonbSafeStringify(returnvalue.result) : null,
|
|
7464
|
+
metadata: returnvalue.metadata != null ? jsonbSafeStringify(returnvalue.metadata) : null
|
|
7459
7465
|
});
|
|
7460
7466
|
void maybePruneJobResults(db);
|
|
7461
7467
|
}
|
|
Binary file
|
|
Binary file
|
|
@@ -11,6 +11,7 @@ import { listS3ObjectsByPrefix, getS3ObjectBytes, uploadFile, getPresignedUrl, t
|
|
|
11
11
|
import { isIgnoredArtifactPath, capArtifacts, needsDownload } from './artifact-filter'
|
|
12
12
|
import { getNpmGlobalRoot } from '@SRC/exulu/system-dependencies.ts'
|
|
13
13
|
import { buildSkillEnv } from './skill-env'
|
|
14
|
+
import { isBinaryDocumentPath, looksBinary, binaryReadHint } from './binary-file-guard'
|
|
14
15
|
import { selectGrantedVariables, selectRowsToDecrypt, deriveWithheldNames } from './variable-grants'
|
|
15
16
|
import { readLiteLLMOsEnvironNames } from '@SRC/exulu/litellm/os-environ-names'
|
|
16
17
|
import { getAuditLogger } from '@SRC/exulu/audit/logger'
|
|
@@ -983,7 +984,7 @@ export async function createSessionSandbox(
|
|
|
983
984
|
description:
|
|
984
985
|
'Write content to a file in the sandbox. Creates parent directories if needed. ' +
|
|
985
986
|
'Paths are always resolved against the session sandbox root — both relative paths ' +
|
|
986
|
-
'("skills
|
|
987
|
+
'("skills/<Skill name>/SKILL.md") and leading-slash paths ("/skills/<Skill name>/SKILL.md") work and reach the same file. ' +
|
|
987
988
|
'When the path is under the session artifact tree, the file is also uploaded to S3 ' +
|
|
988
989
|
'and a short-lived presigned URL is returned in the tool output.',
|
|
989
990
|
inputSchema: z.object({
|
|
@@ -1017,14 +1018,24 @@ export async function createSessionSandbox(
|
|
|
1017
1018
|
description:
|
|
1018
1019
|
'Read the contents of a file from the sandbox. ' +
|
|
1019
1020
|
'Paths are always resolved against the session sandbox root — both relative paths ' +
|
|
1020
|
-
'("skills
|
|
1021
|
+
'("skills/<Skill name>/SKILL.md") and leading-slash paths ("/skills/<Skill name>/SKILL.md") work and reach the same file. ' +
|
|
1022
|
+
'Skills live in a folder per skill: "skills/<Skill name>/SKILL.md", never "skills/<Skill name>.md". ' +
|
|
1021
1023
|
'If the file does not exist, the error message is surfaced verbatim.',
|
|
1022
1024
|
inputSchema: z.object({
|
|
1023
1025
|
path: z.string().describe('The path of the file to read. Relative paths and leading-slash paths are both resolved against the session sandbox root.'),
|
|
1024
1026
|
}),
|
|
1025
1027
|
execute: async ({ path }) => {
|
|
1026
1028
|
const resolvedPath = resolveSessionPath(path, sessionDir)
|
|
1029
|
+
// Binary documents never go to the model as raw bytes (see
|
|
1030
|
+
// binary-file-guard.ts). Returned, not thrown: a throw fails the
|
|
1031
|
+
// whole step in a routine, a hint lets the agent self-correct.
|
|
1032
|
+
if (isBinaryDocumentPath(resolvedPath)) {
|
|
1033
|
+
return { content: '', error: binaryReadHint(path) }
|
|
1034
|
+
}
|
|
1027
1035
|
const content = await customSandbox.readFile(resolvedPath)
|
|
1036
|
+
if (looksBinary(content)) {
|
|
1037
|
+
return { content: '', error: binaryReadHint(path) }
|
|
1038
|
+
}
|
|
1028
1039
|
return { content }
|
|
1029
1040
|
},
|
|
1030
1041
|
})
|
package/ee/workers.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { guardRedisStartup, logRedisErrors } from "@EE/queues/redis-startup.ts";
|
|
|
4
4
|
import { Job, Worker, type JobState } from "bullmq";
|
|
5
5
|
import { bullmq } from "@SRC/validators/bullmq.ts";
|
|
6
6
|
import { serializeError } from "@SRC/utils/serialize-error.ts";
|
|
7
|
+
import { jsonbSafeStringify } from "@SRC/utils/jsonb-safe.ts";
|
|
7
8
|
import { finishTurnMetadata } from "@SRC/exulu/turn-metadata.ts";
|
|
8
9
|
import { getEnabledTools } from "@SRC/utils/enabled-tools.ts";
|
|
9
10
|
import { ExuluStorage } from "@SRC/exulu/storage.ts";
|
|
@@ -705,8 +706,8 @@ export const createWorkers = async (
|
|
|
705
706
|
.where({ id: jobResultId })
|
|
706
707
|
.update({
|
|
707
708
|
result:
|
|
708
|
-
messages.length > 0 ?
|
|
709
|
-
metadata:
|
|
709
|
+
messages.length > 0 ? jsonbSafeStringify(messages[messages.length - 1]) : null,
|
|
710
|
+
metadata: jsonbSafeStringify({
|
|
710
711
|
messages,
|
|
711
712
|
...metadata,
|
|
712
713
|
tokens,
|
|
@@ -1374,8 +1375,9 @@ export const createWorkers = async (
|
|
|
1374
1375
|
.where({ job_id: job.id, state: JOB_STATUS_ENUM.active })
|
|
1375
1376
|
.update({
|
|
1376
1377
|
state: JOB_STATUS_ENUM.completed,
|
|
1377
|
-
|
|
1378
|
-
|
|
1378
|
+
// jsonb rejects the NUL escape; a raw attachment read can carry it (2026-10-29).
|
|
1379
|
+
result: returnvalue.result != null ? jsonbSafeStringify(returnvalue.result) : null,
|
|
1380
|
+
metadata: returnvalue.metadata != null ? jsonbSafeStringify(returnvalue.metadata) : null,
|
|
1379
1381
|
});
|
|
1380
1382
|
|
|
1381
1383
|
// Cap the table as rows become terminal (every Nth, idempotent).
|