@sentry/junior 0.312.0 → 0.314.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 (115) hide show
  1. package/dist/{adapter-iIq7ihf7.js → adapter-JARQvoLw.js} +1 -2
  2. package/dist/{adapter-context-BRjEWRy1.js → adapter-context-B4BrJZuS.js} +2 -2
  3. package/dist/{admin-DhInw5K9.js → admin-BXGAySz0.js} +1 -1
  4. package/dist/{agent-runner-C9iDurwX.js → agent-runner-qZU5TR8i.js} +865 -138
  5. package/dist/agent-update-cS7Z9mnG.js +26 -0
  6. package/dist/agent-update-delivery-CZ5M8RDa.js +85 -0
  7. package/dist/api/schema.d.ts +2 -2
  8. package/dist/api/schema.js +6 -6
  9. package/dist/api.d.ts +1 -1
  10. package/dist/api.js +340 -106
  11. package/dist/{app-DRFrC8Mw.d.ts → app-D7tKnw9a.d.ts} +4 -21
  12. package/dist/app.d.ts +2 -2
  13. package/dist/app.js +80 -171
  14. package/dist/{background-compaction-queue-DrKi7w3d.js → background-compaction-queue-C_uIBUvS.js} +6 -17
  15. package/dist/{callback-mFlTUWWx.js → callback-C8SdXCwr.js} +4 -11
  16. package/dist/{catalog-runtime-D7xapBAX.js → catalog-runtime-BLKtnUL3.js} +1 -1
  17. package/dist/{channel-access-CJGfNTdn.js → channel-access-BOL29BG3.js} +6 -6
  18. package/dist/child-message--2G3Ft26.js +19 -0
  19. package/dist/cli/chat.js +18 -21
  20. package/dist/cli/check.js +4 -4
  21. package/dist/cli/main.js +2 -2
  22. package/dist/cli/plugins.js +5 -5
  23. package/dist/cli/snapshot-create.js +5 -5
  24. package/dist/cli/upgrade.d.ts +1 -1
  25. package/dist/cli/upgrade.js +23 -4
  26. package/dist/{config-kXB2Y5tl.js → config-BIfHKNXN.js} +40 -35
  27. package/dist/{continue-in-slack-O6pV5004.js → continue-in-slack-fnmD2Ifb.js} +5 -7
  28. package/dist/{conversation-feed-uNOv_x68.js → conversation-feed-DdFQuQDR.js} +13 -2
  29. package/dist/{logging-dQ9ZRGQ8.js → conversation-privacy-DtZhI91r.js} +188 -2
  30. package/dist/{conversation-turn-CeLbHqdw.js → conversation-turn-DScuDYmN.js} +465 -62
  31. package/dist/create-CrNt4Ewu.js +212 -0
  32. package/dist/{credential-sync-I8VBGk05.js → credential-sync-CtqsGjj1.js} +14 -18
  33. package/dist/{credentialed-Cb6E2phL.js → credentialed-dWRA3-oJ.js} +911 -429
  34. package/dist/{db-LAyyX8tk.js → db-BTmLKZrp.js} +2245 -50
  35. package/dist/{db-BbC5stfa.d.ts → db-DcmzbA55.d.ts} +2 -2
  36. package/dist/{history-CYstOMKX.js → history-CneKY7_V.js} +19 -1
  37. package/dist/{html-BCZ3Xtb_.js → html-B8rBt7F4.js} +5 -7
  38. package/dist/{install-DCFJFkC0.js → install-OtFboxOM.js} +2 -2
  39. package/dist/instrumentation.js +2 -2
  40. package/dist/{lineage-B_m-4TJw.js → lineage-EULJkGO1.js} +1 -2
  41. package/dist/{list-CN2QA2R9.js → list-C5400AlJ.js} +284 -113
  42. package/dist/{thread-state-DhPndWi1.js → mailbox-turn-DL3Lvsm0.js} +4830 -485
  43. package/dist/markers-DUP8aBOp.js +323 -0
  44. package/dist/{media-CYm1QD8T.js → media-FYM-Bl3H.js} +42 -14
  45. package/dist/{message-DSXGj1hM.js → message-DuDelZFr.js} +16 -15
  46. package/dist/{model-input--TrP9hYV.js → model-input-0osF3pBS.js} +3 -3
  47. package/dist/nitro.d.ts +2 -4
  48. package/dist/nitro.js +340 -13
  49. package/dist/{oauth-callback-server-DHCZC6B4.js → oauth-callback-server-DX2fQ7Nq.js} +2 -2
  50. package/dist/{oauth-relay-pPMGnDZt.js → oauth-relay-PwPMdZJv.js} +1 -1
  51. package/dist/{plugins-Bkk0XRo2.js → plugins-BXMdNdyA.js} +1 -1
  52. package/dist/{registry-CZOzddwu.js → registry-D6kS6xYH.js} +1402 -64
  53. package/dist/{statuses-_cRJHXK7.js → reporting-window-C4dbzDiR.js} +1 -27
  54. package/dist/{resolve-cKOQ14Dh.js → resolve-D8CPJcNK.js} +3 -3
  55. package/dist/result-D090hxr5.js +402 -0
  56. package/dist/{runner-DBfUW44l.js → runner-BU7fgrm-.js} +7 -8
  57. package/dist/{sandbox-egress-signals-BVF_xAm1.js → sandbox-egress-signals-BUmVrsoG.js} +1 -1
  58. package/dist/{schema-Bk9Nm2E8.js → schema-7gW9vBpJ.js} +91 -10
  59. package/dist/{schema-BEHKxr4I.d.ts → schema-BB6E0wyV.d.ts} +2105 -2753
  60. package/dist/{service-account-CVYsFjty.js → service-account-plA-uzIB.js} +6 -5
  61. package/dist/{skills-VTnhAJWm.js → skills-CIosT6bS.js} +3 -3
  62. package/dist/{slack-conversation-unfurl-fuLnF1jE.js → slack-conversation-unfurl-CBgZqth6.js} +8 -10
  63. package/dist/spawn-DRjdzh3R.js +46 -0
  64. package/dist/{start-conversation-CEn2KH1A.js → start-conversation-a4NXH4X9.js} +13 -202
  65. package/dist/{store-DFZaN-Ix.js → store-BuhF1QDm.js} +2 -4
  66. package/dist/{task-queue-Cx4Lmjyk.js → task-queue-CrRjFzOh.js} +5 -16
  67. package/dist/{task-runner-CbTwFA6k.js → task-runner-C-pXsgHM.js} +105 -51
  68. package/dist/{thread-context-BkAZDTX2.js → thread-context-CDX4dSZd.js} +8 -10
  69. package/dist/turn-session-routing-CZTRU8IY.js +116 -0
  70. package/dist/turn-wake-Bzq1Efrm.js +154 -0
  71. package/dist/user-customization-B27StpVQ.js +9 -0
  72. package/dist/{validation-nIzMtAVJ.js → validation-bTq88sya.js} +1 -1
  73. package/dist/{vercel-queue-hW90XzbG.js → vercel-queue-nL0Hq3hr.js} +32 -147
  74. package/dist/{version-Brbtz4Qf.js → version-DGUa1dZK.js} +1 -1
  75. package/dist/version.js +1 -1
  76. package/dist/{warmup-BDA5myRK.js → warmup-CCOuIwAS.js} +831 -3254
  77. package/dist/{worker-D63RcaVD.js → worker-AkZg7Dg1.js} +5 -6
  78. package/migrations/0158_keep_legacy_archive_columns.sql +5 -0
  79. package/migrations/0159_conversation_embeddings_fk_validate.sql +5 -0
  80. package/migrations/0160_money_micro_usd_repair.sql +99 -0
  81. package/migrations/0161_agent_config_backfill.sql +34 -0
  82. package/migrations/0162_inbox_item_deliveries.sql +15 -0
  83. package/migrations/0163_pg_trgm.sql +2 -0
  84. package/migrations/0164_search_indexes.sql +4 -0
  85. package/migrations/0165_drop_legacy_archive_columns.sql +4 -0
  86. package/migrations/0166_memory_prefix_index.sql +1 -0
  87. package/migrations/0167_todo_search_indexes.sql +2 -0
  88. package/migrations/0168_todo_inbox_items.sql +4 -0
  89. package/migrations/0169_drop_code_urls.sql +2 -0
  90. package/migrations/meta/0158_snapshot.json +6515 -0
  91. package/migrations/meta/0159_snapshot.json +6515 -0
  92. package/migrations/meta/0160_snapshot.json +6515 -0
  93. package/migrations/meta/0161_snapshot.json +6278 -0
  94. package/migrations/meta/0162_snapshot.json +6404 -0
  95. package/migrations/meta/0163_snapshot.json +6404 -0
  96. package/migrations/meta/0164_snapshot.json +6466 -0
  97. package/migrations/meta/0165_snapshot.json +6466 -0
  98. package/migrations/meta/0166_snapshot.json +6494 -0
  99. package/migrations/meta/0167_snapshot.json +6525 -0
  100. package/migrations/meta/0168_snapshot.json +6525 -0
  101. package/migrations/meta/0169_snapshot.json +6513 -0
  102. package/migrations/meta/_journal.json +84 -0
  103. package/package.json +9 -18
  104. package/skills/design-automation-skill/SKILL.md +2 -3
  105. package/dist/actor-BsBdxDXQ.js +0 -208
  106. package/dist/child-message-DcsritGf.js +0 -179
  107. package/dist/conversation-privacy-L4ja1_W6.js +0 -189
  108. package/dist/executor-SCub-fAq.js +0 -1860
  109. package/dist/fan-out-Cod-yEHG.js +0 -10
  110. package/dist/ingest-BDf3D50j.js +0 -3836
  111. package/dist/result-DcvEOe1r.js +0 -574
  112. package/dist/result-event-type-BdIJuZxg.js +0 -48
  113. package/dist/service-account-Ts4ulcrV.js +0 -931
  114. package/dist/spawn-vxAarlX5.js +0 -73
  115. package/dist/state-C1P3_Ywk.js +0 -161
