@sentry/junior 0.288.0 → 0.290.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 (76) hide show
  1. package/dist/{adapter-Cikcqdty.js → adapter-CHMVy-j0.js} +1 -1
  2. package/dist/{admin-BcSxHuTB.js → admin-C45Ap5Tn.js} +2 -2
  3. package/dist/{agent-runner-9MXyWUL8.js → agent-runner-CZjf6MOQ.js} +343 -103
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +6 -7
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +281 -254
  8. package/dist/{app-BUklJVBe.d.ts → app-BB1j2krL.d.ts} +2 -4
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +92 -64
  11. package/dist/assistant-reply-BtIV0hq6.js +58 -0
  12. package/dist/{automation-DDXwHQs5.js → automation-DWbjJltM.js} +1 -1
  13. package/dist/{background-compaction-queue-CjllSPir.js → background-compaction-queue-2gKhjRD3.js} +4 -4
  14. package/dist/{briefs-DW9iuolG.js → briefs-BGke_Cz5.js} +3 -4
  15. package/dist/{catalog-runtime-B3gfH58M.js → catalog-runtime-BSOlVfXi.js} +1 -1
  16. package/dist/cli/chat.js +14 -14
  17. package/dist/cli/check.js +3 -3
  18. package/dist/cli/main.js +3 -3
  19. package/dist/cli/plugins.js +4 -4
  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-CLJcyYEF.js → config-DHDub41t.js} +4 -41
  24. package/dist/{connections-BtdJftow.js → connections-BAb0fedk.js} +7 -129
  25. package/dist/{conversation-DhoqHtQ7.js → conversation-CwC8K3RZ.js} +8 -8
  26. package/dist/{conversation-pending-messages-DHV0S4uF.js → conversation-pending-messages-B0cuLReP.js} +1 -1
  27. package/dist/{conversation-privacy-BPirIVlX.js → conversation-privacy-QRdLPH-9.js} +1 -1
  28. package/dist/{credential-sync-Co8Q2xRW.js → credential-sync-YIMGiRk7.js} +13 -13
  29. package/dist/{db-Co7DTYYh.js → db-DBHig2sI.js} +56 -31
  30. package/dist/{db-zIs8-Ba3.d.ts → db-DCSmv9tz.d.ts} +6 -2
  31. package/dist/{executor-m0kIN71Q.js → executor-DKrtH0k_.js} +62 -13
  32. package/dist/instrumentation.js +2 -2
  33. package/dist/{logging-DbD-dErY.js → logging-f24cZPEj.js} +2 -2
  34. package/dist/{history-IjdmO_r6.js → media-BepyEUNm.js} +85 -1
  35. package/dist/{message-DKTdTYm-.js → message-BbBOajiX.js} +9 -9
  36. package/dist/nitro.d.ts +1 -1
  37. package/dist/nitro.js +2 -2
  38. package/dist/{oauth-callback-server-CpbepSbp.js → oauth-callback-server-rHJYjFoz.js} +2 -2
  39. package/dist/{projection-BViECfYu.js → projection-D-9aVaHj.js} +153 -119
  40. package/dist/{prompt-KT6MaDHN.js → prompt-C7SZhNDy.js} +183 -3
  41. package/dist/{registry-D-Acyjhh.js → registry-CwA-kSjW.js} +1 -1
  42. package/dist/{resolve-gkT2R66z.js → resolve-B5WJgt9k.js} +3 -3
  43. package/dist/{result-DHmCFEt8.js → result-B2sCVIwl.js} +16 -10
  44. package/dist/{runner-DBKjGjH-.js → runner-CZq7wyIh.js} +8 -8
  45. package/dist/{sandbox-egress-signals-9n8hqx29.js → sandbox-egress-signals-C4d6Pa9a.js} +1 -1
  46. package/dist/{schema-DxicIQbc.js → schema-Bptz19Ja.js} +14 -9
  47. package/dist/{schema-B_6aOcx5.d.ts → schema-DQaFSkZZ.d.ts} +13 -5
  48. package/dist/{service-account-CDlC9ssy.js → service-account-B6OJtplS.js} +3 -3
  49. package/dist/{service-account-Bi0HsY6w.js → service-account-BC73M8rj.js} +3 -3
  50. package/dist/{session-stop-BWOsuo8p.js → session-stop-1cku9Vm3.js} +41 -30
  51. package/dist/{skills-DO5K68Rq.js → skills-BFopj5ID.js} +2 -2
  52. package/dist/{spawn-BBqZDcPa.js → spawn-B-1JlJwH.js} +5 -5
  53. package/dist/{stop-WC97cmHz.js → stop-CJweYiOH.js} +123 -213
  54. package/dist/{store-ByR1Lr7e.js → store-CK869JpC.js} +3 -3
  55. package/dist/{task-runner-B-Ewf8TX.js → task-runner-XmXL9E-k.js} +13 -17
  56. package/dist/{turn-failure-response-CpdPoZSl.js → turn-failure-response-hhpek6Fn.js} +8 -8
  57. package/dist/{validation-B4sbIoES.js → validation-DHQjCRFx.js} +1 -1
  58. package/dist/{version-D6lpuAgL.js → version-DQgCf4FE.js} +1 -1
  59. package/dist/version.js +1 -1
  60. package/dist/{viewer-CeP27tC3.js → viewer-DG97nzP4.js} +4 -4
  61. package/dist/{warmup-P_GJCL1c.js → warmup-C00-jOoN.js} +272 -78
  62. package/dist/{work-DI7x1Slm.js → work-Ch3EWO6u.js} +14 -14
  63. package/dist/{worker-CYPTOT4j.js → worker-B8kyM1fB.js} +6 -30
  64. package/migrations/0091_conversation_participant_unsubscribed_index.sql +20 -0
  65. package/migrations/0092_turn_metric_actor.sql +12 -0
  66. package/migrations/0093_participant_root_actor_backfill.sql +18 -0
  67. package/migrations/0094_conversation_delivery_paused_at.sql +1 -0
  68. package/migrations/meta/0091_snapshot.json +4410 -0
  69. package/migrations/meta/0092_snapshot.json +4446 -0
  70. package/migrations/meta/0093_snapshot.json +4446 -0
  71. package/migrations/meta/0094_snapshot.json +4452 -0
  72. package/migrations/meta/_journal.json +28 -0
  73. package/package.json +5 -5
  74. package/dist/assistant-reply-mj47jMRV.js +0 -65
  75. package/dist/core-model-BTt5E5b0.js +0 -182
  76. package/dist/media-BAHvgkok.js +0 -85
