@sentry/junior 0.298.0 → 0.299.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.
Files changed (94) hide show
  1. package/dist/{actor-6jsm_v96.js → actor-D2iXzvlN.js} +2 -1
  2. package/dist/{state-CSuA2J1V.js → adapter-AgCNqqsG.js} +49 -133
  3. package/dist/{admin-BF3DbYGf.js → admin-1VwEXztm.js} +2 -2
  4. package/dist/{agent-runner-Q9GkoerG.js → agent-runner-Ciet8_nn.js} +977 -1316
  5. package/dist/api/schema.d.ts +2 -2
  6. package/dist/api/schema.js +8 -7
  7. package/dist/api.d.ts +1 -1
  8. package/dist/api.js +125 -43
  9. package/dist/{app-DOg_mCtV.d.ts → app--ky-Eu33.d.ts} +6 -4
  10. package/dist/app.d.ts +1 -1
  11. package/dist/app.js +126 -299
  12. package/dist/{automation-Cn8qmbdr.js → automation-M3RFJUBf.js} +1 -1
  13. package/dist/{background-compaction-queue-BZhGFOK6.js → background-compaction-queue-CnimvRdk.js} +4 -4
  14. package/dist/{briefs-CQrCRF6-.js → briefs-CwzvgdCa.js} +4 -4
  15. package/dist/{catalog-runtime-DZeD2WbL.js → catalog-runtime-DaBaHY7u.js} +1 -1
  16. package/dist/cli/chat.js +17 -17
  17. package/dist/cli/check.js +3 -3
  18. package/dist/cli/main.js +3 -3
  19. package/dist/cli/plugins.js +5 -5
  20. package/dist/cli/snapshot-create.js +4 -4
  21. package/dist/cli/upgrade.d.ts +1 -1
  22. package/dist/cli/upgrade.js +4 -4
  23. package/dist/{config-BOByVnxe.js → config-CAXIpWQb.js} +80 -6
  24. package/dist/{connections-BNN5cJam.js → connections-Dy0hPdUq.js} +6 -6
  25. package/dist/continue-in-slack-DIOjFj76.js +176 -0
  26. package/dist/{conversation-DCkzvxqB.js → conversation-fCWD9Az3.js} +24 -12
  27. package/dist/{conversation-feed-CMA12Rjs.js → conversation-feed-BPK8vkkZ.js} +88 -3
  28. package/dist/{conversation-privacy-C0eRxsgb.js → conversation-privacy-DUgtRkf8.js} +1 -1
  29. package/dist/{conversation-turn-D9qvcDX6.js → conversation-turn-DkJB6yMF.js} +85 -68
  30. package/dist/{credential-sync-B_iUpxGL.js → credential-sync-RX24Y8aY.js} +18 -18
  31. package/dist/{db-DoMcnYol.d.ts → db-B07FtU9g.d.ts} +1 -1
  32. package/dist/{db-CoMNr2Zm.js → db-COYOGzYS.js} +171 -12
  33. package/dist/{executor-C-m8VrzX.js → executor-BWmAgSyi.js} +40 -11
  34. package/dist/{media-BepyEUNm.js → history-IjdmO_r6.js} +1 -85
  35. package/dist/instrumentation.js +2 -2
  36. package/dist/lineage-D-5jm_oj.js +37 -0
  37. package/dist/{logging-CJTi5niy.js → logging-DPLEa8Bn.js} +1 -1
  38. package/dist/media-BAHvgkok.js +85 -0
  39. package/dist/{message-Q6_5DAWR.js → message-BIHR1yRk.js} +9 -10
  40. package/dist/model-input-BPZYH8Nd.js +82 -0
  41. package/dist/nitro.d.ts +1 -1
  42. package/dist/nitro.js +17 -9
  43. package/dist/{oauth-callback-server-CH5XAyo-.js → oauth-callback-server-R7qvSzFG.js} +2 -2
  44. package/dist/{plugins-HYh_JOdw.js → plugins-CBW2Prb_.js} +1 -1
  45. package/dist/{projection-BgwEE36_.js → projection-DEdP1q6f.js} +261 -36
  46. package/dist/{prompt-DXc9DYT9.js → prompt-4M98h_tC.js} +4 -4
  47. package/dist/{registry-9XwqSnM-.js → registry-BTKmKM-r.js} +3 -3
  48. package/dist/{resolve-DUIAbcRL.js → resolve-B8hXNVZ3.js} +3 -3
  49. package/dist/{result-C2Vn8QGn.js → result-g-XAaOj6.js} +158 -69
  50. package/dist/{runner-CXGtw-Mc.js → runner-BlPSA5A8.js} +9 -9
  51. package/dist/{sandbox-egress-signals-Di3S_dO7.js → sandbox-egress-signals-Pai-MzEY.js} +1 -1
  52. package/dist/{schema-Dyp7racy.js → schema-BNnY_trV.js} +47 -7
  53. package/dist/{schema-BnbZ-rKv.d.ts → schema-DbuWR-DN.d.ts} +657 -346
  54. package/dist/{service-account-GzAMUQ8a.js → service-account-9OLNQMyz.js} +4 -4
  55. package/dist/{service-account-DM3KBBeG.js → service-account-BYGZ08DQ.js} +3 -3
  56. package/dist/session-stop-2XJrcNCy.js +3356 -0
  57. package/dist/{skills-DCK9SD_l.js → skills-DpBQoeHV.js} +3 -3
  58. package/dist/slack-conversation-unfurl-BcDIWo67.js +370 -0
  59. package/dist/spawn-09GssFod.js +73 -0
  60. package/dist/state-Cufq0_rH.js +132 -0
  61. package/dist/{user-input-request-CXNIov9n.js → statuses-B8mUfghF.js} +30 -25
  62. package/dist/{stop-Dh2DfwpK.js → stop-U7iUrR1g.js} +6008 -5772
  63. package/dist/{store-B1zepKG8.js → store-BHiaHCQu.js} +24 -4
  64. package/dist/{store-DrA17Fbz.js → store-CSgUTMdv.js} +10 -10
  65. package/dist/{task-queue-D1rXWfFN.js → task-queue-bMNq0clp.js} +4 -4
  66. package/dist/{task-runner-CT4M8oDz.js → task-runner-B__rxwxU.js} +10 -10
  67. package/dist/{thread-context-DnqUkbzN.js → thread-context-d0ceWbVT.js} +18 -18
  68. package/dist/{turn-session-routing-VXDVXLRl.js → turn-session-routing-BVZHBFCF.js} +5 -5
  69. package/dist/turn-user-message-BEw7acTP.js +355 -0
  70. package/dist/users-BK3dbxZL.js +424 -0
  71. package/dist/{validation-zxAJBDDy.js → validation-BDVJjO2E.js} +1 -1
  72. package/dist/{version-DcZ40a0g.js → version-DQgZoQ3D.js} +1 -1
  73. package/dist/version.js +1 -1
  74. package/dist/{viewer-CgiGjW10.js → viewer-CAWfFo29.js} +25 -54
  75. package/dist/{warmup-CwKbxQLl.js → warmup-9ySPacF9.js} +1137 -144
  76. package/dist/{worker-CbDUzaBA.js → worker-D8jJO-WO.js} +8 -7
  77. package/migrations/0104_code_change_draft.sql +1 -0
  78. package/migrations/0105_attachment_uploads.sql +14 -0
  79. package/migrations/0106_conversation_agent_config.sql +1 -0
  80. package/migrations/meta/0104_snapshot.json +4516 -0
  81. package/migrations/meta/0105_snapshot.json +4611 -0
  82. package/migrations/meta/0106_snapshot.json +4617 -0
  83. package/migrations/meta/_journal.json +21 -0
  84. package/package.json +4 -4
  85. package/dist/attempt-selection-ClP3MMPr.js +0 -61
  86. package/dist/locks-D-0h111u.js +0 -48
  87. package/dist/notification-Bv25xbj0.js +0 -1284
  88. package/dist/prompt-input-BUr4J9RO.js +0 -1424
  89. package/dist/session-stop-D4i7e6iT.js +0 -181
  90. package/dist/spawn-6cX6xE9G.js +0 -80
  91. package/dist/turn-cancel-l460pfGW.js +0 -201
  92. package/dist/turn-user-message-BSPmkm7X.js +0 -608
  93. package/dist/turn-wake-DVFVXyhX.js +0 -161
  94. package/dist/{oauth-relay-CsfIazeF.js → oauth-relay-DRzq73b6.js} +1 -1