@@ -1,10 +1,11 @@
1
1
  import { _ as withScope, a as getClient, 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-CPbZjomA.js";
2
- import { t as JUNIOR_VERSION } from "./version-Brbtz4Qf.js";
2
+ import { t as JUNIOR_VERSION } from "./version-DGUa1dZK.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";
6
6
  import { AsyncLocalStorage } from "node:async_hooks";
7
7
  import { randomUUID } from "node:crypto";
8
+ import { renderSystemMessageUpdate } from "@earendil-works/pi-ai";
8
9
  // src/chat/coerce.ts
9
10
  /** Narrow an unknown value to a non-empty string, or undefined. */
10
11
  function toOptionalString(value) {
@@ -1291,4 +1292,189 @@ function extractGenAiUsageAttributes(...sources) {
1291
1292
  ...cost?.total !== void 0 ? { "app.cost.total_usd": cost.total } : void 0
1292
1293
  };
1293
1294
  }
1294
- export { JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE as A, getDeploymentServiceVersion as B, summarizeMessageText as C, JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE as D, withSpan as E, JUNIOR_RETENTION_CRON_SCHEDULE as F, runWithLogAttributes as G, buildSentryConversationUrl as H, JUNIOR_RETENTION_ROUTE as I, normalizeIdentityEmail as J, GOOGLE_IDENTITY_PROVIDER 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, buildSentryEventUrl as U, getDeploymentTelemetryAttributes as V, formatSentryEventReference as W, toOptionalString as Y, 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, isNativeIdentityProvider 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, getDeploymentId as z };
1295
+ // src/chat/conversation-privacy.ts
1296
+ const SAFE_METADATA_KEY_LIMIT = 20;
1297
+ const conversationPrivacyStorage = new AsyncLocalStorage();
1298
+ /**
1299
+ * Resolve whether a Conversation may expose full transcript and tool data.
1300
+ *
1301
+ * Read visibility from the stored Conversation. If it is missing, warn and
1302
+ * treat the Conversation as private. Do not infer visibility from identifiers.
1303
+ */
1304
+ function resolveConversationPrivacy(input) {
1305
+ if (input.visibility === void 0) logWarn("conversation.visibility.defaulted");
1306
+ return input.visibility === "public" ? "public" : "private";
1307
+ }
1308
+ /** Return whether a public Conversation may expose transcript and tool data. */
1309
+ function canExposeConversationPayload(input) {
1310
+ return resolveConversationPrivacy(input) === "public";
1311
+ }
1312
+ /** Return privacy for the current agent Turn. */
1313
+ function getCurrentConversationPrivacy() {
1314
+ return conversationPrivacyStorage.getStore();
1315
+ }
1316
+ /** Bind one conversation privacy mode to all async work in a turn. */
1317
+ function runWithConversationPrivacy(privacy, callback) {
1318
+ return conversationPrivacyStorage.run(privacy, callback);
1319
+ }
1320
+ function payloadType(payload) {
1321
+ return Array.isArray(payload) ? "array" : typeof payload;
1322
+ }
1323
+ function payloadKeys(payload) {
1324
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) return;
1325
+ const keys = Object.keys(payload).slice(0, SAFE_METADATA_KEY_LIMIT);
1326
+ return keys.length > 0 ? keys : void 0;
1327
+ }
1328
+ function serializedLength(payload) {
1329
+ return (typeof payload === "string" ? payload : JSON.stringify(payload))?.length ?? 0;
1330
+ }
1331
+ /** Convert an arbitrary payload into safe structured metadata for trace data fields. */
1332
+ function toGenAiPayloadMetadata(payload) {
1333
+ const base = {
1334
+ type: payloadType(payload),
1335
+ chars: serializedLength(payload)
1336
+ };
1337
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) return base;
1338
+ const keys = payloadKeys(payload);
1339
+ return {
1340
+ ...base,
1341
+ ...keys ? { keys } : void 0
1342
+ };
1343
+ }
1344
+ /** Convert an arbitrary payload into safe flattened trace attributes. */
1345
+ function toGenAiPayloadTraceAttributes(prefix, payload) {
1346
+ const size = serializedLength(payload);
1347
+ const attributes = {
1348
+ [`${prefix}.type`]: payloadType(payload),
1349
+ [`${prefix}.size_chars`]: size,
1350
+ [`${prefix}.size`]: size
1351
+ };
1352
+ const keys = payloadKeys(payload);
1353
+ if (keys) attributes[`${prefix}.keys`] = keys;
1354
+ return attributes;
1355
+ }
1356
+ function summarizeContent(content) {
1357
+ if (typeof content === "string") return {
1358
+ chars: content.length,
1359
+ partTypes: ["text"]
1360
+ };
1361
+ if (!Array.isArray(content)) return {
1362
+ chars: serializedLength(content),
1363
+ partTypes: [payloadType(content)]
1364
+ };
1365
+ let chars = 0;
1366
+ const partTypes = /* @__PURE__ */ new Set();
1367
+ for (const part of content) {
1368
+ if (!part || typeof part !== "object") {
1369
+ chars += serializedLength(part);
1370
+ partTypes.add(payloadType(part));
1371
+ continue;
1372
+ }
1373
+ const record = part;
1374
+ const type = canonicalContentPartType(typeof record["type"] === "string" ? record["type"] : "unknown");
1375
+ partTypes.add(type);
1376
+ if (typeof record["text"] === "string") chars += record["text"].length;
1377
+ else if (typeof record["thinking"] === "string") chars += record["thinking"].length;
1378
+ else if (typeof record["data"] === "string") chars += record["data"].length;
1379
+ else chars += serializedLength(part);
1380
+ }
1381
+ return {
1382
+ chars,
1383
+ partTypes: [...partTypes]
1384
+ };
1385
+ }
1386
+ function normalizeFinishReason(reason) {
1387
+ return reason === "toolUse" ? "tool_call" : reason;
1388
+ }
1389
+ function canonicalContentPartType(type) {
1390
+ if (type === "thinking") return "reasoning";
1391
+ if (type === "toolCall") return "tool_call";
1392
+ return type;
1393
+ }
1394
+ function toCanonicalPart(part) {
1395
+ if (part.type === "text") return {
1396
+ type: "text",
1397
+ content: part.text
1398
+ };
1399
+ if (part.type === "thinking") {
1400
+ if (part.redacted) return;
1401
+ return {
1402
+ type: "reasoning",
1403
+ content: part.thinking
1404
+ };
1405
+ }
1406
+ if (part.type === "toolCall") return {
1407
+ type: "tool_call",
1408
+ id: part.id,
1409
+ name: part.name,
1410
+ arguments: part.arguments
1411
+ };
1412
+ }
1413
+ function toCanonicalParts(parts) {
1414
+ return parts.map(toCanonicalPart).filter((part) => part !== void 0);
1415
+ }
1416
+ /**
1417
+ * Map a pi-ai AssistantMessage to the canonical gen_ai.output.messages shape:
1418
+ * `{ role, parts: [...], finish_reason }` — drops provider noise fields.
1419
+ */
1420
+ function toCanonicalOutputMessage(message) {
1421
+ return {
1422
+ role: "assistant",
1423
+ parts: toCanonicalParts(message.content),
1424
+ finish_reason: normalizeFinishReason(message.stopReason)
1425
+ };
1426
+ }
1427
+ /**
1428
+ * Map a pi-ai Message (system/user/assistant/toolResult) to the canonical
1429
+ * gen_ai.input.messages shape: `{ role, parts: [...] }`.
1430
+ */
1431
+ function toCanonicalInputMessage(message) {
1432
+ if (message.role === "system") return {
1433
+ role: "system",
1434
+ parts: [{
1435
+ type: "text",
1436
+ content: renderSystemMessageUpdate(message)
1437
+ }]
1438
+ };
1439
+ if (message.role === "user") return {
1440
+ role: "user",
1441
+ parts: typeof message.content === "string" ? [{
1442
+ type: "text",
1443
+ content: message.content
1444
+ }] : toCanonicalParts(message.content)
1445
+ };
1446
+ if (message.role === "toolResult") return {
1447
+ role: "tool",
1448
+ parts: [{
1449
+ type: "tool_call_response",
1450
+ id: message.toolCallId,
1451
+ response: toCanonicalParts(message.content)
1452
+ }]
1453
+ };
1454
+ return toCanonicalOutputMessage(message);
1455
+ }
1456
+ /** Summarize a message list without exposing raw message content. */
1457
+ function toGenAiMessagesTraceAttributes(prefix, messages) {
1458
+ let contentChars = 0;
1459
+ const roles = /* @__PURE__ */ new Set();
1460
+ const partTypes = /* @__PURE__ */ new Set();
1461
+ for (const message of messages) {
1462
+ if (!message || typeof message !== "object") {
1463
+ contentChars += serializedLength(message);
1464
+ continue;
1465
+ }
1466
+ const record = message;
1467
+ if (typeof record["role"] === "string") roles.add(record["role"]);
1468
+ const summary = summarizeContent(record["content"]);
1469
+ contentChars += summary.chars;
1470
+ for (const partType of summary.partTypes) partTypes.add(partType);
1471
+ }
1472
+ return {
1473
+ [`${prefix}.message_count`]: messages.length,
1474
+ [`${prefix}.content_chars`]: contentChars,
1475
+ [`${prefix}.messages.size`]: contentChars,
1476
+ ...roles.size > 0 ? { [`${prefix}.roles`]: [...roles] } : void 0,
1477
+ ...partTypes.size > 0 ? { [`${prefix}.part_types`]: [...partTypes] } : void 0
1478
+ };
1479
+ }
1480
+ export { formatSentryEventReference as $, setSpanStatus as A, JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE as B, logInfo as C, serializeGenAiAttribute as D, runBestEffort as E, withSpan as F, JUNIOR_RETENTION_ROUTE as G, JUNIOR_HEARTBEAT_ROUTE as H, JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE as I, getDeploymentId as J, JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE as K, JUNIOR_AUTO_ARCHIVE_ROUTE as L, summarizeMessageText as M, withContext as N, setSentryUser as O, withLogContext as P, buildSentryEventUrl as Q, JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE as R, logException as S, normalizeGenAiFinishReason as T, JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE as U, JUNIOR_HEARTBEAT_CRON_SCHEDULE as V, JUNIOR_RETENTION_CRON_SCHEDULE as W, getDeploymentTelemetryAttributes as X, getDeploymentServiceVersion as Y, buildSentryConversationUrl as Z, getLogContextAttributes as _, toCanonicalInputMessage as a, logAudit as b, toGenAiPayloadMetadata as c, createChatSdkLogger as d, runWithLogAttributes as et, createRequestContext as f, getActiveTraceId as g, getActiveTraceContext as h, runWithConversationPrivacy as i, toOptionalString as it, setTags as j, setSpanAttributes as k, toGenAiPayloadTraceAttributes as l, extractGenAiUsageSummary as m, getCurrentConversationPrivacy as n, isNativeIdentityProvider as nt, toCanonicalOutputMessage as o, extractGenAiUsageAttributes as p, LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION as q, resolveConversationPrivacy as r, normalizeIdentityEmail as rt, toGenAiMessagesTraceAttributes as s, canExposeConversationPayload as t, GOOGLE_IDENTITY_PROVIDER as tt, buildTurnFailureResponse as u, getLogContextAttributesForSpan as v, logWarn as w, logError as x, getTracePropagationHeaders as y, JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE as z };