@@ -1,16 +1,15 @@
1
1
  import { _ as withScope } from "./sentry-BRTJqumy.js";
2
- import "./config-CLJcyYEF.js";
3
- import { p as logException } from "./logging-DbD-dErY.js";
2
+ import "./config-DHDub41t.js";
3
+ import { p as logException } from "./logging-f24cZPEj.js";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
5
5
  import { sql } from "drizzle-orm";
6
6
  import { bigint, boolean, check, date, doublePrecision, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
7
7
  import { Pool, neon } from "@neondatabase/serverless";
8
8
  import { drizzle } from "drizzle-orm/neon-serverless";
9
- import { migrate } from "drizzle-orm/neon-serverless/migrator";
10
9
  import { Agent } from "undici";
10
+ import { readMigrationFiles } from "drizzle-orm/migrator";
11
11
  import pg from "pg";
12
12
  import { drizzle as drizzle$1 } from "drizzle-orm/node-postgres";
13
- import { migrate as migrate$1 } from "drizzle-orm/node-postgres/migrator";
14
13
  // src/db/schema/timestamps.ts
15
14
  const timestamptz = (name) => timestamp(name, { withTimezone: true });
16
15
  // src/db/schema/artifacts.ts
@@ -129,6 +128,11 @@ const juniorConversations = pgTable("junior_conversations", {
129
128
  * from its parent, clears it.
130
129
  */
131
130
  stoppedAt: timestamptz("stopped_at"),
131
+ /**
132
+ * Set while a root's Event Turn replies stay out of its Location. Junior
133
+ * still stores them. A person's next mention in the Location clears it.
134
+ */
135
+ deliveryPausedAt: timestamptz("delivery_paused_at"),
132
136
  durationMs: integer("duration_ms").notNull().default(0),
133
137
  usage: jsonb("usage_json").$type(),
134
138
  executionDurationMs: integer("execution_duration_ms").notNull().default(0),
@@ -297,11 +301,15 @@ const CONVERSATION_METRICS = [
297
301
  "reasoning_tokens",
298
302
  "cost_usd"
299
303
  ];
300
- /** One metric value for one Conversation Run. */
304
+ /**
305
+ * One metric value for one Conversation Run. A Run is one Turn, so People
306
+ * spend reads the Identity of the Turn Actor from these rows.
307
+ */
301
308
  const juniorConversationMetrics = pgTable("junior_conversation_metrics", {
302
309
  conversationId: text("conversation_id").notNull(),
303
310
  runId: text("run_id").notNull(),
304
311
  metric: text("metric").$type().notNull(),
312
+ actorIdentityId: text("actor_identity_id").references(() => juniorIdentities.id),
305
313
  value: doublePrecision("value").notNull(),
306
314
  occurredAt: timestamptz("occurred_at").notNull(),
307
315
  updatedAt: timestamptz("updated_at").notNull()
@@ -319,6 +327,7 @@ const juniorConversationMetrics = pgTable("junior_conversation_metrics", {
319
327
  columns: [table.conversationId],
320
328
  foreignColumns: [juniorConversations.conversationId]
321
329
  }),
330
+ index("junior_conversation_metrics_actor_identity_occurred_at_idx").on(table.actorIdentityId, table.occurredAt),
322
331
  index("junior_conversation_metrics_occurred_at_metric_idx").on(table.occurredAt, table.metric)
323
332
  ]);
324
333
  // src/db/schema/conversation-briefs.ts
@@ -367,10 +376,11 @@ const juniorConversationBindings = pgTable("junior_conversation_bindings", {
367
376
  }), index("junior_conversation_bindings_conversation_idx").on(table.conversationId)]);
368
377
  // src/db/schema/conversation-participants.ts
369
378
  /**
370
- * Materialized personal-feed membership for one linked user on one root
371
- * conversation. Rows come from the root actor and from the authors of Turn
372
- * input messages. Thread context authors do not get a row. An unsubscribed
373
- * row keeps access but leaves the active feed.
379
+ * One Participant: a linked user on one root conversation. Rows come from
380
+ * Turn Actors: the root Actor and the authors of Turn input messages, and
381
+ * the root Actor again when their Identity gets its User later. Thread
382
+ * context authors do not get a row. Access and feeds read only these rows.
383
+ * An unsubscribed row keeps access but leaves the active feed.
374
384
  */
375
385
  const juniorConversationParticipants = pgTable("junior_conversation_participants", {
376
386
  userId: text("user_id").notNull().references(() => juniorUsers.id),
@@ -402,7 +412,8 @@ const juniorConversationParticipants = pgTable("junior_conversation_participants
402
412
  }),
403
413
  index("junior_conversation_participants_user_activity_idx").on(table.userId, table.lastMessageAt.desc()),
404
414
  index("junior_conversation_participants_root_idx").on(table.rootConversationId),
405
- index("junior_conversation_participants_auto_archive_idx").on(table.userId).where(sql`${table.autoArchive}`)
415
+ index("junior_conversation_participants_auto_archive_idx").on(table.userId).where(sql`${table.autoArchive}`),
416
+ index("junior_conversation_participants_unsubscribed_idx").on(table.userId, table.rootConversationId).where(sql`${table.unsubscribedAt} is not null`)
406
417
  ]);