@@ -555,88 +555,4 @@ const newConversationEventSchema = z.object({
555
555
  idempotencyKey: z.string().min(1).optional(),
556
556
  createdAtMs: z.number().finite()
557
557
  }).strict();
558
- // src/chat/attachments/media.ts
559
- const INPUT_IMAGE_TYPES = [
560
- "image/png",
561
- "image/jpeg",
562
- "image/gif",
563
- "image/webp"
564
- ];
565
- /** Video types that browsers play in a `<video>` element. */
566
- const INLINE_VIDEO_TYPES = ["video/mp4", "video/webm"];
567
- /** Leading bytes of each accepted image type. `null` matches any byte. */
568
- const IMAGE_SIGNATURES = [
569
- {
570
- mediaType: "image/png",
571
- bytes: [
572
- 137,
573
- 80,
574
- 78,
575
- 71,
576
- 13,
577
- 10,
578
- 26,
579
- 10
580
- ]
581
- },
582
- {
583
- mediaType: "image/jpeg",
584
- bytes: [
585
- 255,
586
- 216,
587
- 255
588
- ]
589
- },
590
- {
591
- mediaType: "image/gif",
592
- bytes: [
593
- 71,
594
- 73,
595
- 70,
596
- 56,
597
- 55,
598
- 97
599
- ]
600
- },
601
- {
602
- mediaType: "image/gif",
603
- bytes: [
604
- 71,
605
- 73,
606
- 70,
607
- 56,
608
- 57,
609
- 97
610
- ]
611
- },
612
- {
613
- mediaType: "image/webp",
614
- bytes: [
615
- 82,
616
- 73,
617
- 70,
618
- 70,
619
- null,
620
- null,
621
- null,
622
- null,
623
- 87,
624
- 69,
625
- 66,
626
- 80
627
- ]
628
- }
629
- ];
630
- /**
631
- * Detect an accepted image type from file bytes. Use this instead of a file
632
- * name or declared content type, which can be wrong.
633
- */
634
- function detectImageMediaType(data) {
635
- return IMAGE_SIGNATURES.find(({ bytes }) => data.length >= bytes.length && bytes.every((byte, index) => byte === null || data[index] === byte))?.mediaType;
636
- }
637
- /** Report whether a media type is a raster image accepted by vision models. */
638
- function isVisionImageMediaType(mediaType) {
639
- const normalized = mediaType.split(";", 1)[0]?.trim().toLowerCase();
640
- return normalized ? INPUT_IMAGE_TYPES.some((type) => type === normalized) : false;
641
- }
642
- export { instructionProvenanceFor as _, KNOWN_CONVERSATION_EVENT_TYPES as a, conversationTurnFailureCodeSchema as c, historyReplacementSchema as d, newConversationEventSchema as f, instructionActors as g, contextProvenance as h, isVisionImageMediaType as i, conversationTurnFailureReasonSchema as l, agentInstructionProvenance as m, INPUT_IMAGE_TYPES as n, agentHistoryItemSchema as o, encodeHistoryPayload as p, detectImageMediaType as r, conversationEventDataSchema as s, INLINE_VIDEO_TYPES as t, decodeStoredConversationEvent as u, sameActorIdentity as v, usageSchema as y };
558
+ export { conversationTurnFailureReasonSchema as a, newConversationEventSchema as c, contextProvenance as d, instructionActors as f, usageSchema as h, conversationTurnFailureCodeSchema as i, encodeHistoryPayload as l, sameActorIdentity as m, agentHistoryItemSchema as n, decodeStoredConversationEvent as o, instructionProvenanceFor as p, conversationEventDataSchema as r, historyReplacementSchema as s, KNOWN_CONVERSATION_EVENT_TYPES as t, agentInstructionProvenance as u };
@@ -1,6 +1,6 @@
1
1
  import { a as getClient, c as init, i as getActiveSpan, o as getGlobalScope, p as spanToJSON, s as getTraceData } from "./sentry-BRTJqumy.js";
