@sentry/junior 0.317.0 → 0.319.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-8_S6Birm.js +1833 -0
- package/dist/{admin-CAugg87B.js → admin-EsbUON1j.js} +1 -1
- package/dist/{agent-runner-AjrEV6Qe.js → agent-CtzMl32d.js} +19953 -6727
- package/dist/{agent-status-BA5x3Xtp.js → agent-status-Bq_AIpyp.js} +105 -1
- package/dist/{agent-update-delivery-B_YIZcgf.js → agent-update-delivery-pAvsbuGL.js} +4 -5
- package/dist/api/schema.d.ts +85 -51
- package/dist/api/schema.js +4 -4
- package/dist/api.js +81 -94
- package/dist/{app-MoNAsVV5.d.ts → app-tACXxJPI.d.ts} +8 -13
- package/dist/app.d.ts +2 -2
- package/dist/app.js +246 -153
- package/dist/{change-record-BzJgLsv7.d.ts → change-record-K-KsqNhT.d.ts} +9 -5
- package/dist/{channel-access-j-YAVYK4.js → channel-access-DET5hzZM.js} +1 -1
- package/dist/{chat-core-engine-aH85nEHv.js → chat-core-engine-DpM3tMVi.js} +7 -7
- package/dist/cli/chat.d.ts +1 -1
- package/dist/cli/chat.js +38 -30
- package/dist/cli/check.js +5 -5
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.d.ts +1 -1
- package/dist/cli/plugins.js +8 -8
- package/dist/cli/snapshot-create.js +5 -6
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -4
- package/dist/{continue-in-slack-D-FZ8Fin.js → continue-in-slack-CFzDyxkH.js} +3 -2
- package/dist/{conversation-feed--9S0_PXL.js → conversation-feed-DEUdD7mb.js} +2 -106
- package/dist/{conversation-privacy-B1uXn5sf.js → conversation-privacy-C2vYK55O.js} +1 -1
- package/dist/{create-DoDIYgtZ.js → create-Ta3SEIB5.js} +124 -16
- package/dist/{credential-sync-BJOqGnjV.js → credential-sync-DyRqDmY4.js} +17 -20
- package/dist/{db-BFmyYZtJ.js → db-BCaNWl9p.js} +6536 -1920
- package/dist/{deployment-DXq9ZLU4.js → deployment-CfOew1Tm.js} +3 -3
- package/dist/{engine-context-CgQ7mlHt.js → engine-context-CiExoy1B.js} +181 -155
- package/dist/{html-B3VKTGbJ.js → html-Bb2Si1bR.js} +6 -8
- package/dist/instrumentation.js +7 -23
- package/dist/list-wwDcROh9.js +5007 -0
- package/dist/{logging--smS7XRK.js → logging-BRPTXAdf.js} +10 -81
- package/dist/{mailbox-turn-uSXhUFc9.js → markers-9QoqW5ov.js} +1875 -1458
- package/dist/nitro.d.ts +2 -2
- package/dist/nitro.js +7 -8
- package/dist/{oauth-callback-server-CE4soEIY.js → oauth-callback-server-vhL9b-PZ.js} +2 -2
- package/dist/{oauth-relay-C36gX1gH.js → oauth-relay-CH2v7WiB.js} +1 -1
- package/dist/{plugins-fBrz8PCV.d.ts → plugins-DhGXZjlu.d.ts} +1 -0
- package/dist/{profile-BQ-iBDsZ.js → profile-D9LdwmZi.js} +17 -19
- package/dist/{prompt-Dv7gkpD6.js → prompt-3TqxEOtc.js} +10 -10
- package/dist/{reports-WKHfGTsU.js → reports-K-tbtEyx.js} +2 -2
- package/dist/{resolve-tony4ibz.js → resolve-BBV2qf8A.js} +5 -5
- package/dist/{result-Bta_dlWa.js → result-5IdGJP4M.js} +24 -13
- package/dist/{runner-BstDRbD9.js → runner-BK_joPlM.js} +9 -18
- package/dist/{sandbox-egress-signals-oSJMJOnn.js → sandbox-egress-signals-DXgWXXmm.js} +1 -1
- package/dist/{schema-DfqrHACA.js → schema-zWGG6VC1.js} +13 -7
- package/dist/{service-account-CTV_jaNu.js → service-account-CateFyhw.js} +4 -5
- package/dist/{skills-BCEU41zM.js → skills-Ccjw8h2P.js} +10 -9
- package/dist/{slack-conversation-unfurl-DxVmhbGP.js → slack-conversation-unfurl-ZC_TSpc4.js} +7 -7
- package/dist/storage-C9U7R5rM.js +273 -0
- package/dist/{system-prompt-table-CiXy0eNR.js → system-prompt-table-YBTHIFlP.js} +26 -84
- package/dist/topic-B2EWKKBT.js +6 -0
- package/dist/{package-discovery-DD9vencX.js → topics-DxuKurCX.js} +21 -1
- package/dist/{types-C4iC-IMC.js → types-BNHkJrOP.js} +79 -59
- package/dist/{users-ByG5RCEJ.js → users-CCRAqYb_.js} +1 -1
- package/dist/{validation-8gjfR91V.js → validation-BCUpJa8K.js} +4 -4
- package/dist/{version-BeZhWWBE.js → version-BNm0JYj3.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-BqMQQNRk.js → worker-BhgpZ7_b.js} +5 -5
- package/migrations/20261127002500_turn_discarded_usage/migration.sql +2 -0
- package/migrations/20261127002500_turn_discarded_usage/snapshot.json +73 -0
- package/migrations/20261127052408_space_name_nullable/migration.sql +5 -0
- package/migrations/20261127052408_space_name_nullable/snapshot.json +29 -0
- package/migrations/20261127060000_annotation_object_id_index/migration.sql +1 -0
- package/migrations/20261127060000_annotation_object_id_index/snapshot.json +69 -0
- package/migrations/20261127060001_annotation_subjects/migration.sql +78 -0
- package/migrations/20261127060001_annotation_subjects/snapshot.json +104 -0
- package/migrations/20261127060002_annotation_subject_index/migration.sql +1 -0
- package/migrations/20261127060002_annotation_subject_index/snapshot.json +70 -0
- package/migrations/20261127060003_annotation_title_url/migration.sql +84 -0
- package/migrations/20261127060003_annotation_title_url/snapshot.json +73 -0
- package/package.json +9 -7
- package/dist/catalog-runtime-DfSpJZdY.js +0 -6
- package/dist/child-message-DHjQLEd1.js +0 -19
- package/dist/config-CHQ8X251.js +0 -2422
- package/dist/conversation-turn-BUE_7xaN.js +0 -1157
- package/dist/job-runner-A1lCkybD.js +0 -1506
- package/dist/lineage-Bktb0UcV.js +0 -36
- package/dist/list-Bxvg5wXf.js +0 -12623
- package/dist/message-BNenhsmB.js +0 -154
- package/dist/model-input-BReSnwHp.js +0 -82
- package/dist/parent-result-Ck1rFYRQ.js +0 -310
- package/dist/registry-iXMT5Jmh.js +0 -3279
- package/dist/run-conversation-DL6ru7iW.js +0 -336
- package/dist/sender-actors-CPglLd5R.js +0 -83
- package/dist/spawn-frczVPIr.js +0 -48
- package/dist/task-runner-C9Yc2_ae.js +0 -1526
- package/dist/thread-context-CqZDKErp.js +0 -166
- package/dist/topic-CRYYBYp-.js +0 -7
- package/dist/topics-SRN7IVX-.js +0 -24
- package/dist/turn-membership-CENFf3kI.js +0 -856
- package/dist/turn-wake-BhloiI2h.js +0 -151
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as withScope,
|
|
2
|
-
import { _ as getDeploymentTelemetryAttributes } from "./deployment-
|
|
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-CPbZjomA.js";
|
|
2
|
+
import { _ as getDeploymentTelemetryAttributes } from "./deployment-CfOew1Tm.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";
|
|
@@ -103,79 +103,12 @@ function getBoundLogContext() {
|
|
|
103
103
|
function getBoundLogAttributes() {
|
|
104
104
|
return logContextStorage.getStore() ?? {};
|
|
105
105
|
}
|
|
106
|
-
// src/chat/sentry-links.ts
|
|
107
|
-
function getSentryOrgSlug() {
|
|
108
|
-
return process.env["SENTRY_ORG_SLUG"]?.trim() || void 0;
|
|
109
|
-
}
|
|
110
|
-
function isSentrySaasDsnHost(host) {
|
|
111
|
-
return host === "sentry.io" || host.endsWith(".sentry.io");
|
|
112
|
-
}
|
|
113
|
-
function buildSentryWebBaseUrl(dsn) {
|
|
114
|
-
if (isSentrySaasDsnHost(dsn.host)) return "https://sentry.io";
|
|
115
|
-
const port = dsn.port ? `:${dsn.port}` : "";
|
|
116
|
-
const path = dsn.path ? `/${dsn.path}` : "";
|
|
117
|
-
return `${dsn.protocol}://${dsn.host}${port}${path}`;
|
|
118
|
-
}
|
|
119
|
-
function buildSentryOrgPath(args) {
|
|
120
|
-
const dsn = getClient()?.getDsn();
|
|
121
|
-
if (!dsn?.host || !dsn.projectId) return;
|
|
122
|
-
const orgSlug = getSentryOrgSlug();
|
|
123
|
-
if (!orgSlug) return;
|
|
124
|
-
const params = new URLSearchParams();
|
|
125
|
-
params.set("project", dsn.projectId);
|
|
126
|
-
if (args.query) for (const [key, value] of Object.entries(args.query)) params.set(key, value);
|
|
127
|
-
const path = `${args.path}?${params.toString()}`;
|
|
128
|
-
if (isSentrySaasDsnHost(dsn.host)) return `https://${orgSlug}.sentry.io/${path}`;
|
|
129
|
-
return `${buildSentryWebBaseUrl(dsn)}/organizations/${orgSlug}/${path}`;
|
|
130
|
-
}
|
|
131
|
-
/** Build a Sentry conversation URL only when the runtime has enough Sentry config. */
|
|
132
|
-
function buildSentryConversationUrl(conversationId) {
|
|
133
|
-
return buildSentryOrgPath({ path: `explore/conversations/${encodeURIComponent(conversationId)}/` });
|
|
134
|
-
}
|
|
135
|
-
/** Build a Sentry event URL only when the runtime has enough Sentry config. */
|
|
136
|
-
function buildSentryEventUrl(eventId) {
|
|
137
|
-
return buildSentryOrgPath({
|
|
138
|
-
path: "issues/",
|
|
139
|
-
query: { query: eventId }
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
/** Format a failure reference, linked to the Sentry event when the runtime can build the URL. */
|
|
143
|
-
function formatSentryEventReference(eventId) {
|
|
144
|
-
const reference = `event_id=${eventId}`;
|
|
145
|
-
const url = buildSentryEventUrl(eventId);
|
|
146
|
-
return url ? `[${reference}](${url})` : `\`${reference}\``;
|
|
147
|
-
}
|
|
148
106
|
// src/chat/logging.ts
|
|
149
107
|
/**
|
|
150
|
-
* Structured logging for Junior runtime events
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
* `
|
|
154
|
-
* specific to that occurrence:
|
|
155
|
-
*
|
|
156
|
-
* `logWarn("agent.turn.empty_output.exhausted", {
|
|
157
|
-
* "app.ai.empty_output.attempt": 1,
|
|
158
|
-
* })`
|
|
159
|
-
*
|
|
160
|
-
* Event names describe the semantic domain, operation, and outcome. They are
|
|
161
|
-
* lowercase, use dots for namespaces, use snake case within a namespace
|
|
162
|
-
* component, and never contain identifiers or other occurrence-specific data.
|
|
163
|
-
* Use singular domain and operation nouns unless one event represents a real
|
|
164
|
-
* collection. End completed events with a past participle such as `completed`,
|
|
165
|
-
* `failed`, or `skipped`; reserve present participles such as `retrying` for
|
|
166
|
-
* work currently underway, and adjectives such as `busy` for observed states.
|
|
167
|
-
*
|
|
168
|
-
* Correlation context is implicit. Bind authoritative request, conversation,
|
|
169
|
-
* actor, destination, and run context once with `withContext`,
|
|
170
|
-
* `withLogContext`, or `withSpan`; nested logs inherit it through
|
|
171
|
-
* AsyncLocalStorage, and active trace/span IDs are attached during emission.
|
|
172
|
-
* Durable boundaries such as queues and callbacks must still carry and
|
|
173
|
-
* reconstruct their context explicitly before binding it.
|
|
174
|
-
*
|
|
175
|
-
* Internal event calls do not provide a human-readable body. Export adapters
|
|
176
|
-
* derive any required display message from the event name. Free-form messages
|
|
177
|
-
* received from libraries or plugins belong in safe attributes at the adapter
|
|
178
|
-
* boundary.
|
|
108
|
+
* Structured logging for Junior runtime events: a stable event name plus the
|
|
109
|
+
* attributes of one occurrence. `policies/observability.md` owns the naming
|
|
110
|
+
* and emission rules. Bind context once with `withContext`, `withLogContext`,
|
|
111
|
+
* or `withSpan`; durable boundaries must carry it explicitly.
|
|
179
112
|
*/
|
|
180
113
|
const MAX_STRING_VALUE = 1200;
|
|
181
114
|
const EVENT_NAME_PATTERN = /^[a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)+$/;
|
|
@@ -867,7 +800,7 @@ function createChatSdkLoggerImpl(category, minimumLevel) {
|
|
|
867
800
|
}
|
|
868
801
|
};
|
|
869
802
|
}
|
|
870
|
-
/** Create a Chat SDK logger that
|
|
803
|
+
/** Create a Chat SDK logger that writes through Junior's logging. */
|
|
871
804
|
function createChatSdkLogger() {
|
|
872
805
|
return createChatSdkLoggerImpl(["chat-sdk"], resolveChatSdkLogLevel());
|
|
873
806
|
}
|
|
@@ -883,7 +816,7 @@ function withLogContext(context, callback) {
|
|
|
883
816
|
function getLogContextAttributes() {
|
|
884
817
|
return getBoundLogAttributes();
|
|
885
818
|
}
|
|
886
|
-
/**
|
|
819
|
+
/** Inherited log context, limited to attributes valid for the span op. */
|
|
887
820
|
function getLogContextAttributesForSpan(op) {
|
|
888
821
|
const attributes = { ...getLogContextAttributes() };
|
|
889
822
|
delete attributes["gen_ai.request.model"];
|
|
@@ -1011,7 +944,7 @@ function logException(error, eventName, attributes = {}) {
|
|
|
1011
944
|
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
1012
945
|
return log.exception(eventName, normalizedError, attributes);
|
|
1013
946
|
}
|
|
1014
|
-
/** Run an optional side effect without changing the
|
|
947
|
+
/** Run an optional side effect without changing the primary outcome. */
|
|
1015
948
|
async function runBestEffort(operation, eventName, attributes = {}) {
|
|
1016
949
|
try {
|
|
1017
950
|
await operation();
|
|
@@ -1099,10 +1032,6 @@ function getActiveTraceId() {
|
|
|
1099
1032
|
return;
|
|
1100
1033
|
}
|
|
1101
1034
|
}
|
|
1102
|
-
/** Build the static user-facing response for a failed turn. */
|
|
1103
|
-
function buildTurnFailureResponse(eventId) {
|
|
1104
|
-
return `I ran into an internal error while processing that. Reference: ${formatSentryEventReference(eventId)}.`;
|
|
1105
|
-
}
|
|
1106
1035
|
const GEN_AI_DEFAULT_MAX_ATTRIBUTE_CHARS = 1e5;
|
|
1107
1036
|
const GEN_AI_MAX_ARRAY_ITEMS = 50;
|
|
1108
1037
|
const GEN_AI_MAX_OBJECT_KEYS = 50;
|
|
@@ -1248,4 +1177,4 @@ function extractGenAiUsageAttributes(...sources) {
|
|
|
1248
1177
|
...cost?.total !== void 0 ? { "app.cost.total_usd": cost.total } : void 0
|
|
1249
1178
|
};
|
|
1250
1179
|
}
|
|
1251
|
-
export {
|
|
1180
|
+
export { toOptionalString as A, withContext as C, GOOGLE_IDENTITY_PROVIDER as D, runWithLogAttributes as E, isNativeIdentityProvider as O, summarizeMessageText as S, withSpan as T, serializeGenAiAttribute as _, getActiveTraceContext as a, setSpanStatus as b, getLogContextAttributesForSpan as c, logError as d, logException as f, runBestEffort as g, normalizeGenAiFinishReason as h, extractGenAiUsageSummary as i, normalizeIdentityEmail as k, getTracePropagationHeaders as l, logWarn as m, createRequestContext as n, getActiveTraceId as o, logInfo as p, extractGenAiUsageAttributes as r, getLogContextAttributes as s, createChatSdkLogger as t, logAudit as u, setSentryUser as v, withLogContext as w, setTags as x, setSpanAttributes as y };
|