407
418
  // src/db/schema/conversation-read-positions.ts
408
419
  /**
@@ -759,7 +770,32 @@ const juniorSqlSchema = {
759
770
  juniorWorkspaceRepos,
760
771
  juniorWorkspaces
761
772
  };
773
+ // src/db/migrate.ts
774
+ /**
775
+ * Apply pending Drizzle migrations, each in its own transaction.
776
+ *
777
+ * Drizzle's `migrate()` runs every pending migration in one transaction
778
+ * (drizzle-orm#3249), so locks from earlier migrations stay held while later
779
+ * migrations wait for theirs. That can deadlock with live traffic. This keeps
780
+ * Drizzle's journal table and skip rule, so existing databases are unaffected.
781
+ */
782
+ async function applyMigrations(executor, config) {
783
+ const schema = config.migrationsSchema ?? "drizzle";
784
+ const table = `"${schema}"."${config.migrationsTable ?? "__drizzle_migrations"}"`;
785
+ await executor.execute(`CREATE SCHEMA IF NOT EXISTS "${schema}"`);
786
+ await executor.execute(`CREATE TABLE IF NOT EXISTS ${table} (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at bigint)`);
787
+ const [last] = await executor.query(`SELECT created_at::text AS "createdAt" FROM ${table} ORDER BY created_at DESC LIMIT 1`);
788
+ const appliedAt = Number(last?.createdAt ?? 0);
789
+ for (const migration of readMigrationFiles(config)) {
790
+ if (migration.folderMillis <= appliedAt) continue;
791
+ await executor.transaction(async () => {
792
+ for (const statement of migration.sql) await executor.execute(statement);
793
+ await executor.execute(`INSERT INTO ${table} (hash, created_at) VALUES ($1, $2)`, [migration.hash, migration.folderMillis]);
794
+ });
795
+ }
796
+ }
762
797
  // src/db/neon.ts