2
- import { B as getDeploymentTelemetryAttributes, z as getDeploymentServiceVersion } from "./logging-CJTi5niy.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-C0eRxsgb.js";
2
+ import { B as getDeploymentTelemetryAttributes, z as getDeploymentServiceVersion } from "./logging-DPLEa8Bn.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-DUgtRkf8.js";
4
4
  import { n as redactSandboxEgressProxyPath } from "./proxy-path-BHYoKZdq.js";
5
5
  import { t as consumePrivateTraceResultMarker } from "./private-trace-result-CE7_lEdq.js";
6
6
  import { n as promoteHttpRouteName, r as routeNameMiddleware, t as nameRequestRoute } from "./sentry-route-name-BhwWnfqj.js";
@@ -0,0 +1,37 @@
1
+ import { D as conversationKindFromRow, o as getDb } from "./db-COYOGzYS.js";
2
+ import { j as juniorConversations } from "./executor-BWmAgSyi.js";
3
+ import { desc, eq, sql } from "drizzle-orm";
4
+ // src/chat/conversations/lineage.ts
5
+ /**
6
+ * Read the parent chain of a Conversation in one query, root first, with the
7
+ * Conversation last. Returns an empty list when the Conversation is missing.
8
+ *
9
+ * The chain stops at a parent that is missing or that is already in the
10
+ * chain. Then the first entry still has a `parentConversationId`, so callers
11
+ * can tell a broken chain from one that ends at a root.
12
+ */
13
+ async function readConversationLineage(conversationId) {
14
+ const lineage = sql`(
15
+ with recursive lineage(conversation_id, parent_conversation_id, depth, path) as (
16
+ select selected.conversation_id, selected.parent_conversation_id, 0, array[selected.conversation_id]
17
+ from junior_conversations selected
18
+ where selected.conversation_id = ${conversationId}
19
+ union all
20
+ select parent.conversation_id, parent.parent_conversation_id, lineage.depth + 1, lineage.path || parent.conversation_id
21
+ from junior_conversations parent
22
+ join lineage on parent.conversation_id = lineage.parent_conversation_id
23
+ where parent.conversation_id <> all(lineage.path)
24
+ )
25
+ select conversation_id, depth from lineage
26
+ ) conversation_lineage`;
27
+ return (await getDb().select({
28
+ conversationId: juniorConversations.conversationId,
29
+ kind: juniorConversations.kind,
30
+ parentConversationId: juniorConversations.parentConversationId
31
+ }).from(juniorConversations).innerJoin(lineage, eq(sql`conversation_lineage.conversation_id`, juniorConversations.conversationId)).orderBy(desc(sql`conversation_lineage.depth`))).map((row) => ({
32
+ conversationId: row.conversationId,
33
+ kind: conversationKindFromRow(row),
34
+ ...row.parentConversationId ? { parentConversationId: row.parentConversationId } : void 0
35
+ }));
36
+ }
37
+ export { readConversationLineage as t };
@@ -1,5 +1,5 @@
1
1
  import { _ as withScope, d as setTag, f as setUser, h as startSpan, i as getActiveSpan, l as logger, n as captureMessage, p as spanToJSON, s as getTraceData, t as captureException } from "./sentry-BRTJqumy.js";
