@sentry/junior 0.313.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.
- package/dist/{adapter-CYAvJzZS.js → adapter-JARQvoLw.js} +1 -2
- package/dist/{adapter-context-CVsHoVSf.js → adapter-context-B4BrJZuS.js} +2 -2
- package/dist/{admin-Cyhb4TwZ.js → admin-BXGAySz0.js} +1 -1
- package/dist/{agent-runner-B5y9MsT-.js → agent-runner-qZU5TR8i.js} +797 -118
- package/dist/agent-update-cS7Z9mnG.js +26 -0
- package/dist/agent-update-delivery-CZ5M8RDa.js +85 -0
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +6 -6
- package/dist/api.d.ts +1 -1
- package/dist/api.js +334 -100
- package/dist/{app-DA8-hCMj.d.ts → app-D7tKnw9a.d.ts} +4 -21
- package/dist/app.d.ts +2 -2
- package/dist/app.js +80 -169
- package/dist/{background-compaction-queue-iZXadLV3.js → background-compaction-queue-C_uIBUvS.js} +6 -67
- package/dist/callback-C8SdXCwr.js +68 -0
- package/dist/{catalog-runtime-kkE3hvCX.js → catalog-runtime-BLKtnUL3.js} +1 -1
- package/dist/{channel-access-mt7K6dPh.js → channel-access-BOL29BG3.js} +6 -6
- package/dist/child-message--2G3Ft26.js +19 -0
- package/dist/cli/chat.js +18 -21
- package/dist/cli/check.js +4 -4
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +5 -5
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +23 -4
- package/dist/{config-CWbwKj0j.js → config-BIfHKNXN.js} +40 -35
- package/dist/{continue-in-slack-CxyFzdlF.js → continue-in-slack-fnmD2Ifb.js} +5 -7
- package/dist/{conversation-feed-BEXLD3Me.js → conversation-feed-DdFQuQDR.js} +1 -1
- package/dist/{logging-DNt-qOIO.js → conversation-privacy-DtZhI91r.js} +188 -2
- package/dist/{conversation-turn-B35eu0uz.js → conversation-turn-DScuDYmN.js} +418 -33
- package/dist/create-CrNt4Ewu.js +212 -0
- package/dist/{credential-sync-DWTOEQrm.js → credential-sync-CtqsGjj1.js} +14 -17
- package/dist/{credentialed-Dyv8b-lu.js → credentialed-dWRA3-oJ.js} +910 -426
- package/dist/{db-PwSRzWWn.js → db-BTmLKZrp.js} +2235 -38
- package/dist/{db-DYGcXYl3.d.ts → db-DcmzbA55.d.ts} +2 -2
- package/dist/{history-CYstOMKX.js → history-CneKY7_V.js} +19 -1
- package/dist/{html-DidUcRhI.js → html-B8rBt7F4.js} +5 -7
- package/dist/{install-2urLLXNt.js → install-OtFboxOM.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{lineage-BXplQAVH.js → lineage-EULJkGO1.js} +1 -2
- package/dist/{list-DyIyReSV.js → list-C5400AlJ.js} +235 -77
- package/dist/{turn-membership-DTR3SaKD.js → mailbox-turn-DL3Lvsm0.js} +4698 -587
- package/dist/markers-DUP8aBOp.js +323 -0
- package/dist/{media-B0pZJ0bG.js → media-FYM-Bl3H.js} +33 -8
- package/dist/{message-Z5YKC-Af.js → message-DuDelZFr.js} +16 -29
- package/dist/{model-input-BhPJYdSV.js → model-input-0osF3pBS.js} +3 -3
- package/dist/nitro.d.ts +2 -4
- package/dist/nitro.js +340 -13
- package/dist/{oauth-callback-server-ByvDdcdY.js → oauth-callback-server-DX2fQ7Nq.js} +2 -2
- package/dist/{oauth-relay-D-kK0yoN.js → oauth-relay-PwPMdZJv.js} +1 -1
- package/dist/{plugins-Bkk0XRo2.js → plugins-BXMdNdyA.js} +1 -1
- package/dist/{registry-POH4bZC4.js → registry-D6kS6xYH.js} +1402 -64
- package/dist/{resolve-CWtBNSKP.js → resolve-D8CPJcNK.js} +3 -3
- package/dist/result-D090hxr5.js +402 -0
- package/dist/{runner-CsZ_VRxp.js → runner-BU7fgrm-.js} +7 -8
- package/dist/{sandbox-egress-signals-FbCk1FkN.js → sandbox-egress-signals-BUmVrsoG.js} +1 -1
- package/dist/{schema-DojR2uCL.js → schema-7gW9vBpJ.js} +90 -9
- package/dist/{schema-DBf18QPS.d.ts → schema-BB6E0wyV.d.ts} +138 -5
- package/dist/{service-account-CDYb9hfX.js → service-account-plA-uzIB.js} +6 -5
- package/dist/{skills-B0jP4whm.js → skills-CIosT6bS.js} +3 -3
- package/dist/{slack-conversation-unfurl-D26t9kBC.js → slack-conversation-unfurl-CBgZqth6.js} +8 -10
- package/dist/{spawn-BjljgExZ.js → spawn-DRjdzh3R.js} +9 -17
- package/dist/{start-conversation-DbVujrwO.js → start-conversation-a4NXH4X9.js} +12 -15
- package/dist/{store-CjXrp-Up.js → store-BuhF1QDm.js} +2 -4
- package/dist/{task-queue-Cwlatjz3.js → task-queue-CrRjFzOh.js} +5 -16
- package/dist/{task-runner--Ke8KSMf.js → task-runner-C-pXsgHM.js} +104 -50
- package/dist/{thread-context-B8exINEe.js → thread-context-CDX4dSZd.js} +8 -9
- package/dist/turn-session-routing-CZTRU8IY.js +116 -0
- package/dist/turn-wake-Bzq1Efrm.js +154 -0
- package/dist/user-customization-B27StpVQ.js +9 -0
- package/dist/{validation-Ce0qbMlT.js → validation-bTq88sya.js} +1 -1
- package/dist/{vercel-queue-q4z8w5QO.js → vercel-queue-nL0Hq3hr.js} +32 -147
- package/dist/{version-DFh4n9nr.js → version-DGUa1dZK.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{warmup-D5hzqTcp.js → warmup-CCOuIwAS.js} +639 -137
- package/dist/{worker-CDg9Lbpg.js → worker-AkZg7Dg1.js} +5 -6
- package/migrations/0160_money_micro_usd_repair.sql +99 -0
- package/migrations/0161_agent_config_backfill.sql +34 -0
- package/migrations/0162_inbox_item_deliveries.sql +15 -0
- package/migrations/0163_pg_trgm.sql +2 -0
- package/migrations/0164_search_indexes.sql +4 -0
- package/migrations/0165_drop_legacy_archive_columns.sql +4 -0
- package/migrations/0166_memory_prefix_index.sql +1 -0
- package/migrations/0167_todo_search_indexes.sql +2 -0
- package/migrations/0168_todo_inbox_items.sql +4 -0
- package/migrations/0169_drop_code_urls.sql +2 -0
- package/migrations/meta/0160_snapshot.json +6515 -0
- package/migrations/meta/0161_snapshot.json +6278 -0
- package/migrations/meta/0162_snapshot.json +6404 -0
- package/migrations/meta/0163_snapshot.json +6404 -0
- package/migrations/meta/0164_snapshot.json +6466 -0
- package/migrations/meta/0165_snapshot.json +6466 -0
- package/migrations/meta/0166_snapshot.json +6494 -0
- package/migrations/meta/0167_snapshot.json +6525 -0
- package/migrations/meta/0168_snapshot.json +6525 -0
- package/migrations/meta/0169_snapshot.json +6513 -0
- package/migrations/meta/_journal.json +70 -0
- package/package.json +9 -18
- package/skills/design-automation-skill/SKILL.md +2 -3
- package/dist/actor-BsBdxDXQ.js +0 -208
- package/dist/conversation-privacy-BrMiDN61.js +0 -189
- package/dist/executor-CgWyWfYz.js +0 -1858
- package/dist/fan-out-Cod-yEHG.js +0 -10
- package/dist/ingest-B0AggUEC.js +0 -7931
- package/dist/request-deadline-BUiRYQYj.js +0 -24
- package/dist/service-account-o15pZWcJ.js +0 -931
- package/dist/state-BTawTCme.js +0 -161
- package/dist/statuses-BKwqCPhj.js +0 -69
|
@@ -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-
|
|
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
|
-
|
|
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 };
|