@opengeni/worker-bundle 3.0.1-canary.38874404583001 → 3.1.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/activities/run-input.d.ts +2 -0
- package/dist/{activities-control-HDHPG2FN.js → activities-control-ROJJNNTJ.js} +2 -2
- package/dist/{activities-turn-YJ5D55CO.js → activities-turn-4SWYWKI5.js} +2 -2
- package/dist/artifact-materializer-entry.js +0 -0
- package/dist/artifact-outbox-entry.js +0 -0
- package/dist/{chunk-ONGBBFRZ.js → chunk-6SHXF4SU.js} +58 -7
- package/dist/{chunk-ONGBBFRZ.js.map → chunk-6SHXF4SU.js.map} +1 -1
- package/dist/index.js +1 -1
- package/package.json +24 -24
- package/src/activities/run-input.ts +82 -6
- /package/dist/{activities-control-HDHPG2FN.js.map → activities-control-ROJJNNTJ.js.map} +0 -0
- /package/dist/{activities-turn-YJ5D55CO.js.map → activities-turn-4SWYWKI5.js.map} +0 -0
|
@@ -106,6 +106,8 @@ export declare function modelAttachmentContentForFiles(files: FileAsset[], readF
|
|
|
106
106
|
* Build one turn-scoped durable-attachment projector. Resolve active refs under
|
|
107
107
|
* current file authority and memoize metadata/bytes for retries and compaction.
|
|
108
108
|
* A turn boundary never changes an authorized attachment's representation.
|
|
109
|
+
* Images of a message stamped with an image bound are shown downscaled to fit
|
|
110
|
+
* it; unstamped (older) messages keep their full-resolution projection.
|
|
109
111
|
*/
|
|
110
112
|
export declare function createModelHistoryAttachmentProjector(policy: ModelAttachmentInputPolicy, readFileBytes?: (file: FileAsset) => Promise<Uint8Array>, loadAuthorizedFiles?: (fileIds: readonly string[]) => Promise<readonly FileAsset[]>): ModelHistoryAttachmentProjector;
|
|
111
113
|
/** Add current trigger refs only when older/local history predates durable stamping. */
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
withFirstPartyTools,
|
|
23
23
|
workflowIdForSession,
|
|
24
24
|
writeSessionUsageReceipts
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-6SHXF4SU.js";
|
|
26
26
|
import {
|
|
27
27
|
agentRunAdmissionDenial,
|
|
28
28
|
createSiteAuthMaintenanceActivities
|
|
@@ -6142,4 +6142,4 @@ export {
|
|
|
6142
6142
|
createControlActivities,
|
|
6143
6143
|
createControlActivitiesFromServices
|
|
6144
6144
|
};
|
|
6145
|
-
//# sourceMappingURL=activities-control-
|
|
6145
|
+
//# sourceMappingURL=activities-control-ROJJNNTJ.js.map
|
|
@@ -111,7 +111,7 @@ import {
|
|
|
111
111
|
wakeSubscriptionCoreWaitersAndDeliver,
|
|
112
112
|
withFirstPartyTools,
|
|
113
113
|
withModelRoutePresentation
|
|
114
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-6SHXF4SU.js";
|
|
115
115
|
import {
|
|
116
116
|
createFreshSandboxReadinessReplacementBudget,
|
|
117
117
|
establishSelfhostedTurnSession,
|
|
@@ -42524,4 +42524,4 @@ export {
|
|
|
42524
42524
|
createTurnActivities,
|
|
42525
42525
|
createTurnActivitiesFromServices
|
|
42526
42526
|
};
|
|
42527
|
-
//# sourceMappingURL=activities-turn-
|
|
42527
|
+
//# sourceMappingURL=activities-turn-4SWYWKI5.js.map
|
|
File without changes
|
|
File without changes
|
|
@@ -6183,6 +6183,7 @@ import {
|
|
|
6183
6183
|
MODEL_ATTACHMENT_REFS_FIELD,
|
|
6184
6184
|
MODEL_ATTACHMENT_CATALOG_MARKER,
|
|
6185
6185
|
MODEL_ATTACHMENT_CATALOG_RENDERED_FIELD,
|
|
6186
|
+
MODEL_ATTACHMENT_IMAGE_MAX_DIMENSION_FIELD,
|
|
6186
6187
|
FileResourceRef,
|
|
6187
6188
|
resourceMountPath,
|
|
6188
6189
|
readTurnExecutionPolicyV1 as readTurnExecutionPolicyV14,
|
|
@@ -6198,6 +6199,7 @@ import {
|
|
|
6198
6199
|
readSubscriptionHistoryProvenance
|
|
6199
6200
|
} from "@opengeni/db";
|
|
6200
6201
|
import {
|
|
6202
|
+
createModelImageSizer,
|
|
6201
6203
|
projectHistoryForProvider,
|
|
6202
6204
|
projectRejectedProviderArtifactsFromSerializedRunState,
|
|
6203
6205
|
projectRejectedReasoningArtifact,
|
|
@@ -6406,12 +6408,43 @@ function attachmentReceiptText(ref) {
|
|
|
6406
6408
|
function unavailableAttachmentReceiptText(ref) {
|
|
6407
6409
|
return requesterUnavailableReceiptText(`Attachment: fileId=${ref.fileId}`, "file");
|
|
6408
6410
|
}
|
|
6411
|
+
function attachmentImageBound(item) {
|
|
6412
|
+
const raw = item[MODEL_ATTACHMENT_IMAGE_MAX_DIMENSION_FIELD];
|
|
6413
|
+
return typeof raw === "number" && Number.isSafeInteger(raw) && raw >= 64 && raw <= 8192 ? raw : void 0;
|
|
6414
|
+
}
|
|
6415
|
+
var boundedImageSizers = /* @__PURE__ */ new Map();
|
|
6416
|
+
async function boundedAttachmentImage(attachment, bound) {
|
|
6417
|
+
const original = { image: attachment.dataUrl, note: "" };
|
|
6418
|
+
const comma = attachment.dataUrl.indexOf(",");
|
|
6419
|
+
if (comma < 0) return original;
|
|
6420
|
+
const data = attachment.dataUrl.slice(comma + 1);
|
|
6421
|
+
let sizer = boundedImageSizers.get(bound);
|
|
6422
|
+
if (!sizer) {
|
|
6423
|
+
sizer = createModelImageSizer(bound, 10 * 1024 * 1024, { jpegQuality: 85 });
|
|
6424
|
+
boundedImageSizers.set(bound, sizer);
|
|
6425
|
+
}
|
|
6426
|
+
try {
|
|
6427
|
+
const sized = await sizer(data, attachment.contentType);
|
|
6428
|
+
if (sized.data === data && sized.mediaType === attachment.contentType) return original;
|
|
6429
|
+
return {
|
|
6430
|
+
image: `data:${sized.mediaType};base64,${sized.data}`,
|
|
6431
|
+
note: ` Shown to you downscaled to ${sized.width}x${sized.height} from ${sized.originalWidth}x${sized.originalHeight}; the file itself is full resolution.`
|
|
6432
|
+
};
|
|
6433
|
+
} catch (error) {
|
|
6434
|
+
console.error("model attachment image could not be resized; sending original", {
|
|
6435
|
+
fileId: attachment.fileId,
|
|
6436
|
+
errorType: safeErrorType(error)
|
|
6437
|
+
});
|
|
6438
|
+
return original;
|
|
6439
|
+
}
|
|
6440
|
+
}
|
|
6409
6441
|
function createModelHistoryAttachmentProjector(policy, readFileBytes, loadAuthorizedFiles) {
|
|
6410
6442
|
const contentById = /* @__PURE__ */ new Map();
|
|
6411
6443
|
const attemptedContentIds = /* @__PURE__ */ new Set();
|
|
6412
6444
|
const fileById = /* @__PURE__ */ new Map();
|
|
6413
6445
|
const resolvedFileIds = /* @__PURE__ */ new Set();
|
|
6414
6446
|
const retainedByteSizes = /* @__PURE__ */ new Map();
|
|
6447
|
+
const boundedById = /* @__PURE__ */ new Map();
|
|
6415
6448
|
return async (items, options = {}) => {
|
|
6416
6449
|
for (const file of options.inlineFiles ?? []) {
|
|
6417
6450
|
fileById.set(file.id, file);
|
|
@@ -6481,6 +6514,18 @@ function createModelHistoryAttachmentProjector(policy, readFileBytes, loadAuthor
|
|
|
6481
6514
|
}
|
|
6482
6515
|
for (const attachment of content) contentById.set(attachment.fileId, attachment);
|
|
6483
6516
|
}
|
|
6517
|
+
for (const [index, refs] of refsByIndex) {
|
|
6518
|
+
const item = items[index];
|
|
6519
|
+
if (item[MODEL_ATTACHMENT_CATALOG_MARKER] === true) continue;
|
|
6520
|
+
const bound = attachmentImageBound(item);
|
|
6521
|
+
if (bound === void 0) continue;
|
|
6522
|
+
for (const ref of refs) {
|
|
6523
|
+
const attachment = fileById.has(ref.fileId) ? contentById.get(ref.fileId) : void 0;
|
|
6524
|
+
const key = `${bound}:${ref.fileId}`;
|
|
6525
|
+
if (!attachment || attachment.kind !== "image" || boundedById.has(key)) continue;
|
|
6526
|
+
boundedById.set(key, await boundedAttachmentImage(attachment, bound));
|
|
6527
|
+
}
|
|
6528
|
+
}
|
|
6484
6529
|
const projected = [...items];
|
|
6485
6530
|
for (const [index, refs] of refsByIndex) {
|
|
6486
6531
|
const original = items[index];
|
|
@@ -6496,14 +6541,20 @@ function createModelHistoryAttachmentProjector(policy, readFileBytes, loadAuthor
|
|
|
6496
6541
|
const currentFile = catalog ? void 0 : fileById.get(ref.fileId);
|
|
6497
6542
|
const excluded = !catalog && loadAuthorizedFiles !== void 0 && resolvedFileIds.has(ref.fileId) && currentFile === void 0;
|
|
6498
6543
|
const attachment = currentFile ? contentById.get(ref.fileId) : void 0;
|
|
6499
|
-
const receipt = {
|
|
6500
|
-
type: "input_text",
|
|
6501
|
-
text: excluded ? unavailableAttachmentReceiptText(ref) : attachmentReceiptText(ref)
|
|
6502
|
-
};
|
|
6503
6544
|
if (!attachment || attachment.kind !== "image") {
|
|
6504
|
-
return [
|
|
6545
|
+
return [
|
|
6546
|
+
{
|
|
6547
|
+
type: "input_text",
|
|
6548
|
+
text: excluded ? unavailableAttachmentReceiptText(ref) : attachmentReceiptText(ref)
|
|
6549
|
+
}
|
|
6550
|
+
];
|
|
6505
6551
|
}
|
|
6506
|
-
|
|
6552
|
+
const bound = attachmentImageBound(original);
|
|
6553
|
+
const bounded = bound === void 0 ? void 0 : boundedById.get(`${bound}:${ref.fileId}`);
|
|
6554
|
+
return [
|
|
6555
|
+
{ type: "input_text", text: attachmentReceiptText(ref) + (bounded?.note ?? "") },
|
|
6556
|
+
{ type: "input_image", image: bounded?.image ?? attachment.dataUrl }
|
|
6557
|
+
];
|
|
6507
6558
|
});
|
|
6508
6559
|
const clone = {
|
|
6509
6560
|
...original,
|
|
@@ -8540,4 +8591,4 @@ export {
|
|
|
8540
8591
|
codexUsageLimitFailurePayload,
|
|
8541
8592
|
classifyClaudeProviderError
|
|
8542
8593
|
};
|
|
8543
|
-
//# sourceMappingURL=chunk-
|
|
8594
|
+
//# sourceMappingURL=chunk-6SHXF4SU.js.map
|