2
- import { t as JUNIOR_VERSION } from "./version-DcZ40a0g.js";
2
+ import { t as JUNIOR_VERSION } from "./version-DQgZoQ3D.js";
3
3
  import path from "node:path";
4
4
  import { styleText } from "node:util";
5
5
  import { ConfigError, configureSync, getConfig, getLogger } from "@logtape/logtape";
@@ -0,0 +1,85 @@
1
+ // src/chat/attachments/media.ts
2
+ const INPUT_IMAGE_TYPES = [
3
+ "image/png",
4
+ "image/jpeg",
5
+ "image/gif",
6
+ "image/webp"
7
+ ];
8
+ /** Video types that browsers play in a `<video>` element. */
9
+ const INLINE_VIDEO_TYPES = ["video/mp4", "video/webm"];
10
+ /** Leading bytes of each accepted image type. `null` matches any byte. */
11
+ const IMAGE_SIGNATURES = [
12
+ {
13
+ mediaType: "image/png",
14
+ bytes: [
15
+ 137,
16
+ 80,
17
+ 78,
18
+ 71,
19
+ 13,
20
+ 10,
21
+ 26,
22
+ 10
23
+ ]
24
+ },
25
+ {
26
+ mediaType: "image/jpeg",
27
+ bytes: [
28
+ 255,
29
+ 216,
30
+ 255
31
+ ]
32
+ },
33
+ {
34
+ mediaType: "image/gif",
35
+ bytes: [
36
+ 71,
37
+ 73,
38
+ 70,
39
+ 56,
40
+ 55,
41
+ 97
42
+ ]
43
+ },
44
+ {
45
+ mediaType: "image/gif",
46
+ bytes: [
47
+ 71,
48
+ 73,
49
+ 70,
50
+ 56,
51
+ 57,
52
+ 97
53
+ ]
54
+ },
55
+ {
56
+ mediaType: "image/webp",
57
+ bytes: [
58
+ 82,
59
+ 73,
60
+ 70,
61
+ 70,
62
+ null,
63
+ null,
64
+ null,
65
+ null,
66
+ 87,
67
+ 69,
68
+ 66,
69
+ 80
70
+ ]
71
+ }
72
+ ];
73
+ /**
74
+ * Detect an accepted image type from file bytes. Use this instead of a file
75
+ * name or declared content type, which can be wrong.
76
+ */
77
+ function detectImageMediaType(data) {
78
+ return IMAGE_SIGNATURES.find(({ bytes }) => data.length >= bytes.length && bytes.every((byte, index) => byte === null || data[index] === byte))?.mediaType;
79
+ }
80
+ /** Report whether a media type is a raster image accepted by vision models. */
81
+ function isVisionImageMediaType(mediaType) {
82
+ const normalized = mediaType.split(";", 1)[0]?.trim().toLowerCase();
83
+ return normalized ? INPUT_IMAGE_TYPES.some((type) => type === normalized) : false;
84
+ }
85
+ export { isVisionImageMediaType as i, INPUT_IMAGE_TYPES as n, detectImageMediaType as r, INLINE_VIDEO_TYPES as t };
@@ -1,13 +1,12 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { go as readConversationAccessFromSql, po as canAccessConversation, zn as renderUntrustedTag } from "./projection-BgwEE36_.js";
3
- import { n as botConfig } from "./config-BOByVnxe.js";
4
- import { M as SYSTEM_IDENTITY_ID, a as getConversationStore, o as getDb } from "./db-CoMNr2Zm.js";
5
- import { Ft as actorFromRun, It as toolInvocationDestination } from "./agent-runner-Q9GkoerG.js";
6
- import { I as findChildAgentConversationId, M as AgentMessagePausedError, O as createAgentInvocationForMessage, P as AgentMessageTargetError, x as enqueueAgentInvocation } from "./warmup-CwKbxQLl.js";
7
- import { C as getActiveAgentInvocationForConversation, E as getLatestAgentInvocationForConversation, W as PARENT_AGENT_TARGET } from "./turn-user-message-BSPmkm7X.js";
8
- import { b as postAutomatedTurnLimitNoticeForConversation, t as EVENT_WAIT_MS, w as admitAutomatedTurn } from "./notification-Bv25xbj0.js";
9
- import { r as appendAndEnqueueInboundMessage } from "./store-B1zepKG8.js";
10
- import { a as enqueueAgentMessageToParent } from "./result-C2Vn8QGn.js";
2
+ import { Jn as renderUntrustedTag, Mo as readConversationAccessFromSql, ko as canAccessConversation } from "./projection-DEdP1q6f.js";
3
+ import { n as botConfig } from "./config-CAXIpWQb.js";
4
+ import { a as getConversationStore, j as SYSTEM_IDENTITY_ID, o as getDb } from "./db-COYOGzYS.js";
5
+ import { Mt as actorFromRun, Nt as toolInvocationDestination } from "./agent-runner-Ciet8_nn.js";
6
+ import { M as EVENT_WAIT_MS, Z as postAutomatedTurnLimitNoticeForConversation, tt as admitAutomatedTurn } from "./session-stop-2XJrcNCy.js";
7
+ import { A as readChildConversationSender, H as enqueueAgentInvocation, Z as createAgentInvocationForMessage, at as findChildAgentConversationId, g as getActiveAgentInvocationForConversation, lt as PARENT_AGENT_TARGET, rt as AgentMessageTargetError, tt as AgentMessagePausedError, y as getLatestAgentInvocationForConversation } from "./warmup-9ySPacF9.js";
8
+ import { r as appendAndEnqueueInboundMessage } from "./store-BHiaHCQu.js";
9
+ import { a as enqueueAgentMessageToParent } from "./result-g-XAaOj6.js";
11
10
  // src/chat/agent-invocations/top-level-message.ts