798
+ const POOL_MAX = 10;
763
799
  /**
764
800
  * Sends a pool query over Neon's SQL-over-HTTP endpoint when no idle
765
801
  * WebSocket client is free.
@@ -779,7 +815,7 @@ var OverflowPool = class extends Pool {
779
815
  constructor(args) {
780
816
  super({
781
817
  connectionString: args.connectionString,
782
- max: 10,
818
+ max: POOL_MAX,
783
819
  idleTimeoutMillis: 6e4,
784
820
  statement_timeout: args.statementTimeoutMs
785
821
  });
@@ -792,8 +828,21 @@ var OverflowPool = class extends Pool {
792
828
  if (callback !== void 0 || typeof values === "function" || typeof query?.text !== "string" || "submit" in query) return super.query(input, values, callback);
793
829
  const params = values ?? query.values ?? [];
794
830
  if (this.webSocketOnly.getStore() || this.idleCount > this.pendingAcquires || this.totalCount === 0) return this.queryWebSocket(query, params);
831
+ this.growInBackground();
795
832
  return this.queryHttp(query, params);
796
833
  }
834
+ growInBackground() {
835
+ setImmediate(() => {
836
+ if (this.ending || this.idleCount > 0 || this.totalCount >= POOL_MAX) return;
837
+ this.connect((error, client) => {
838
+ if (client) {
839
+ client.release();
840
+ return;
841
+ }
842
+ logException(error, "db.pool.client.connect_failed", { "app.db.driver": "neon" });
843
+ });
844
+ });
845
+ }
797
846
  /** Keep every pool query in `callback` on WebSocket. */
798
847
  async onWebSocket(callback) {
799
848
  return await this.webSocketOnly.run(true, callback);
@@ -868,7 +917,7 @@ var NeonExecutor = class {
868
917
  }
869
918
  }
870
919
  async migrate(config) {
871
- await migrate(drizzle(this.queryClient(), { schema: juniorSqlSchema }), config);
920
+ await applyMigrations(this, config);
872
921
  }
873
922
  async transaction(callback) {
874
923
  const existingClient = this.transactionClient.getStore();
@@ -985,7 +1034,7 @@ var PostgresExecutor = class {
985
1034
  }
986
1035
  }
