@sentry/junior 0.287.0 → 0.288.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.
- package/dist/{adapter-CL-HUKgd.js → adapter-Cikcqdty.js} +1 -1
- package/dist/{admin-C9urXVfi.js → admin-BcSxHuTB.js} +2 -2
- package/dist/{agent-runner-Bfnw551N.js → agent-runner-9MXyWUL8.js} +173 -89
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +8 -7
- package/dist/api.d.ts +1 -1
- package/dist/api.js +403 -40
- package/dist/{app-DBY5TnfY.d.ts → app-BUklJVBe.d.ts} +4 -2
- package/dist/app.d.ts +1 -1
- package/dist/app.js +521 -70
- package/dist/{assistant-reply-u_PRYzuz.js → assistant-reply-mj47jMRV.js} +1 -1
- package/dist/{automation-DksGNDRO.js → automation-DDXwHQs5.js} +2 -2
- package/dist/{background-compaction-queue-CYI909P5.js → background-compaction-queue-CjllSPir.js} +161 -90
- package/dist/{briefs-DaXiMWzT.js → briefs-DW9iuolG.js} +4 -3
- package/dist/{catalog-runtime-BCIuBe4d.js → catalog-runtime-B3gfH58M.js} +1 -1
- package/dist/cli/chat.js +14 -14
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{config-CkHcUMN7.js → config-CLJcyYEF.js} +401 -9
- package/dist/{connections-BnIj0wtx.js → connections-BtdJftow.js} +9 -9
- package/dist/{conversation-E7ZPJx2H.js → conversation-DhoqHtQ7.js} +23 -6
- package/dist/{conversation-pending-messages-DVch6YQw.js → conversation-pending-messages-DHV0S4uF.js} +1 -1
- package/dist/{conversation-privacy-DF1hW0ja.js → conversation-privacy-BPirIVlX.js} +1 -1
- package/dist/core-model-BTt5E5b0.js +182 -0
- package/dist/{credential-sync-CzMar9hq.js → credential-sync-Co8Q2xRW.js} +28 -20
- package/dist/{db-DJ11eZqq.js → db-Co7DTYYh.js} +30 -20
- package/dist/{db-YDKKDxlh.d.ts → db-zIs8-Ba3.d.ts} +6 -2
- package/dist/{executor-BY9TB31g.js → executor-m0kIN71Q.js} +93 -12
- package/dist/{media-Cz1ZiV1U.js → history-IjdmO_r6.js} +6 -86
- package/dist/instrumentation.js +2 -2
- package/dist/{logging-BO5zU6Mt.js → logging-DbD-dErY.js} +3 -2
- package/dist/media-BAHvgkok.js +85 -0
- package/dist/{message-CsUbuEc8.js → message-DKTdTYm-.js} +9 -9
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +19 -41
- package/dist/{oauth-callback-server-hiDKK0_n.js → oauth-callback-server-CpbepSbp.js} +2 -2
- package/dist/{projection-CL_YWeGf.js → projection-BViECfYu.js} +309 -616
- package/dist/{prompt-BHOEQSmf.js → prompt-KT6MaDHN.js} +2 -182
- package/dist/{registry-BriFLnaJ.js → registry-D-Acyjhh.js} +1 -1
- package/dist/{resolve-Bt6GgAiA.js → resolve-gkT2R66z.js} +3 -3
- package/dist/{result-Bo1TZu0Q.js → result-DHmCFEt8.js} +8 -8
- package/dist/{runner-D3YeCQgt.js → runner-DBKjGjH-.js} +8 -8
- package/dist/{sandbox-egress-signals-CcnSPP4S.js → sandbox-egress-signals-9n8hqx29.js} +1 -1
- package/dist/{schedule-BTp__wrw.js → schedule-cP0AACm1.js} +11 -2
- package/dist/{schema-C6fsEwjo.d.ts → schema-B_6aOcx5.d.ts} +114 -3
- package/dist/{schema-BWE3RJEB.js → schema-DxicIQbc.js} +66 -13
- package/dist/{service-account-r6fl0b-9.js → service-account-Bi0HsY6w.js} +3 -3
- package/dist/{service-account-DiQQuuw7.js → service-account-CDlC9ssy.js} +3 -3
- package/dist/{session-stop-B2Nut40V.js → session-stop-BWOsuo8p.js} +56 -14
- package/dist/{skills-CD5aJdzg.js → skills-DO5K68Rq.js} +2 -2
- package/dist/{spawn-CalgZQiu.js → spawn-BBqZDcPa.js} +5 -5
- package/dist/{stop-kujZLbi0.js → stop-WC97cmHz.js} +802 -338
- package/dist/{store-DdIEUL1q.js → store-ByR1Lr7e.js} +4 -16
- package/dist/{task-runner-D_RDr2Hu.js → task-runner-B-Ewf8TX.js} +30 -22
- package/dist/{turn-failure-response-B5nV1Er-.js → turn-failure-response-CpdPoZSl.js} +18 -9
- package/dist/{validation-K4pqwoVZ.js → validation-B4sbIoES.js} +1 -1
- package/dist/{version-DBvhk1X9.js → version-D6lpuAgL.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-DrMmFUul.js → viewer-CeP27tC3.js} +4 -4
- package/dist/warmup-P_GJCL1c.js +767 -0
- package/dist/{work-ljRoODGu.js → work-DI7x1Slm.js} +14 -13
- package/dist/{worker-CYO1Q0Js.js → worker-CYPTOT4j.js} +6 -6
- package/migrations/0089_conversation_paused_status.sql +3 -0
- package/migrations/0090_guardian_review_time_index.sql +20 -0
- package/migrations/meta/0089_snapshot.json +4372 -0
- package/migrations/meta/0090_snapshot.json +4388 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +5 -4
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-
|
|
3
|
-
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-
|
|
2
|
+
import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-DbD-dErY.js";
|
|
3
|
+
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-BPirIVlX.js";
|
|
4
4
|
import { AwsClient } from "aws4fetch";
|
|
5
5
|
import { del, get, put } from "@vercel/blob";
|
|
6
6
|
import { calculateCost, completeSimple, getEnvApiKey, getModels, registerApiProvider } from "@earendil-works/pi-ai/compat";
|
|
7
7
|
import { stream as streamAnthropic, streamSimple as streamSimpleAnthropic } from "@earendil-works/pi-ai/api/anthropic-messages";
|
|
8
8
|
import { createGatewayProvider } from "@ai-sdk/gateway";
|
|
9
9
|
import { getVercelOidcToken } from "@vercel/oidc";
|
|
10
|
-
import { Experimental_DecisionRefusalError, NoObjectGeneratedError, embedMany, experimental_decide, generateObject, rerank } from "ai";
|
|
10
|
+
import { Experimental_DecisionRefusalError, NoObjectGeneratedError, embedMany, experimental_decide, generateObject, rerank, transcribe } from "ai";
|
|
11
|
+
import { createHash } from "node:crypto";
|
|
11
12
|
import * as z from "zod";
|
|
12
13
|
// src/chat/optional-string.ts
|
|
13
14
|
/**
|
|
@@ -514,6 +515,354 @@ function hasCompactedConversationContext(messages) {
|
|
|
514
515
|
return content.some((part) => part && typeof part === "object" && part.type === "text" && typeof part.text === "string" && isCompactionSummaryText(part.text));
|
|
515
516
|
});
|
|
516
517
|
}
|
|
518
|
+
// src/chat/services/image-dimensions.ts
|
|
519
|
+
const HEADER_BASE64_CHARS = 65536;
|
|
520
|
+
const READERS = {
|
|
521
|
+
"image/png": readPng,
|
|
522
|
+
"image/jpeg": readJpeg,
|
|
523
|
+
"image/gif": readGif,
|
|
524
|
+
"image/webp": readWebp
|
|
525
|
+
};
|
|
526
|
+
/**
|
|
527
|
+
* Read the pixel size from an image header without decoding the image.
|
|
528
|
+
* Returns undefined when the type is unknown or the header is not valid.
|
|
529
|
+
*/
|
|
530
|
+
function readImageDimensions(image) {
|
|
531
|
+
const read = READERS[image.mimeType.toLowerCase()];
|
|
532
|
+
if (!read) return void 0;
|
|
533
|
+
const prefix = Buffer.from(image.data.slice(0, HEADER_BASE64_CHARS), "base64");
|
|
534
|
+
const canReadMore = read === readJpeg && image.data.length > HEADER_BASE64_CHARS;
|
|
535
|
+
const dimensions = read(prefix) ?? (canReadMore ? read(Buffer.from(image.data, "base64")) : void 0);
|
|
536
|
+
return dimensions && dimensions.width > 0 && dimensions.height > 0 ? dimensions : void 0;
|
|
537
|
+
}
|
|
538
|
+
function hasAscii(bytes, offset, text) {
|
|
539
|
+
return bytes.toString("latin1", offset, offset + text.length) === text;
|
|
540
|
+
}
|
|
541
|
+
function readPng(bytes) {
|
|
542
|
+
if (bytes.length < 24) return void 0;
|
|
543
|
+
if (bytes.readUInt32BE(0) !== 2303741511 || !hasAscii(bytes, 12, "IHDR")) return;
|
|
544
|
+
return {
|
|
545
|
+
width: bytes.readUInt32BE(16),
|
|
546
|
+
height: bytes.readUInt32BE(20)
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
function readGif(bytes) {
|
|
550
|
+
if (bytes.length < 10) return void 0;
|
|
551
|
+
if (!hasAscii(bytes, 0, "GIF87a") && !hasAscii(bytes, 0, "GIF89a")) return;
|
|
552
|
+
return {
|
|
553
|
+
width: bytes.readUInt16LE(6),
|
|
554
|
+
height: bytes.readUInt16LE(8)
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
function readJpeg(bytes) {
|
|
558
|
+
if (bytes.length < 4 || bytes[0] !== 255 || bytes[1] !== 216) return;
|
|
559
|
+
let offset = 2;
|
|
560
|
+
while (offset + 4 <= bytes.length) {
|
|
561
|
+
if (bytes[offset] !== 255) return void 0;
|
|
562
|
+
const marker = bytes[offset + 1];
|
|
563
|
+
if (marker === 255) {
|
|
564
|
+
offset += 1;
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
567
|
+
if (marker === 1 || marker >= 208 && marker <= 215) {
|
|
568
|
+
offset += 2;
|
|
569
|
+
continue;
|
|
570
|
+
}
|
|
571
|
+
const length = bytes.readUInt16BE(offset + 2);
|
|
572
|
+
if (marker >= 192 && marker <= 207 && marker !== 196 && marker !== 200 && marker !== 204) {
|
|
573
|
+
if (offset + 9 > bytes.length) return void 0;
|
|
574
|
+
return {
|
|
575
|
+
height: bytes.readUInt16BE(offset + 5),
|
|
576
|
+
width: bytes.readUInt16BE(offset + 7)
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
if (length < 2) return void 0;
|
|
580
|
+
offset += 2 + length;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
function readWebp(bytes) {
|
|
584
|
+
if (bytes.length < 30) return void 0;
|
|
585
|
+
if (!hasAscii(bytes, 0, "RIFF") || !hasAscii(bytes, 8, "WEBP")) return;
|
|
586
|
+
if (hasAscii(bytes, 12, "VP8 ")) {
|
|
587
|
+
if (bytes.readUIntBE(23, 3) !== 10289450) return void 0;
|
|
588
|
+
return {
|
|
589
|
+
width: bytes.readUInt16LE(26) & 16383,
|
|
590
|
+
height: bytes.readUInt16LE(28) & 16383
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
if (hasAscii(bytes, 12, "VP8L")) {
|
|
594
|
+
if (bytes[20] !== 47) return void 0;
|
|
595
|
+
const bits = bytes.readUInt32LE(21);
|
|
596
|
+
return {
|
|
597
|
+
width: (bits & 16383) + 1,
|
|
598
|
+
height: (bits >>> 14 & 16383) + 1
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
if (hasAscii(bytes, 12, "VP8X")) return {
|
|
602
|
+
width: bytes.readUIntLE(24, 3) + 1,
|
|
603
|
+
height: bytes.readUIntLE(27, 3) + 1
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
// src/chat/services/token-estimate.ts
|
|
607
|
+
const CLAUDE_TOKEN_ESTIMATE = {
|
|
608
|
+
charsPerToken: 2.5,
|
|
609
|
+
toolResultOverheadTokens: 150
|
|
610
|
+
};
|
|
611
|
+
const DEFAULT_TOKEN_ESTIMATE = {
|
|
612
|
+
charsPerToken: 4,
|
|
613
|
+
toolResultOverheadTokens: 0
|
|
614
|
+
};
|
|
615
|
+
const IMAGE_CHARS = 4800;
|
|
616
|
+
const CLAUDE_HIGH_RES_IMAGE = {
|
|
617
|
+
maxEdge: 2576,
|
|
618
|
+
maxTokens: 4784
|
|
619
|
+
};
|
|
620
|
+
const CLAUDE_STANDARD_IMAGE = {
|
|
621
|
+
maxEdge: 1568,
|
|
622
|
+
maxTokens: 1568
|
|
623
|
+
};
|
|
624
|
+
const CLAUDE_STANDARD_IMAGE_MODEL = /^anthropic\/claude-(?:3\b|[a-z]+-4(?:\.[0-6])?(?![.\d]))/;
|
|
625
|
+
const CLAUDE_IMAGE_PATCH_PX = 28;
|
|
626
|
+
function getTokenEstimateProfile(modelId) {
|
|
627
|
+
return modelId.startsWith("anthropic/") ? CLAUDE_TOKEN_ESTIMATE : DEFAULT_TOKEN_ESTIMATE;
|
|
628
|
+
}
|
|
629
|
+
function tokensForChars(chars, profile) {
|
|
630
|
+
return Math.ceil(chars / profile.charsPerToken);
|
|
631
|
+
}
|
|
632
|
+
function messageChars(message) {
|
|
633
|
+
switch (message.role) {
|
|
634
|
+
case "user":
|
|
635
|
+
case "toolResult": return contentChars(message.content);
|
|
636
|
+
case "assistant": {
|
|
637
|
+
let chars = 0;
|
|
638
|
+
for (const block of message.content) if (block.type === "text") chars += block.text.length;
|
|
639
|
+
else if (block.type === "thinking") chars += block.thinking.length;
|
|
640
|
+
else chars += block.name.length + JSON.stringify(block.arguments).length;
|
|
641
|
+
return chars;
|
|
642
|
+
}
|
|
643
|
+
default: return 0;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
function contentChars(content) {
|
|
647
|
+
if (typeof content === "string") return content.length;
|
|
648
|
+
return content.reduce((chars, block) => chars + (block.type === "text" ? block.text.length : 0), 0);
|
|
649
|
+
}
|
|
650
|
+
function messageImages(message) {
|
|
651
|
+
if (message.role !== "user" && message.role !== "toolResult") return [];
|
|
652
|
+
if (typeof message.content === "string") return [];
|
|
653
|
+
return message.content.filter((block) => block.type === "image");
|
|
654
|
+
}
|
|
655
|
+
function claudeImagePatches(width, height) {
|
|
656
|
+
return Math.ceil(width / CLAUDE_IMAGE_PATCH_PX) * Math.ceil(height / CLAUDE_IMAGE_PATCH_PX);
|
|
657
|
+
}
|
|
658
|
+
function roundHalfToEven(value) {
|
|
659
|
+
const floor = Math.floor(value);
|
|
660
|
+
if (value - floor !== .5) return Math.round(value);
|
|
661
|
+
return floor % 2 === 0 ? floor : floor + 1;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* The size Claude resizes an image to before it counts patches. This is the
|
|
665
|
+
* reference implementation in "How Claude resizes and pads images" in
|
|
666
|
+
* https://platform.claude.com/docs/en/build-with-claude/vision-coordinates:
|
|
667
|
+
* the largest aspect-preserving size whose padded edges and patch count fit
|
|
668
|
+
* the tier limits.
|
|
669
|
+
*/
|
|
670
|
+
function claudeResizedImageSize(width, height, limits) {
|
|
671
|
+
const fits = (w, h) => Math.ceil(w / CLAUDE_IMAGE_PATCH_PX) * CLAUDE_IMAGE_PATCH_PX <= limits.maxEdge && Math.ceil(h / CLAUDE_IMAGE_PATCH_PX) * CLAUDE_IMAGE_PATCH_PX <= limits.maxEdge && claudeImagePatches(w, h) <= limits.maxTokens;
|
|
672
|
+
if (fits(width, height)) return [width, height];
|
|
673
|
+
if (height > width) {
|
|
674
|
+
const [resizedHeight, resizedWidth] = claudeResizedImageSize(height, width, limits);
|
|
675
|
+
return [resizedWidth, resizedHeight];
|
|
676
|
+
}
|
|
677
|
+
const aspectRatio = width / height;
|
|
678
|
+
const shortEdge = (longEdge) => Math.max(roundHalfToEven(longEdge / aspectRatio), 1);
|
|
679
|
+
let low = 1;
|
|
680
|
+
let high = width;
|
|
681
|
+
while (low + 1 < high) {
|
|
682
|
+
const mid = Math.floor((low + high) / 2);
|
|
683
|
+
if (fits(mid, shortEdge(mid))) low = mid;
|
|
684
|
+
else high = mid;
|
|
685
|
+
}
|
|
686
|
+
return [low, shortEdge(low)];
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Estimate one image for a model with the rule that `estimateMessagesTokens`
|
|
690
|
+
* uses. `sized` is false when the image used the flat per-image value.
|
|
691
|
+
*/
|
|
692
|
+
function estimateImageTokens(image, modelId) {
|
|
693
|
+
const dimensions = modelId.startsWith("anthropic/") ? readImageDimensions(image) : void 0;
|
|
694
|
+
if (!dimensions) return {
|
|
695
|
+
tokens: tokensForChars(IMAGE_CHARS, getTokenEstimateProfile(modelId)),
|
|
696
|
+
sized: false
|
|
697
|
+
};
|
|
698
|
+
const limits = CLAUDE_STANDARD_IMAGE_MODEL.test(modelId) ? CLAUDE_STANDARD_IMAGE : CLAUDE_HIGH_RES_IMAGE;
|
|
699
|
+
const [width, height] = claudeResizedImageSize(dimensions.width, dimensions.height, limits);
|
|
700
|
+
return {
|
|
701
|
+
tokens: claudeImagePatches(width, height),
|
|
702
|
+
sized: true
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
/** Estimate text tokens for local budgets that have no model. */
|
|
706
|
+
function estimateTextTokens(text) {
|
|
707
|
+
return tokensForChars(text.length, DEFAULT_TOKEN_ESTIMATE);
|
|
708
|
+
}
|
|
709
|
+
/** Convert a local text token budget to the characters it allows. */
|
|
710
|
+
function textCharsForTokens(tokens) {
|
|
711
|
+
return tokens * DEFAULT_TOKEN_ESTIMATE.charsPerToken;
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Estimate messages from their text size at the model's characters per token,
|
|
715
|
+
* plus the tokens of each image.
|
|
716
|
+
*/
|
|
717
|
+
function estimateMessagesTokens(messages, modelId) {
|
|
718
|
+
const profile = getTokenEstimateProfile(modelId);
|
|
719
|
+
return messages.reduce((total, message) => {
|
|
720
|
+
const overhead = message.role === "toolResult" ? profile.toolResultOverheadTokens : 0;
|
|
721
|
+
const images = messageImages(message).reduce((tokens, image) => tokens + estimateImageTokens(image, modelId).tokens, 0);
|
|
722
|
+
return total + tokensForChars(messageChars(message), profile) + images + overhead;
|
|
723
|
+
}, 0);
|
|
724
|
+
}
|
|
725
|
+
/** Estimate the tokens that the system prompt and tool definitions add to a model request. */
|
|
726
|
+
function estimateRequestOverheadTokens(systemPrompt, tools, modelId) {
|
|
727
|
+
const definitions = tools.map(({ name, description, parameters }) => ({
|
|
728
|
+
name,
|
|
729
|
+
description,
|
|
730
|
+
parameters
|
|
731
|
+
}));
|
|
732
|
+
return tokensForChars(systemPrompt.length + JSON.stringify(definitions).length, getTokenEstimateProfile(modelId));
|
|
733
|
+
}
|
|
734
|
+
// src/chat/pi/request-prefix-attributes.ts
|
|
735
|
+
const HASH_HEX_CHARS = 16;
|
|
736
|
+
const MESSAGE_SEPARATOR = "\n";
|
|
737
|
+
function withoutCacheControl(key, value) {
|
|
738
|
+
return key === "cache_control" ? void 0 : value;
|
|
739
|
+
}
|
|
740
|
+
function canonicalMessageValue(key, value) {
|
|
741
|
+
if (key === "content" && typeof value === "string") return [{
|
|
742
|
+
type: "text",
|
|
743
|
+
text: value
|
|
744
|
+
}];
|
|
745
|
+
return withoutCacheControl(key, value);
|
|
746
|
+
}
|
|
747
|
+
function digest(hash) {
|
|
748
|
+
return hash.digest("hex").slice(0, HASH_HEX_CHARS);
|
|
749
|
+
}
|
|
750
|
+
function hashJson(value, replacer = withoutCacheControl) {
|
|
751
|
+
return digest(createHash("sha256").update(JSON.stringify(value, replacer)));
|
|
752
|
+
}
|
|
753
|
+
function lastAssistantIndex(messages) {
|
|
754
|
+
for (let index = messages.length - 1; index >= 0; index--) {
|
|
755
|
+
const message = messages[index];
|
|
756
|
+
if (typeof message === "object" && message !== null && message.role === "assistant") return index;
|
|
757
|
+
}
|
|
758
|
+
return -1;
|
|
759
|
+
}
|
|
760
|
+
function messagesHashes(messages) {
|
|
761
|
+
const lastReply = lastAssistantIndex(messages);
|
|
762
|
+
const hash = createHash("sha256");
|
|
763
|
+
let beforeLastReply;
|
|
764
|
+
for (const [index, message] of messages.entries()) {
|
|
765
|
+
if (index === lastReply) beforeLastReply = digest(hash.copy());
|
|
766
|
+
hash.update(JSON.stringify(message, canonicalMessageValue)).update(MESSAGE_SEPARATOR);
|
|
767
|
+
}
|
|
768
|
+
return {
|
|
769
|
+
full: digest(hash),
|
|
770
|
+
beforeLastReply
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
function sortedKeys(_key, value) {
|
|
774
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return value;
|
|
775
|
+
return Object.fromEntries(Object.entries(value).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
|
|
776
|
+
}
|
|
777
|
+
function prefixHash(parts) {
|
|
778
|
+
return digest(createHash("sha256").update(parts.map((part) => part ?? "").join("\n")));
|
|
779
|
+
}
|
|
780
|
+
function readableString(value, key) {
|
|
781
|
+
if (typeof value !== "object" || value === null) return;
|
|
782
|
+
const field = value[key];
|
|
783
|
+
return typeof field === "string" ? field : void 0;
|
|
784
|
+
}
|
|
785
|
+
function requestImages(messages) {
|
|
786
|
+
const images = [];
|
|
787
|
+
const visit = (content) => {
|
|
788
|
+
if (!Array.isArray(content)) return;
|
|
789
|
+
for (const block of content) {
|
|
790
|
+
if (typeof block !== "object" || block === null) continue;
|
|
791
|
+
const { type, source, content: nested } = block;
|
|
792
|
+
if (type === "image") images.push({
|
|
793
|
+
type: "image",
|
|
794
|
+
data: readableString(source, "data") ?? "",
|
|
795
|
+
mimeType: readableString(source, "media_type") ?? ""
|
|
796
|
+
});
|
|
797
|
+
else if (type === "tool_result") visit(nested);
|
|
798
|
+
}
|
|
799
|
+
};
|
|
800
|
+
for (const message of messages) visit(message?.content);
|
|
801
|
+
return images;
|
|
802
|
+
}
|
|
803
|
+
function imageAttributes(messages, model) {
|
|
804
|
+
const images = Array.isArray(messages) ? requestImages(messages) : [];
|
|
805
|
+
if (images.length === 0) return {};
|
|
806
|
+
const modelId = typeof model === "string" ? model : "";
|
|
807
|
+
let estimate = 0;
|
|
808
|
+
let unsized = 0;
|
|
809
|
+
for (const image of images) {
|
|
810
|
+
const { tokens, sized } = estimateImageTokens(image, modelId);
|
|
811
|
+
estimate += tokens;
|
|
812
|
+
if (!sized) unsized += 1;
|
|
813
|
+
}
|
|
814
|
+
return {
|
|
815
|
+
"app.ai.request.images.count": images.length,
|
|
816
|
+
"app.ai.request.images.estimate": estimate,
|
|
817
|
+
"app.ai.request.images.unsized": unsized
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
function payloadAttributes(payload) {
|
|
821
|
+
const { model, system, tools, messages, thinking, output_config } = payload;
|
|
822
|
+
const systemHash = system !== void 0 ? hashJson(system) : void 0;
|
|
823
|
+
const toolsHash = Array.isArray(tools) ? hashJson(tools) : void 0;
|
|
824
|
+
const messagesHash = Array.isArray(messages) ? messagesHashes(messages) : void 0;
|
|
825
|
+
const settingsHash = hashJson({
|
|
826
|
+
thinking,
|
|
827
|
+
output_config
|
|
828
|
+
}, sortedKeys);
|
|
829
|
+
const prefixParts = [
|
|
830
|
+
typeof model === "string" ? model : void 0,
|
|
831
|
+
settingsHash,
|
|
832
|
+
toolsHash,
|
|
833
|
+
systemHash
|
|
834
|
+
];
|
|
835
|
+
const thinkingType = readableString(thinking, "type");
|
|
836
|
+
const effort = readableString(output_config, "effort");
|
|
837
|
+
return {
|
|
838
|
+
...systemHash ? { "app.ai.request.system_instructions.hash": systemHash } : void 0,
|
|
839
|
+
"app.ai.request.tools.count": Array.isArray(tools) ? tools.length : 0,
|
|
840
|
+
...toolsHash ? { "app.ai.request.tools.hash": toolsHash } : void 0,
|
|
841
|
+
...Array.isArray(messages) ? { "app.ai.request.messages.count": messages.length } : void 0,
|
|
842
|
+
...messagesHash ? { "app.ai.request.messages.hash": messagesHash.full } : void 0,
|
|
843
|
+
...messagesHash?.beforeLastReply ? { "app.ai.request.messages.before_last_reply.hash": messagesHash.beforeLastReply } : void 0,
|
|
844
|
+
"app.ai.request.prefix.hash": prefixHash([...prefixParts, messagesHash?.full]),
|
|
845
|
+
...messagesHash?.beforeLastReply ? { "app.ai.request.prefix.before_last_reply.hash": prefixHash([...prefixParts, messagesHash.beforeLastReply]) } : void 0,
|
|
846
|
+
...thinkingType ? { "app.ai.request.thinking.type": thinkingType } : void 0,
|
|
847
|
+
...effort ? { "app.ai.request.effort": effort } : void 0,
|
|
848
|
+
...imageAttributes(messages, model)
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* Hashes of the cache prefix parts of one provider request body, plus its
|
|
853
|
+
* thinking and effort settings, to tell a changed cache prefix apart from an
|
|
854
|
+
* expired cache. Also counts and estimates the request's images.
|
|
855
|
+
* Pass the payload that Pi gives to `onPayload`. Never throws: telemetry must
|
|
856
|
+
* not fail the request.
|
|
857
|
+
*/
|
|
858
|
+
function requestPrefixAttributes(payload) {
|
|
859
|
+
if (typeof payload !== "object" || payload === null) return {};
|
|
860
|
+
try {
|
|
861
|
+
return payloadAttributes(payload);
|
|
862
|
+
} catch {
|
|
863
|
+
return {};
|
|
864
|
+
}
|
|
865
|
+
}
|
|
517
866
|
// src/chat/pi/client.ts
|
|
518
867
|
registerApiProvider({
|
|
519
868
|
api: "anthropic-messages",
|
|
@@ -629,6 +978,7 @@ const GEN_AI_OPERATION_CHAT = "chat";
|
|
|
629
978
|
const GEN_AI_OPERATION_EMBEDDINGS = "embeddings";
|
|
630
979
|
const GEN_AI_OPERATION_RERANK = "rerank";
|
|
631
980
|
const GEN_AI_OPERATION_DECIDE = "decide";
|
|
981
|
+
const GEN_AI_OPERATION_TRANSCRIPTION = "transcription";
|
|
632
982
|
const EMBEDDING_INPUT_COST_USD_PER_MILLION_TOKENS = {
|
|
633
983
|
"cohere/embed-v4.0": .12,
|
|
634
984
|
"google/gemini-embedding-001": .15,
|
|
@@ -710,7 +1060,8 @@ async function completeText(params) {
|
|
|
710
1060
|
try {
|
|
711
1061
|
message = await completeSimple(model, {
|
|
712
1062
|
systemPrompt: params.system,
|
|
713
|
-
messages: params.messages
|
|
1063
|
+
messages: params.messages,
|
|
1064
|
+
...params.tools ? { tools: params.tools } : void 0
|
|
714
1065
|
}, {
|
|
715
1066
|
apiKey,
|
|
716
1067
|
temperature: params.temperature,
|
|
@@ -718,7 +1069,11 @@ async function completeText(params) {
|
|
|
718
1069
|
reasoning: params.thinkingLevel,
|
|
719
1070
|
cacheRetention: params.cacheRetention,
|
|
720
1071
|
signal: params.signal,
|
|
721
|
-
metadata: params.metadata
|
|
1072
|
+
metadata: params.metadata,
|
|
1073
|
+
sessionId: params.sessionId,
|
|
1074
|
+
onPayload: (payload) => {
|
|
1075
|
+
setSpanAttributes(requestPrefixAttributes(payload));
|
|
1076
|
+
}
|
|
722
1077
|
});
|
|
723
1078
|
} catch (error) {
|
|
724
1079
|
throw createProviderError(error, { modelId: params.modelId });
|
|
@@ -1008,6 +1363,39 @@ async function rerankTexts(params) {
|
|
|
1008
1363
|
throw providerError;
|
|
1009
1364
|
}
|
|
1010
1365
|
}
|
|
1366
|
+
/** Transcribe one recorded audio clip through AI Gateway. */
|
|
1367
|
+
async function transcribeAudio(params) {
|
|
1368
|
+
const credential = await resolveGatewayCredential();
|
|
1369
|
+
const provider = createGatewayProvider({ apiKey: credential.token });
|
|
1370
|
+
try {
|
|
1371
|
+
return await withSpan(`${GEN_AI_OPERATION_TRANSCRIPTION} ${params.modelId}`, "gen_ai.transcription", { modelId: params.modelId }, async (setSpanAttributes) => {
|
|
1372
|
+
const result = await transcribe({
|
|
1373
|
+
model: provider.transcriptionModel(params.modelId),
|
|
1374
|
+
audio: params.audio,
|
|
1375
|
+
...params.signal !== void 0 ? { abortSignal: params.signal } : void 0
|
|
1376
|
+
});
|
|
1377
|
+
if (result.durationInSeconds !== void 0) setSpanAttributes({ "app.transcription.audio_seconds": result.durationInSeconds });
|
|
1378
|
+
return { text: result.text };
|
|
1379
|
+
}, {
|
|
1380
|
+
"gen_ai.provider.name": GEN_AI_PROVIDER_NAME,
|
|
1381
|
+
"gen_ai.operation.name": GEN_AI_OPERATION_TRANSCRIPTION,
|
|
1382
|
+
"gen_ai.request.model": params.modelId,
|
|
1383
|
+
"server.address": GEN_AI_SERVER_ADDRESS,
|
|
1384
|
+
"server.port": 443,
|
|
1385
|
+
"gen_ai.provider.auth_mode": credential.mode,
|
|
1386
|
+
"app.transcription.audio_bytes": params.audio.byteLength
|
|
1387
|
+
});
|
|
1388
|
+
} catch (error) {
|
|
1389
|
+
const providerError = createProviderError(error, { modelId: params.modelId });
|
|
1390
|
+
logException(providerError, "ai.transcription.failed", {
|
|
1391
|
+
...getProviderErrorAttributes(providerError),
|
|
1392
|
+
"gen_ai.provider.name": GEN_AI_PROVIDER_NAME,
|
|
1393
|
+
"gen_ai.operation.name": GEN_AI_OPERATION_TRANSCRIPTION,
|
|
1394
|
+
"gen_ai.request.model": params.modelId
|
|
1395
|
+
});
|
|
1396
|
+
throw providerError;
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1011
1399
|
// src/chat/slack/emoji.ts
|
|
1012
1400
|
const SLACK_EMOJI_NAME_RE = /^(?:[a-z0-9_+-]+)(?:::(?:skin-tone-[2-6]))?$/;
|
|
1013
1401
|
function normalizeSlackEmojiName(value) {
|
|
@@ -1143,11 +1531,11 @@ function parseOptionalPositiveInteger(envName, rawValue) {
|
|
|
1143
1531
|
if (!Number.isSafeInteger(value) || value <= 0 || String(value) !== trimmed) throw new Error(`${envName} must be a positive integer`);
|
|
1144
1532
|
return value;
|
|
1145
1533
|
}
|
|
1146
|
-
function
|
|
1534
|
+
function parseKillSwitch(name, rawValue) {
|
|
1147
1535
|
const value = toOptionalTrimmed(rawValue)?.toLowerCase();
|
|
1148
1536
|
if (value === void 0 || value === "true") return true;
|
|
1149
1537
|
if (value === "false") return false;
|
|
1150
|
-
throw new Error(
|
|
1538
|
+
throw new Error(`${name} must be true or false`);
|
|
1151
1539
|
}
|
|
1152
1540
|
const DEFAULT_MODEL_ID = resolveGatewayModel("anthropic/claude-opus-5.5").id;
|
|
1153
1541
|
const DEFAULT_REASONING_LEVEL = "high";
|
|
@@ -1158,6 +1546,7 @@ const DEFAULT_DECISION_MODEL_ID = "typesafe-ai/jev";
|
|
|
1158
1546
|
const DEFAULT_EMBEDDING_MODEL_ID = "openai/text-embedding-3-small";
|
|
1159
1547
|
const DEFAULT_RERANKING_MODEL_ID = "voyage/rerank-2.5-lite";
|
|
1160
1548
|
const DEFAULT_IMAGE_GENERATION_MODEL_ID = "openai/gpt-image-2";
|
|
1549
|
+
const DEFAULT_TRANSCRIPTION_MODEL_ID = "spacexai/grok-stt";
|
|
1161
1550
|
const DEFAULT_VISION_MODEL_ID = resolveGatewayModel("openai/gpt-5.6-sol").id;
|
|
1162
1551
|
function validateGatewayModelId(raw) {
|
|
1163
1552
|
const trimmed = toOptionalTrimmed(raw);
|
|
@@ -1195,6 +1584,7 @@ function readBotConfig(env, functionMaxDurationSeconds) {
|
|
|
1195
1584
|
fastModelId,
|
|
1196
1585
|
guardianModelId,
|
|
1197
1586
|
imageGenerationModelId: toOptionalTrimmed(env.AI_IMAGE_MODEL) ?? DEFAULT_IMAGE_GENERATION_MODEL_ID,
|
|
1587
|
+
transcriptionModelId: toOptionalTrimmed(env.AI_TRANSCRIPTION_MODEL) ?? DEFAULT_TRANSCRIPTION_MODEL_ID,
|
|
1198
1588
|
embeddingModelId: validateEmbeddingModelId(env.AI_EMBEDDING_MODEL) ?? DEFAULT_EMBEDDING_MODEL_ID,
|
|
1199
1589
|
rerankingModelId: toOptionalTrimmed(env.AI_RERANKING_MODEL) ?? DEFAULT_RERANKING_MODEL_ID,
|
|
1200
1590
|
loadingMessages: parseLoadingMessages(env.JUNIOR_LOADING_MESSAGES),
|
|
@@ -1248,7 +1638,8 @@ function readChatConfig(env = process.env, functionMaxDurationSeconds = DEFAULT_
|
|
|
1248
1638
|
bot: readBotConfig(env, resolvedFunctionMaxDurationSeconds),
|
|
1249
1639
|
queue: readQueueConfig(env),
|
|
1250
1640
|
functionMaxDurationSeconds: resolvedFunctionMaxDurationSeconds,
|
|
1251
|
-
|
|
1641
|
+
cacheWarmingEnabled: parseKillSwitch("JUNIOR_CACHE_WARMING_ENABLED", env.JUNIOR_CACHE_WARMING_ENABLED),
|
|
1642
|
+
conversationWorkEnabled: parseKillSwitch("JUNIOR_CONVERSATION_WORK_ENABLED", env.JUNIOR_CONVERSATION_WORK_ENABLED),
|
|
1252
1643
|
conversationWorkSoftYieldAfterMs: resolveConversationWorkSoftYieldAfterMs(resolvedFunctionMaxDurationSeconds),
|
|
1253
1644
|
sql: {
|
|
1254
1645
|
databaseUrl,
|
|
@@ -1359,6 +1750,7 @@ function setBotModelConfig(config) {
|
|
|
1359
1750
|
if (config.guardianModelId !== void 0) botConfig.guardianModelId = requireModelId("guardianModelId", config.guardianModelId, validateGatewayModelId);
|
|
1360
1751
|
if (config.rerankingModelId !== void 0) botConfig.rerankingModelId = requireModelId("rerankingModelId", config.rerankingModelId, toOptionalTrimmed);
|
|
1361
1752
|
if (config.imageGenerationModelId !== void 0) botConfig.imageGenerationModelId = requireModelId("imageGenerationModelId", config.imageGenerationModelId, validateEmbeddingModelId);
|
|
1753
|
+
if (config.transcriptionModelId !== void 0) botConfig.transcriptionModelId = requireModelId("transcriptionModelId", config.transcriptionModelId, toOptionalTrimmed);
|
|
1362
1754
|
if (config.visionModelId !== void 0) botConfig.visionModelId = requireModelId("visionModelId", config.visionModelId, validateGatewayModelId);
|
|
1363
1755
|
if (config.webSearchModelId !== void 0) botConfig.webSearchModelId = requireModelId("webSearchModelId", config.webSearchModelId, validateGatewayModelId);
|
|
1364
1756
|
}
|
|
@@ -1367,4 +1759,4 @@ function setSlackReactionConfig(overrides) {
|
|
|
1367
1759
|
if (overrides.processingReactionEmoji !== void 0) chatConfig.slack.processingReactionEmoji = parseReactionEmoji("processingReactionEmoji", overrides.processingReactionEmoji, chatConfig.slack.processingReactionEmoji);
|
|
1368
1760
|
if (overrides.completedReactionEmoji !== void 0) chatConfig.slack.completedReactionEmoji = parseReactionEmoji("completedReactionEmoji", overrides.completedReactionEmoji, chatConfig.slack.completedReactionEmoji);
|
|
1369
1761
|
}
|
|
1370
|
-
export {
|
|
1762
|
+
export { estimateRequestOverheadTokens as A, ProviderError as B, completeText as C, transcribeAudio as D, resolveGatewayModel as E, isCompactionSummaryText as F, isProviderRetryError as G, findProviderError as H, renderCurrentInstruction as I, getAttachmentStorage as J, getGatewayApiKey as K, unwrapCurrentInstruction as L, textCharsForTokens as M, COMPACTION_SUMMARY_PREFIX as N, requestPrefixAttributes as O, hasCompactedConversationContext as P, escapeXml as R, completeObject as S, rerankTexts as T, getProviderErrorAttributes as U, createProviderError as V, getProviderErrorUserMessage as W, toOptionalTrimmed as Y, toPiReasoningLevel as _, getRuntimeMetadata as a, GEN_AI_SERVER_ADDRESS as b, getSlackClientSecret as c, restoreRuntimeConfig as d, setBotModelConfig as f, TURN_REASONING_LEVELS as g, snapshotRuntimeConfig as h, getChatConfig as i, estimateTextTokens as j, estimateMessagesTokens as k, getSlackSigningSecret as l, setSlackReactionConfig as m, botConfig as n, getSlackBotToken as o, setRuntimeLimits as p, resolveGatewayCredential as q, config_exports as r, getSlackClientId as s, DEFAULT_SQL_STATEMENT_TIMEOUT_MS as t, resetRuntimeConfig as u, normalizeSlackEmojiName as v, embedTexts as w, completeDecision as x, GEN_AI_PROVIDER_NAME as y, escapeXmlText as z };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import { A as deleteProviderIdentityForUser, a as getConversationStore, k as deleteProviderIdentityForSlackUser, r as getConversationEventStore, s as getSqlExecutor } from "./db-
|
|
4
|
-
import { u as hasRequiredOAuthScope } from "./registry-
|
|
5
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
6
|
-
import { c as deleteMcpServerSessionId, l as deleteMcpStoredOAuthCredentials, s as deleteMcpAuthSessionsForUserProvider } from "./agent-runner-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { mt as resolveTurnSessionRouting } from "./task-runner-
|
|
1
|
+
import { Mi as startOAuthFlow, et as loadTurnCheckpoint, ot as failTurnRecord, st as getTurnRecord } from "./projection-BViECfYu.js";
|
|
2
|
+
import { n as botConfig } from "./config-CLJcyYEF.js";
|
|
3
|
+
import { A as deleteProviderIdentityForUser, a as getConversationStore, k as deleteProviderIdentityForSlackUser, r as getConversationEventStore, s as getSqlExecutor } from "./db-Co7DTYYh.js";
|
|
4
|
+
import { u as hasRequiredOAuthScope } from "./registry-D-Acyjhh.js";
|
|
5
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-B3gfH58M.js";
|
|
6
|
+
import { c as deleteMcpServerSessionId, l as deleteMcpStoredOAuthCredentials, s as deleteMcpAuthSessionsForUserProvider } from "./agent-runner-9MXyWUL8.js";
|
|
7
|
+
import { g as getVercelConversationWorkQueue } from "./background-compaction-queue-CjllSPir.js";
|
|
8
|
+
import { S as requestConversationWork, m as ensureConversationWake } from "./store-ByR1Lr7e.js";
|
|
9
|
+
import { mt as resolveTurnSessionRouting } from "./task-runner-B-Ewf8TX.js";
|
|
10
10
|
import { randomBytes } from "node:crypto";
|
|
11
11
|
import * as z from "zod";
|
|
12
12
|
// src/chat/task-execution/authorized-turn.ts
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as conversationTurnFailureReasonSchema, h as usageSchema, i as conversationTurnFailureCodeSchema } from "./history-IjdmO_r6.js";
|
|
2
|
+
import { n as INPUT_IMAGE_TYPES } from "./media-BAHvgkok.js";
|
|
2
3
|
import * as z from "zod";
|
|
3
4
|
import { codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, objectFactFields, objectTypeSchema } from "@sentry/junior-plugin-api";
|
|
4
5
|
// src/chat/briefs/schema.ts
|
|
@@ -135,11 +136,15 @@ function parseBriefInput(input) {
|
|
|
135
136
|
/** Bound JSON image input below the hosting platform's request size limit. */
|
|
136
137
|
const MAX_INPUT_IMAGE_BYTES = 3145728;
|
|
137
138
|
const MAX_INPUT_IMAGES = 3;
|
|
139
|
+
/** Base64 file bytes in a JSON request body, up to `maxBytes` once decoded. */
|
|
140
|
+
function base64DataSchema(maxBytes) {
|
|
141
|
+
return z.string().min(4).max(maxBytes * 4 / 3).regex(/^[A-Za-z0-9+/]*={0,2}$/).refine((data) => data.length % 4 === 0);
|
|
142
|
+
}
|
|
138
143
|
/** Image bytes accepted with a web message, never stored in its mailbox row. */
|
|
139
144
|
const inputImageSchema = z.object({
|
|
140
145
|
filename: z.string().trim().min(1).max(255),
|
|
141
146
|
contentType: z.enum(INPUT_IMAGE_TYPES),
|
|
142
|
-
data:
|
|
147
|
+
data: base64DataSchema(MAX_INPUT_IMAGE_BYTES)
|
|
143
148
|
}).strict();
|
|
144
149
|
/** Safe attachment facts shared by mailbox input and transcript messages. */
|
|
145
150
|
const messageAttachmentSchema = z.object({
|
|
@@ -274,6 +279,15 @@ const conversationReadPositionSchema = z.object({ lastReadSeq: z.number().int().
|
|
|
274
279
|
* flag from this, so it does not refetch the feed after each report.
|
|
275
280
|
*/
|
|
276
281
|
const conversationReadReportSchema = conversationReadPositionSchema.extend({ unreadReply: z.boolean() }).strict();
|
|
282
|
+
// src/api/schema/conversation-title.ts
|
|
283
|
+
/** Longest Conversation title that a rename can save. */
|
|
284
|
+
const CONVERSATION_TITLE_MAX_LENGTH = 200;
|
|
285
|
+
/** A Conversation title that a caller chooses, at creation or on rename. */
|
|
286
|
+
const conversationTitleSchema = z.string().trim().min(1).max(200);
|
|
287
|
+
/** A participant's new title for one Conversation. Every viewer sees it. */
|
|
288
|
+
const renameConversationBodySchema = z.object({ title: conversationTitleSchema }).strict();
|
|
289
|
+
/** The stored title after the rename. */
|
|
290
|
+
const renameConversationResponseSchema = z.object({ title: z.string().min(1) }).strict();
|
|
277
291
|
// src/api/schema/child-agent-totals.ts
|
|
278
292
|
/**
|
|
279
293
|
* The part of a Conversation total that its child agents spent, at any depth.
|
|
@@ -367,9 +381,12 @@ const createConversationMessageBodySchema = z.object({
|
|
|
367
381
|
message: z.string().trim().max(32e3),
|
|
368
382
|
images: z.array(inputImageSchema).max(3).optional()
|
|
369
383
|
}).strict().refine((body) => Boolean(body.message || body.images?.length), "Add a message or an image.").refine((body) => (body.images ?? []).reduce((sum, image) => sum + image.data.length, 0) <= MAX_INPUT_IMAGE_BYTES * 4 / 3, "Images must total 3 MB or less.");
|
|
370
|
-
const createConversationBodySchema = createConversationMessageBodySchema.safeExtend({
|
|
371
|
-
/**
|
|
372
|
-
|
|
384
|
+
const createConversationBodySchema = createConversationMessageBodySchema.safeExtend({
|
|
385
|
+
/** Saved title. Title generation runs only when it is omitted. */
|
|
386
|
+
title: conversationTitleSchema.optional(),
|
|
387
|
+
/** New roots default public. Private roots stay participant-only. */
|
|
388
|
+
visibility: z.enum(["private", "public"]).optional()
|
|
389
|
+
});
|
|
373
390
|
const acceptedConversationMessageSchema = z.object({
|
|
374
391
|
conversationId: z.string().min(1),
|
|
375
392
|
messageId: z.string().min(1),
|
|
@@ -942,4 +959,4 @@ const conversationFeedSchema = z.object({
|
|
|
942
959
|
source: z.literal("conversation_index"),
|
|
943
960
|
generatedAt: z.string()
|
|
944
961
|
}).strict();
|
|
945
|
-
export {
|
|
962
|
+
export { renameConversationBodySchema as A, resolveMessageCards as B, createConversationBodySchema as C, conversationChildAgentTotalsSchema as D, forkConversationResponseSchema as E, annotationCard as F, readMessageAttachments as G, MAX_INPUT_IMAGE_BYTES as H, messageCardRef as I, briefOutcomeStatusSchema as J, briefCodeChangeSchema as K, messageCardText as L, conversationReadPositionSchema as M, conversationReadReportSchema as N, CONVERSATION_TITLE_MAX_LENGTH as O, reviewItemChangeRecordSchema as P, parseStoredBrief as Q, readMessageCardRefs as R, conversationUsageSchema as S, forkConversationBodySchema as T, base64DataSchema as U, MAX_INPUT_IMAGES as V, messageAttachmentSchema as W, conversationBriefSchema as X, briefResourceLabel as Y, parseBriefInput as Z, conversationReportEventSchema as _, conversationActivityPreviewSchema as a, conversationSummaryReportSchema as b, conversationDetailQuerySchema as c, conversationEventPageSchema as d, conversationEventsQuerySchema as f, conversationReportEventDataSchema as g, conversationParamsSchema as h, actorIdentitySchema as i, renameConversationResponseSchema as j, conversationTitleSchema as k, conversationDetailReportSchema as l, conversationFeedSchema as m, CONVERSATION_VERSION_HEADER as n, conversationAttachmentParamsSchema as o, conversationFeedQuerySchema as p, briefLinkSchema as q, acceptedConversationMessageSchema as r, conversationAuxiliaryCostsSchema as s, CONVERSATION_DETAIL_VERSION_HEADER as t, conversationEventHistorySchema as u, conversationReportMessageEventSchema as v, createConversationMessageBodySchema as w, conversationSurfaceSchema as x, conversationReportStatusSchema as y, removedCardSchema as z };
|
package/dist/{conversation-pending-messages-DVch6YQw.js → conversation-pending-messages-DHV0S4uF.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { P as reviewItemChangeRecordSchema, W as messageAttachmentSchema, i as actorIdentitySchema, l as conversationDetailReportSchema } from "./conversation-DhoqHtQ7.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
// src/reporting-schema.ts
|
|
4
4
|
const healthReportSchema = z.object({
|