12
11
  const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
13
12
  /** Event type of a message from another top-level agent. */
@@ -116,7 +115,7 @@ function bindMessageAgent(run, options) {
116
115
  call.signal?.throwIfAborted();
117
116
  const queue = typeof options.queue === "function" ? options.queue() : options.queue;
118
117
  if (input.to === "parent") {
119
- const sender = await getActiveAgentInvocationForConversation(run.conversationId) ?? await getLatestAgentInvocationForConversation(run.conversationId);
118
+ const sender = await getActiveAgentInvocationForConversation(run.conversationId) ?? await getLatestAgentInvocationForConversation(run.conversationId) ?? await readChildConversationSender(run.conversationId);
120
119
  if (!sender) throw new AgentMessageTargetError("This conversation has no parent agent");
121
120
  await enqueueAgentMessageToParent({
122
121
  actor,
@@ -0,0 +1,82 @@
1
+ import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
+ import { s as getSqlExecutor } from "./db-COYOGzYS.js";
3
+ import { gt as readLiveAttachment } from "./agent-runner-Ciet8_nn.js";
4
+ import { i as isVisionImageMediaType, r as detectImageMediaType } from "./media-BAHvgkok.js";
5
+ // src/chat/attachments/model-input.ts
6
+ var model_input_exports = /* @__PURE__ */ __exportAll({
7
+ MAX_MODEL_ATTACHMENTS: () => 3,
8
+ MAX_MODEL_ATTACHMENT_BYTES: () => MAX_MODEL_ATTACHMENT_BYTES,
9
+ buildStoredAttachmentPromptText: () => buildStoredAttachmentPromptText,
10
+ loadInputAttachments: () => loadInputAttachments
11
+ });
12
+ /** Largest file that Slack and web send to the model in the prompt. */
13
+ const MAX_MODEL_ATTACHMENT_BYTES = 5242880;
14
+ /** Tell the model how to read a stored file that the prompt does not carry. */
15
+ function buildStoredAttachmentPromptText(args) {
16
+ return [
17
+ "<attachment>",
18
+ `filename: ${args.filename ?? "unnamed"}`,
19
+ `media_type: ${args.mediaType}`,
20
+ `attachment_id: ${args.attachmentId}`,
21
+ "Use loadAttachment with this id to access the original file.",
22
+ "</attachment>"
23
+ ].join("\n");
24
+ }
25
+ async function readStoredBytes(args) {
26
+ const record = await readLiveAttachment({
27
+ attachmentId: args.attachment.id,
28
+ conversationId: args.conversationId,
29
+ db: getSqlExecutor()
30
+ });
31
+ if (!record || record.storageProvider !== args.storage.provider) throw new Error("Input attachment is no longer available.");
32
+ const body = await args.storage.get(record.storageKey);
33
+ if (!body) throw new Error("Input attachment contents are unavailable.");
34
+ const data = Buffer.from(await new Response(body).arrayBuffer());
35
+ if (data.byteLength !== record.bytes) throw new Error("Input attachment size does not match stored metadata.");
36
+ return data;
37
+ }
38
+ /**
39
+ * Build model input for the stored files of one web Message.
40
+ *
41
+ * Like Slack, the first images within the size limit go to the model as
42
+ * images. Every other file gets a note that points to `loadAttachment`.
43
+ */
44
+ async function loadInputAttachments(args) {
45
+ let images = 0;
46
+ return await Promise.all(args.attachments.map(async (attachment) => {
47
+ const base = {
48
+ attachmentId: attachment.id,
49
+ filename: attachment.filename,
50
+ mediaType: attachment.contentType
51
+ };
52
+ if (!(isVisionImageMediaType(attachment.contentType) && attachment.bytes <= 5242880 && images < 3)) return {
53
+ ...base,
54
+ promptText: buildStoredAttachmentPromptText({
55
+ attachmentId: attachment.id,
56
+ filename: attachment.filename,
57
+ mediaType: attachment.contentType
58
+ })
59
+ };
60
+ images += 1;
61
+ const data = await readStoredBytes({
62
+ attachment,
63
+ conversationId: args.conversationId,
64
+ storage: args.storage
65
+ });
66
+ const mediaType = detectImageMediaType(data);
67
+ if (!mediaType) return {
68
+ ...base,
69
+ promptText: buildStoredAttachmentPromptText({
70
+ attachmentId: attachment.id,
71
+ filename: attachment.filename,
72
+ mediaType: attachment.contentType
73
+ })
74
+ };
75
+ return {
76
+ ...base,
77
+ data,
78
+ mediaType
79
+ };
80
+ }));
81
+ }
82
+ export { buildStoredAttachmentPromptText as n, model_input_exports as r, MAX_MODEL_ATTACHMENT_BYTES as t };
package/dist/nitro.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as JuniorDashboardOptions } from "./app-DOg_mCtV.js";
1
+ import { i as JuniorDashboardOptions } from "./app--ky-Eu33.js";
2
2
  import { n as JuniorPluginSet } from "./plugins-B_0Cr0MO.js";
3
3
  import { withSentryConfig as withSentryConfig$1 } from "@sentry/nitro";
4
4
  type SentryNitroConfig = Parameters<typeof withSentryConfig$1>[0];
package/dist/nitro.js CHANGED
@@ -1,8 +1,8 @@
1
- import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_CRON_SCHEDULE, I as JUNIOR_RETENTION_ROUTE, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_CRON_SCHEDULE, N as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, z as getDeploymentServiceVersion } from "./logging-CJTi5niy.js";
1
+ import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_CRON_SCHEDULE, I as JUNIOR_RETENTION_ROUTE, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_CRON_SCHEDULE, N as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, z as getDeploymentServiceVersion } from "./logging-DPLEa8Bn.js";
2
2
  import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DJhGdS4c.js";
3
- import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, h as CACHE_WARMUP_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic } from "./background-compaction-queue-BZhGFOK6.js";
4
- import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-HYh_JOdw.js";
5
- import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-D1rXWfFN.js";
3
+ import { a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, h as CACHE_WARMUP_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC, u as resolveConversationWorkQueueTopic } from "./background-compaction-queue-CnimvRdk.js";
4
+ import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-bMNq0clp.js";
5
+ import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-CBW2Prb_.js";
6
6
  import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cf5gVPWP.js";