987
1036
  async migrate(config) {
988
- await migrate$1(drizzle$1(this.queryClient(), { schema: juniorSqlSchema }), config);
1037
+ await applyMigrations(this, config);
989
1038
  }
990
1039
  async transaction(callback) {
991
1040
  const existingClient = this.transactionClient.getStore();
@@ -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-DbD-dErY.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-BPirIVlX.js";
2
+ import { B as getDeploymentTelemetryAttributes, z as getDeploymentServiceVersion } from "./logging-f24cZPEj.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-QRdLPH-9.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";
@@ -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-D6lpuAgL.js";
2
+ import { t as JUNIOR_VERSION } from "./version-DQgCf4FE.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";
@@ -1248,4 +1248,4 @@ function extractGenAiUsageAttributes(...sources) {
1248
1248
  ...cost?.total !== void 0 ? { "app.cost.total_usd": cost.total } : void 0
1249
1249
  };
1250
1250
  }
1251
- export { JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE as A, getDeploymentTelemetryAttributes as B, summarizeMessageText as C, JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE as D, withSpan as E, JUNIOR_RETENTION_CRON_SCHEDULE as F, normalizeIdentityEmail as G, runWithLogContext as H, JUNIOR_RETENTION_ROUTE as I, toOptionalString as J, isRecord as K, JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE as L, JUNIOR_HEARTBEAT_CRON_SCHEDULE as M, JUNIOR_HEARTBEAT_ROUTE as N, JUNIOR_AUTO_ARCHIVE_ROUTE as O, JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE as P, LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION as R, setTags as S, withLogContext as T, GOOGLE_IDENTITY_PROVIDER as U, runWithLogAttributes as V, isNativeIdentityProvider as W, runBestEffort as _, extractGenAiUsageSummary as a, setSpanAttributes as b, getLogContextAttributes as c, logAudit as d, logError as f, normalizeGenAiFinishReason as g, logWarn as h, extractGenAiUsageAttributes as i, JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE as j, JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE as k, getLogContextAttributesForSpan as l, logInfo as m, createChatSdkLogger as n, getActiveTraceContext as o, logException as p, toOptionalNumber as q, createRequestContext as r, getActiveTraceId as s, buildTurnFailureResponse as t, getTracePropagationHeaders as u, serializeGenAiAttribute as v, withContext as w, setSpanStatus as x, setSentryUser as y, getDeploymentServiceVersion as z };
1251
+ export { JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE as A, getDeploymentTelemetryAttributes as B, summarizeMessageText as C, JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE as D, withSpan as E, JUNIOR_RETENTION_CRON_SCHEDULE as F, isRecord as G, GOOGLE_IDENTITY_PROVIDER as H, JUNIOR_RETENTION_ROUTE as I, toOptionalNumber as K, JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE as L, JUNIOR_HEARTBEAT_CRON_SCHEDULE as M, JUNIOR_HEARTBEAT_ROUTE as N, JUNIOR_AUTO_ARCHIVE_ROUTE as O, JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE as P, LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION as R, setTags as S, withLogContext as T, isNativeIdentityProvider as U, runWithLogAttributes as V, normalizeIdentityEmail as W, runBestEffort as _, extractGenAiUsageSummary as a, setSpanAttributes as b, getLogContextAttributes as c, logAudit as d, logError as f, normalizeGenAiFinishReason as g, logWarn as h, extractGenAiUsageAttributes as i, JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE as j, JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE as k, getLogContextAttributesForSpan as l, logInfo as m, createChatSdkLogger as n, getActiveTraceContext as o, logException as p, toOptionalString as q, createRequestContext as r, getActiveTraceId as s, buildTurnFailureResponse as t, getTracePropagationHeaders as u, serializeGenAiAttribute as v, withContext as w, setSpanStatus as x, setSentryUser as y, getDeploymentServiceVersion as z };
@@ -555,4 +555,88 @@ const newConversationEventSchema = z.object({
555
555
  idempotencyKey: z.string().min(1).optional(),
556
556
  createdAtMs: z.number().finite()
557
557
  }).strict();
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 };
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 };
@@ -1,13 +1,13 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { Ya as readConversationAccessFromSql, qa as canAccessConversation, wn as renderUntrustedTag } from "./projection-BViECfYu.js";
3
- import { n as botConfig } from "./config-CLJcyYEF.js";
4
- import { T as SYSTEM_IDENTITY_ID, a as getConversationStore, o as getDb } from "./db-Co7DTYYh.js";
5
- import { $t as actorFromRun, Kt as AgentMessageTargetError, Wt as AgentMessagePausedError, en as toolInvocationDestination } from "./agent-runner-9MXyWUL8.js";
6
- import { I as PARENT_AGENT_TARGET, v as getActiveAgentInvocationForConversation } from "./turn-failure-response-CpdPoZSl.js";
7
- import { G as admitAutomatedTurn, S as EVENT_WAIT_MS, V as postAutomatedTurnLimitNoticeForConversation } from "./session-stop-BWOsuo8p.js";
8
- import { r as appendAndEnqueueInboundMessage } from "./store-ByR1Lr7e.js";
9
- import { a as enqueueAgentInvocation, c as createAgentInvocationForMessage, u as findChildAgentConversationId } from "./work-DI7x1Slm.js";
10
- import { r as enqueueAgentMessageToParent } from "./result-DHmCFEt8.js";
2
+ import { $a as readConversationAccessFromSql, Cn as renderUntrustedTag, Xa as canAccessConversation } from "./projection-D-9aVaHj.js";
3
+ import { n as botConfig } from "./config-DHDub41t.js";
4
+ import { T as SYSTEM_IDENTITY_ID, a as getConversationStore, o as getDb } from "./db-DBHig2sI.js";
5
+ import { dn as actorFromRun, fn as toolInvocationDestination, in as AgentMessageTargetError, nn as AgentMessagePausedError } from "./agent-runner-CZjf6MOQ.js";
6
+ import { I as PARENT_AGENT_TARGET, v as getActiveAgentInvocationForConversation } from "./turn-failure-response-hhpek6Fn.js";
7
+ import { G as admitAutomatedTurn, S as EVENT_WAIT_MS, V as postAutomatedTurnLimitNoticeForConversation } from "./session-stop-1cku9Vm3.js";
8
+ import { r as appendAndEnqueueInboundMessage } from "./store-CK869JpC.js";
9
+ import { a as enqueueAgentInvocation, c as createAgentInvocationForMessage, u as findChildAgentConversationId } from "./work-Ch3EWO6u.js";
10
+ import { r as enqueueAgentMessageToParent } from "./result-B2sCVIwl.js";
11
11
  // src/chat/agent-invocations/top-level-message.ts