7
7
  import path from "node:path";
8
8
  import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
@@ -14,12 +14,14 @@ import { sentryOrchestrionPlugin } from "@sentry/server-utils/orchestrion/rollup
14
14
  * bundling.
15
15
  *
16
16
  * pi-ai registers API providers via a top-level side-effect in
17
- * register-builtins.js. Nitro's default moduleSideEffects whitelist only
18
- * includes unenv polyfills, so rolldown tree-shakes the registration call
19
- * and the apiProviderRegistry Map stays empty at runtime.
17
+ * register-builtins.js. Older Nitro builds set a moduleSideEffects allowlist
18
+ * with only unenv polyfills, so rolldown tree-shook the registration call and
19
+ * the apiProviderRegistry Map stayed empty at runtime
20
+ * (https://github.com/nitrojs/nitro/issues/4085).
20
21
  *
21
- * TODO(upstream): Track https://github.com/nitrojs/nitro/issues/XXXX for
22
- * native moduleSideEffects configuration support.
22
+ * TODO(dcramer): Remove this override when a production build shows that
23
+ * pi-ai providers register without it. nitrojs/nitro#4164 removed the
24
+ * allowlist, and every Nitro version that Junior supports includes that fix.
23
25
  */
24
26
  function applyRolldownTreeshakeWorkaround(nitro) {
25
27
  nitro.options.rolldownConfig = {
@@ -260,11 +262,17 @@ function configureVercelDeployment(nitro, options) {
260
262
  addQueueTrigger(JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, BACKGROUND_COMPACTION_QUEUE_TOPIC);
261
263
  return defaultMaxDuration;
262
264
  }
265
+ function dropRoutedServerEntry(nitro) {
266
+ const serverEntry = nitro.options.serverEntry;
267
+ if (!serverEntry) return;
268
+ if (Object.values(nitro.options.routes).some((route) => (typeof route === "string" ? route : route.handler) === serverEntry.handler)) nitro.options.serverEntry = false;
269
+ }
263
270
  /** Nitro module that configures deployment wiring and copies app/plugin content into the Vercel build output. */
264
271
  function juniorNitro(options = {}) {
265
272
  return { nitro: { setup(nitro) {
266
273
  const cwd = path.resolve(options.cwd ?? nitro.options.rootDir ?? process.cwd());
267
274
  const functionMaxDurationSeconds = configureVercelDeployment(nitro, options);
275
+ dropRoutedServerEntry(nitro);
268
276
  applyRolldownTreeshakeWorkaround(nitro);
269
277
  if (dashboardEnabled(options.dashboard)) nitro.options.publicAssets.push({
270
278
  baseURL: "/_junior/dashboard/assets",
@@ -1,5 +1,5 @@
1
- import { Hn as createUserTokenStore } from "./projection-BgwEE36_.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-B_iUpxGL.js";
1
+ import { Zn as createUserTokenStore } from "./projection-DEdP1q6f.js";
2
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-RX24Y8aY.js";
3
3
  import { createServer } from "node:http";
4
4
  // src/chat/local/oauth-callback-server.ts
5
5
  const LOCAL_OAUTH_TIMEOUT_MS = 6e5;
@@ -89,7 +89,7 @@ function pluginCatalogConfigFromEnv(env = process.env) {
89
89
  }
90
90
  /** Return registrations that expose in-process runtime code. */
91
91
  function pluginRuntimeRegistrationsFromPluginSet(pluginSet) {
92
- return pluginSet?.registrations.filter((plugin) => plugin.hooks || plugin.tasks || plugin.userPages?.length) ?? [];
92
+ return pluginSet?.registrations.filter((plugin) => plugin.hooks || plugin.tasks || plugin.userPages?.length || plugin.objectLinks?.length) ?? [];
93
93
  }
94
94
  /** Return registrations that expose host CLI commands. */
95
95
  function pluginCliRegistrationsFromPluginSet(pluginSet) {