12
12
  const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
13
13
  /** Event type of a message from another top-level agent. */
package/dist/nitro.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as JuniorDashboardOptions } from "./app-BUklJVBe.js";
1
+ import { i as JuniorDashboardOptions } from "./app-BB1j2krL.js";
2
2
  import { n as JuniorPluginSet } from "./plugins-DtmjkTza.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,6 +1,6 @@
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-DbD-dErY.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-f24cZPEj.js";
2
2
  import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DJhGdS4c.js";
3
- import { S as CACHE_WARMUP_QUEUE_TOPIC, _ as resolveConversationWorkQueueTopic, a as PLUGIN_TASK_QUEUE_TOPIC, f as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./background-compaction-queue-CjllSPir.js";
3
+ import { S as CACHE_WARMUP_QUEUE_TOPIC, _ as resolveConversationWorkQueueTopic, a as PLUGIN_TASK_QUEUE_TOPIC, f as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./background-compaction-queue-2gKhjRD3.js";
4
4
  import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-HYh_JOdw.js";
5
5
  import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cf5gVPWP.js";
6
6
  import path from "node:path";
@@ -1,5 +1,5 @@
1
- import { Dn as createUserTokenStore } from "./projection-BViECfYu.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-Co8Q2xRW.js";
1
+ import { En as createUserTokenStore } from "./projection-D-9aVaHj.js";
2
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-YIMGiRk7.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;