@sentry/junior 0.257.0 → 0.259.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/{actor-BTtLaeWy.js → actor-tlxzqaRe.js} +3 -6
- package/dist/adapter-Bn0gFVSF.js +270 -0
- package/dist/{admin-DgIkm6Vy.js → admin-C8xz2f10.js} +2 -3
- package/dist/{agent-hooks-BjtTzvru.js → agent-hooks-B00FaKdP.js} +70 -109
- package/dist/{agent-invocations-Bdu3ROfo.js → agent-invocations-Qfz7dWgU.js} +6 -12
- package/dist/{agent-runner-D7OboVb3.js → agent-runner-CPSd7rKm.js} +324 -742
- package/dist/api/schema.d.ts +442 -447
- package/dist/api/schema.js +6 -6
- package/dist/api.d.ts +2 -12
- package/dist/api.js +165 -158
- package/dist/{app-BsU5QNBd.d.ts → app-Bbxrehjf.d.ts} +25 -45
- package/dist/app.d.ts +3 -3
- package/dist/app.js +206 -321
- package/dist/{assistant-reply-CbTPebzL.js → assistant-reply-CqthTerd.js} +3 -5
- package/dist/{automation-CHdlHVZP.js → automation-DWBFBenG.js} +6 -11
- package/dist/{briefs-oLOldnDM.js → briefs-DNYbQ9cD.js} +8 -11
- package/dist/{cadence-D00SCzT1.js → cadence-R7Em4RjE.js} +1 -2
- package/dist/{catalog-runtime-CZzhGQ7F.js → catalog-runtime-B8SuFPGb.js} +3 -4
- package/dist/cli/chat.d.ts +2 -4
- package/dist/cli/chat.js +22 -24
- package/dist/cli/check.d.ts +1 -3
- package/dist/cli/check.js +4 -5
- package/dist/cli/env.d.ts +1 -3
- package/dist/cli/env.js +1 -2
- package/dist/cli/init.d.ts +1 -3
- package/dist/cli/init.js +3 -3
- package/dist/cli/main.d.ts +1 -3
- package/dist/cli/main.js +8 -5
- package/dist/cli/plugins.d.ts +2 -4
- package/dist/cli/plugins.js +7 -8
- package/dist/cli/run.d.ts +3 -3
- package/dist/cli/run.js +3 -3
- package/dist/cli/snapshot-create.d.ts +1 -3
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.d.ts +3 -6
- package/dist/cli/upgrade.js +11 -17
- package/dist/{client-D8HnkOQX.js → client-BZdxgKyL.js} +64 -18
- package/dist/{config-CJRnWK9H.js → config-Deqpfpg9.js} +21 -15
- package/dist/{connections-ClYrKzpX.js → connections-9gJkfS85.js} +179 -20
- package/dist/{conversation-CKNLYBJt.js → conversation-DjN3mlog.js} +8 -15
- package/dist/{conversation-privacy-C8b1nphZ.js → conversation-privacy-CFhNKxp-.js} +2 -3
- package/dist/{conversation-work-C6y3T5Hx.js → conversation-work-BaT_T6EB.js} +1 -2
- package/dist/{credential-sync-BXfohNmJ.js → credential-sync-BABGymK3.js} +23 -190
- package/dist/{db-Ca9Nt5ci.d.ts → db-BnRqQ7G5.d.ts} +1 -1
- package/dist/{executor-Do0THDRR.js → executor-Bb3eQb8q.js} +30 -52
- package/dist/{experimental-CQIvMUO7.js → experimental-BNK1l1jv.js} +2 -4
- package/dist/{history-9pO1Zd4Y.js → history-AY8rs-FR.js} +5 -9
- package/dist/{history-DvqWZlYX.d.ts → history-BgI33Kie.d.ts} +12 -20
- package/dist/{images-BN_BiBXF.js → images-BbSdVHC6.js} +5 -6
- package/dist/instrumentation.d.ts +1 -3
- package/dist/instrumentation.js +6 -8
- package/dist/{job-queue-B6SV9uVa.js → job-queue-vdGU-5ge.js} +6 -12
- package/dist/{logging-CWxiIuCF.js → logging-BStXN56b.js} +7 -12
- package/dist/{message-TUOdbSBW.js → message-DRf6m4uO.js} +5 -6
- package/dist/{model-profile-BwU8mqwD.js → model-profile-Bg8EoCKD.js} +2 -4
- package/dist/nitro.d.ts +3 -5
- package/dist/nitro.js +12 -17
- package/dist/{oauth-authorization-BA4Dt6a7.js → oauth-authorization-djQn5Nhy.js} +2 -4
- package/dist/{oauth-callback-server-Dj5UJODo.js → oauth-callback-server-JmOgLcGl.js} +3 -4
- package/dist/{oauth-relay-CdCnu80W.js → oauth-relay-CTygMkNx.js} +2 -3
- package/dist/{package-discovery-BVvSnQBB.js → package-discovery-DJBompdd.js} +17 -21
- package/dist/{pending-auth-s_QFribU.js → pending-auth-rG5U_QS1.js} +92 -83
- package/dist/{plugin-module-CVvEUSMH.js → plugin-module-Cf5gVPWP.js} +1 -2
- package/dist/{plugins-CjfUP5gJ.d.ts → plugins-B_0Cr0MO.d.ts} +5 -5
- package/dist/{plugins-egKWjgue.js → plugins-DOm9Y6qI.js} +2 -3
- package/dist/{private-trace-result-BLvBjy_e.js → private-trace-result-CE7_lEdq.js} +1 -2
- package/dist/{profile-h-72wM78.js → profile-qBM6B_-V.js} +14 -295
- package/dist/{prompt-DyoEj9c2.js → prompt-xgpyMtg7.js} +5 -9
- package/dist/{queue-B5SnqRln.d.ts → queue-C37RbDVc.d.ts} +0 -2
- package/dist/{registry-sLTr-sV9.js → registry-B_M_x_iS.js} +56 -30
- package/dist/{resolve-ncQPZROQ.js → resolve-BzpuLh8c.js} +8 -12
- package/dist/{result-C883vngT.js → result-DEZH_AnZ.js} +13 -17
- package/dist/{rolldown-runtime-B4FMCO8f.js → rolldown-runtime-nwUcYXjP.js} +1 -2
- package/dist/{runner-CzYImdOF.js → runner-BqQlG10t.js} +12 -13
- package/dist/{sandbox-egress-signals-CZbMINHI.js → sandbox-egress-signals-DCq3WLs5.js} +2 -3
- package/dist/{schema-Dy69D4Ge.js → schema-CF9HqNRY.js} +30 -27
- package/dist/{sentry-CgWZM_kV.js → sentry-BBUlHih9.js} +2 -3
- package/dist/service-account-BqTBkyD7.js +120 -0
- package/dist/service-account-BzhW7kXu.js +661 -0
- package/dist/{session-stop-CQjKd4a2.js → session-stop-CV65ZlU3.js} +23 -33
- package/dist/{skills-C22SLruK.js → skills-CiWS5_Ub.js} +9 -9
- package/dist/{spawn-DY9CLXDL.js → spawn-BSAQ7UQZ.js} +4 -5
- package/dist/{store-DXFIQy-G.js → store-B1GES4gC.js} +13 -15
- package/dist/{store-DoewL5mG.d.ts → store-CG0VJyye.d.ts} +0 -14
- package/dist/{task-queue-B17vV0La.js → task-queue-BAeGEMjJ.js} +5 -7
- package/dist/{task-runner-DUjvzYXj.js → task-runner-BlGhcQPi.js} +22 -26
- package/dist/{tasks-D_WIJtvO.js → tasks-DieKX3d4.js} +63 -78
- package/dist/{thread-state-Ch4yuCqG.js → thread-state-DpSWS4Rr.js} +13 -19
- package/dist/{turn-failure-response-C5nBKC4S.js → turn-failure-response-DQljogGJ.js} +16 -22
- package/dist/{turn-lifecycle-CO-ylUmV.js → turn-lifecycle-BLgrkV_L.js} +2 -3
- package/dist/{turn-session-routing-B3LWooK5.js → turn-session-routing-BlajheOU.js} +2 -3
- package/dist/{validation-CXYxaNYx.js → validation-23d7K9tX.js} +3 -4
- package/dist/vercel.d.ts +1 -3
- package/dist/vercel.js +1 -2
- package/dist/{version-BcdZy2zg.js → version-B_XumRx-.js} +3 -5
- package/dist/{version-CnXZ614E.d.ts → version-Cc2OFd9G.d.ts} +0 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -2
- package/dist/{viewer-DSZXygMU.js → viewer-B2_ABsYi.js} +26 -57
- package/dist/{web-input-B9Bv0_lR.js → web-input-BZDyxpzR.js} +101 -158
- package/dist/{web-message-id-xPI_EFSC.js → web-message-id-CJSUiksE.js} +3 -6
- package/dist/{work-nAfDSUFP.js → work-D3QKiV0O.js} +14 -16
- package/dist/{worker-vGXZ6XFT.js → worker-C8mUjYf9.js} +7 -8
- package/package.json +10 -9
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { T as withSpan, _ as serializeGenAiAttribute, f as logException, h as normalizeGenAiFinishReason, i as extractGenAiUsageAttributes, m as logWarn } from "./logging-
|
|
2
|
-
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-
|
|
1
|
+
import { T as withSpan, _ as serializeGenAiAttribute, f as logException, h as normalizeGenAiFinishReason, i as extractGenAiUsageAttributes, m as logWarn } from "./logging-BStXN56b.js";
|
|
2
|
+
import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-CFhNKxp-.js";
|
|
3
3
|
import { calculateCost, completeSimple, getEnvApiKey, getModels, registerApiProvider } from "@earendil-works/pi-ai/compat";
|
|
4
4
|
import { stream as streamAnthropic, streamSimple as streamSimpleAnthropic } from "@earendil-works/pi-ai/api/anthropic-messages";
|
|
5
5
|
import { createGatewayProvider } from "@ai-sdk/gateway";
|
|
6
6
|
import { getVercelOidcToken } from "@vercel/oidc";
|
|
7
|
-
import { NoObjectGeneratedError, embedMany, generateObject } from "ai";
|
|
8
|
-
|
|
7
|
+
import { Experimental_DecisionRefusalError, NoObjectGeneratedError, embedMany, experimental_decide, generateObject } from "ai";
|
|
8
|
+
// src/chat/optional-string.ts
|
|
9
9
|
/**
|
|
10
10
|
* Normalize optional env-style strings so blank values do not masquerade as
|
|
11
11
|
* configured inputs.
|
|
@@ -15,8 +15,7 @@ function toOptionalTrimmed(value) {
|
|
|
15
15
|
const trimmed = value.trim();
|
|
16
16
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
//#region src/chat/pi/gateway-auth.ts
|
|
18
|
+
// src/chat/pi/gateway-auth.ts
|
|
20
19
|
/**
|
|
21
20
|
* AI Gateway credential resolution for every Junior model path.
|
|
22
21
|
*
|
|
@@ -51,8 +50,7 @@ async function resolveGatewayCredential() {
|
|
|
51
50
|
async function getGatewayApiKey() {
|
|
52
51
|
return (await resolveGatewayCredential())?.token;
|
|
53
52
|
}
|
|
54
|
-
|
|
55
|
-
//#region src/chat/services/provider-error.ts
|
|
53
|
+
// src/chat/services/provider-error.ts
|
|
56
54
|
/** Structured failure produced at an AI provider boundary. */
|
|
57
55
|
var ProviderError = class extends Error {
|
|
58
56
|
code = "provider_error";
|
|
@@ -227,8 +225,7 @@ function getProviderErrorAttributes(error) {
|
|
|
227
225
|
...error.modelId ? { "gen_ai.request.model": error.modelId } : void 0
|
|
228
226
|
};
|
|
229
227
|
}
|
|
230
|
-
|
|
231
|
-
//#region src/chat/xml.ts
|
|
228
|
+
// src/chat/xml.ts
|
|
232
229
|
function escapeXml(value) {
|
|
233
230
|
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'");
|
|
234
231
|
}
|
|
@@ -236,8 +233,7 @@ function escapeXml(value) {
|
|
|
236
233
|
function unescapeXml(value) {
|
|
237
234
|
return value.replaceAll(""", "\"").replaceAll("'", "'").replaceAll(">", ">").replaceAll("<", "<").replaceAll("&", "&");
|
|
238
235
|
}
|
|
239
|
-
|
|
240
|
-
//#region src/chat/current-instruction.ts
|
|
236
|
+
// src/chat/current-instruction.ts
|
|
241
237
|
const CURRENT_INSTRUCTION_TAG = "current-instruction";
|
|
242
238
|
const CURRENT_INSTRUCTION_OPEN_PREFIX = `<${CURRENT_INSTRUCTION_TAG}`;
|
|
243
239
|
const CURRENT_INSTRUCTION_OPEN_BARE = `<${CURRENT_INSTRUCTION_TAG}>`;
|
|
@@ -275,8 +271,7 @@ function unwrapCurrentInstruction(text) {
|
|
|
275
271
|
const body = readCurrentInstructionBody(text);
|
|
276
272
|
return body === void 0 ? void 0 : unescapeXml(body);
|
|
277
273
|
}
|
|
278
|
-
|
|
279
|
-
//#region src/chat/services/context-compaction-marker.ts
|
|
274
|
+
// src/chat/services/context-compaction-marker.ts
|
|
280
275
|
const COMPACTION_SUMMARY_PREFIX = "Another language model started to solve this problem and produced a summary of its thinking process. You also have access to the state of the tools that were used by that language model. Use this to build on the work that has already been done and avoid duplicating work. Here is the summary produced by the other language model, use the information in this summary to assist with your own analysis:";
|
|
281
276
|
/** Return whether text is one of Junior's durable compacted-context markers. */
|
|
282
277
|
function isCompactionSummaryText(text) {
|
|
@@ -292,8 +287,7 @@ function hasCompactedConversationContext(messages) {
|
|
|
292
287
|
return content.some((part) => part && typeof part === "object" && part.type === "text" && typeof part.text === "string" && isCompactionSummaryText(part.text));
|
|
293
288
|
});
|
|
294
289
|
}
|
|
295
|
-
|
|
296
|
-
//#region src/chat/pi/client.ts
|
|
290
|
+
// src/chat/pi/client.ts
|
|
297
291
|
registerApiProvider({
|
|
298
292
|
api: "anthropic-messages",
|
|
299
293
|
stream: streamAnthropic,
|
|
@@ -406,6 +400,7 @@ const GEN_AI_PROVIDER_NAME = GATEWAY_PROVIDER;
|
|
|
406
400
|
const GEN_AI_SERVER_ADDRESS = "ai-gateway.vercel.sh";
|
|
407
401
|
const GEN_AI_OPERATION_CHAT = "chat";
|
|
408
402
|
const GEN_AI_OPERATION_EMBEDDINGS = "embeddings";
|
|
403
|
+
const GEN_AI_OPERATION_DECIDE = "decide";
|
|
409
404
|
const EMBEDDING_INPUT_COST_USD_PER_MILLION_TOKENS = {
|
|
410
405
|
"cohere/embed-v4.0": .12,
|
|
411
406
|
"google/gemini-embedding-001": .15,
|
|
@@ -417,6 +412,14 @@ const EMBEDDING_INPUT_COST_USD_PER_MILLION_TOKENS = {
|
|
|
417
412
|
"voyage/voyage-3.5": .06,
|
|
418
413
|
"voyage/voyage-3.5-lite": .02
|
|
419
414
|
};
|
|
415
|
+
const DECISION_INPUT_COST_USD_PER_MILLION_TOKENS = {
|
|
416
|
+
"openai/gpt-6-luna-decisions": .1,
|
|
417
|
+
"typesafe-ai/jev": .042
|
|
418
|
+
};
|
|
419
|
+
function decisionCostUsd(modelId, inputTokens) {
|
|
420
|
+
const costPerMillionTokens = DECISION_INPUT_COST_USD_PER_MILLION_TOKENS[modelId];
|
|
421
|
+
return costPerMillionTokens === void 0 || inputTokens === void 0 ? void 0 : inputTokens * costPerMillionTokens / 1e6;
|
|
422
|
+
}
|
|
420
423
|
function embeddingCostUsd(modelId, inputTokens) {
|
|
421
424
|
const costPerMillionTokens = EMBEDDING_INPUT_COST_USD_PER_MILLION_TOKENS[modelId];
|
|
422
425
|
return costPerMillionTokens === void 0 ? void 0 : inputTokens * costPerMillionTokens / 1e6;
|
|
@@ -611,6 +614,50 @@ async function completeObject(params) {
|
|
|
611
614
|
...costUsd !== void 0 ? { costUsd } : void 0
|
|
612
615
|
};
|
|
613
616
|
}
|
|
617
|
+
/** Answer typed decision questions with an AI Gateway decision model, such as Jev. */
|
|
618
|
+
async function completeDecision(params) {
|
|
619
|
+
const credential = await resolveGatewayCredential();
|
|
620
|
+
const provider = createGatewayProvider(credential ? { apiKey: credential.token } : {});
|
|
621
|
+
try {
|
|
622
|
+
const result = await withSpan(`${GEN_AI_OPERATION_DECIDE} ${params.modelId}`, "gen_ai.decide", logContextFromMetadata(params.modelId, params.metadata), async (setSpanAttributes) => {
|
|
623
|
+
const result = await experimental_decide({
|
|
624
|
+
model: provider.decisionModel(params.modelId),
|
|
625
|
+
state: params.state,
|
|
626
|
+
questions: params.questions,
|
|
627
|
+
...params.signal !== void 0 ? { abortSignal: params.signal } : void 0
|
|
628
|
+
});
|
|
629
|
+
const costUsd = decisionCostUsd(params.modelId, result.usage.inputTokens);
|
|
630
|
+
setSpanAttributes(extractGenAiUsageAttributes({
|
|
631
|
+
...result.usage,
|
|
632
|
+
...costUsd !== void 0 ? { cost: {
|
|
633
|
+
input: costUsd,
|
|
634
|
+
total: costUsd
|
|
635
|
+
} } : void 0
|
|
636
|
+
}));
|
|
637
|
+
return {
|
|
638
|
+
answers: result.answers,
|
|
639
|
+
costUsd
|
|
640
|
+
};
|
|
641
|
+
}, {
|
|
642
|
+
"gen_ai.provider.name": GEN_AI_PROVIDER_NAME,
|
|
643
|
+
"gen_ai.operation.name": GEN_AI_OPERATION_DECIDE,
|
|
644
|
+
"gen_ai.request.model": params.modelId,
|
|
645
|
+
...params.promptName ? { "gen_ai.prompt.name": params.promptName } : void 0,
|
|
646
|
+
"server.address": GEN_AI_SERVER_ADDRESS,
|
|
647
|
+
"server.port": 443,
|
|
648
|
+
"gen_ai.provider.auth_mode": credential?.mode ?? "api_key"
|
|
649
|
+
});
|
|
650
|
+
return {
|
|
651
|
+
answers: result.answers,
|
|
652
|
+
...result.costUsd !== void 0 ? { costUsd: result.costUsd } : void 0
|
|
653
|
+
};
|
|
654
|
+
} catch (error) {
|
|
655
|
+
throw createProviderError(error, {
|
|
656
|
+
...Experimental_DecisionRefusalError.isInstance(error) ? { kind: "invalid_response" } : void 0,
|
|
657
|
+
modelId: params.modelId
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
}
|
|
614
661
|
/** Generate text embeddings through the host-owned AI Gateway provider. */
|
|
615
662
|
async function embedTexts(params) {
|
|
616
663
|
const texts = params.texts.map((text) => text.trim());
|
|
@@ -671,5 +718,4 @@ async function embedTexts(params) {
|
|
|
671
718
|
throw providerError;
|
|
672
719
|
}
|
|
673
720
|
}
|
|
674
|
-
|
|
675
|
-
export { toOptionalTrimmed as S, getProviderErrorUserMessage as _, embedTexts as a, getGatewayApiKey as b, hasCompactedConversationContext as c, unwrapCurrentInstruction as d, escapeXml as f, getProviderErrorAttributes as g, findProviderError as h, completeText as i, isCompactionSummaryText as l, createProviderError as m, GEN_AI_SERVER_ADDRESS as n, resolveGatewayModel as o, ProviderError as p, completeObject as r, COMPACTION_SUMMARY_PREFIX as s, GEN_AI_PROVIDER_NAME as t, renderCurrentInstruction as u, isProviderRetryError as v, resolveGatewayCredential as x, MISSING_GATEWAY_CREDENTIALS_ERROR as y };
|
|
721
|
+
export { toOptionalTrimmed as C, resolveGatewayCredential as S, getProviderErrorAttributes as _, completeText as a, MISSING_GATEWAY_CREDENTIALS_ERROR as b, COMPACTION_SUMMARY_PREFIX as c, renderCurrentInstruction as d, unwrapCurrentInstruction as f, findProviderError as g, createProviderError as h, completeObject as i, hasCompactedConversationContext as l, ProviderError as m, GEN_AI_SERVER_ADDRESS as n, embedTexts as o, escapeXml as p, completeDecision as r, resolveGatewayModel as s, GEN_AI_PROVIDER_NAME as t, isCompactionSummaryText as u, getProviderErrorUserMessage as v, getGatewayApiKey as x, isProviderRetryError as y };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import {
|
|
3
|
-
import { m as logWarn } from "./logging-
|
|
4
|
-
import { l as TURN_REASONING_LEVELS, s as modelProfileSchema, t as DEFAULT_MODEL_PROFILES, u as parseTurnReasoningLevel } from "./model-profile-
|
|
5
|
-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
+
import { C as toOptionalTrimmed, s as resolveGatewayModel } from "./client-BZdxgKyL.js";
|
|
3
|
+
import { m as logWarn } from "./logging-BStXN56b.js";
|
|
4
|
+
import { l as TURN_REASONING_LEVELS, s as modelProfileSchema, t as DEFAULT_MODEL_PROFILES, u as parseTurnReasoningLevel } from "./model-profile-Bg8EoCKD.js";
|
|
5
|
+
// src/chat/slack/emoji.ts
|
|
6
6
|
const SLACK_EMOJI_NAME_RE = /^(?:[a-z0-9_+-]+)(?:::(?:skin-tone-[2-6]))?$/;
|
|
7
7
|
function normalizeSlackEmojiName(value) {
|
|
8
8
|
const trimmed = value.trim().toLowerCase();
|
|
@@ -10,8 +10,7 @@ function normalizeSlackEmojiName(value) {
|
|
|
10
10
|
const normalized = trimmed.startsWith(":") && trimmed.endsWith(":") ? trimmed.slice(1, -1) : trimmed;
|
|
11
11
|
return SLACK_EMOJI_NAME_RE.test(normalized) ? normalized : null;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
//#region src/chat/config.ts
|
|
13
|
+
// src/chat/config.ts
|
|
15
14
|
var config_exports = /* @__PURE__ */ __exportAll({
|
|
16
15
|
CONVERSATION_WORK_SOFT_YIELD_BUFFER_SECONDS: () => 40,
|
|
17
16
|
DEFAULT_SQL_STATEMENT_TIMEOUT_MS: () => DEFAULT_SQL_STATEMENT_TIMEOUT_MS,
|
|
@@ -60,12 +59,14 @@ const MAX_TOOL_CALLS_PER_TURN = 1e3;
|
|
|
60
59
|
*/
|
|
61
60
|
const MAX_CONSECUTIVE_AUTOMATED_TURNS = 25;
|
|
62
61
|
/**
|
|
63
|
-
* Max runs one Event automation can start in
|
|
64
|
-
* full agent turn, and Event automations skip the consecutive
|
|
65
|
-
* limit. Kept low so a broad trigger, such as every message in
|
|
66
|
-
* blocks quickly instead of starting a turn for each Event.
|
|
62
|
+
* Max runs one Event automation can start in one rolling run window. Each run
|
|
63
|
+
* is a full agent turn, and Event automations skip the consecutive
|
|
64
|
+
* automated-turn limit. Kept low so a broad trigger, such as every message in
|
|
65
|
+
* a channel, blocks quickly instead of starting a turn for each Event.
|
|
67
66
|
*/
|
|
68
|
-
const
|
|
67
|
+
const MAX_EVENT_AUTOMATION_RUNS = 10;
|
|
68
|
+
/** Length of the rolling window for the Event automation run limit. */
|
|
69
|
+
const EVENT_AUTOMATION_RUN_WINDOW_MS = 6e4;
|
|
69
70
|
const DEFAULT_FUNCTION_MAX_DURATION_SECONDS = 300;
|
|
70
71
|
const DEFAULT_SLACK_SLASH_COMMAND = "/jr";
|
|
71
72
|
const DEFAULT_PROCESSING_REACTION_EMOJI = "eyes";
|
|
@@ -144,6 +145,7 @@ const DEFAULT_FAST_MODEL_ID = resolveGatewayModel("openai/gpt-6-luna").id;
|
|
|
144
145
|
const DEFAULT_GUARDIAN_MODEL_ID = resolveGatewayModel("openai/gpt-6-luna").id;
|
|
145
146
|
const DEFAULT_HANDOFF_MODEL_ID = resolveGatewayModel(DEFAULT_MODEL_PROFILES.handoff.modelId).id;
|
|
146
147
|
const DEFAULT_WEB_SEARCH_MODEL_ID = resolveGatewayModel("openai/gpt-6-luna").id;
|
|
148
|
+
const DEFAULT_DECISION_MODEL_ID = "typesafe-ai/jev";
|
|
147
149
|
const DEFAULT_EMBEDDING_MODEL_ID = "openai/text-embedding-3-small";
|
|
148
150
|
const DEFAULT_IMAGE_GENERATION_MODEL_ID = "google/gemini-3-pro-image";
|
|
149
151
|
const DEFAULT_VISION_MODEL_ID = resolveGatewayModel("openai/gpt-5.6-sol").id;
|
|
@@ -259,6 +261,7 @@ function readBotConfig(env, functionMaxDurationSeconds) {
|
|
|
259
261
|
profiles: parseProfiles(env.AI_MODEL_PROFILES, modelId, handoffModelId),
|
|
260
262
|
contextWindowTokens: parseOptionalPositiveInteger("AI_MODEL_CONTEXT_WINDOW_TOKENS", env.AI_MODEL_CONTEXT_WINDOW_TOKENS) ?? DEFAULT_MODEL_CONTEXT_WINDOW_TOKENS,
|
|
261
263
|
reasoningLevel: reasoningLevel === void 0 ? void 0 : parseTurnReasoningLevel(reasoningLevel),
|
|
264
|
+
decisionModelId: toOptionalTrimmed(env.AI_DECISION_MODEL) ?? DEFAULT_DECISION_MODEL_ID,
|
|
262
265
|
fastModelId,
|
|
263
266
|
guardianModelId,
|
|
264
267
|
imageGenerationModelId: toOptionalTrimmed(env.AI_IMAGE_MODEL) ?? DEFAULT_IMAGE_GENERATION_MODEL_ID,
|
|
@@ -270,7 +273,8 @@ function readBotConfig(env, functionMaxDurationSeconds) {
|
|
|
270
273
|
maxToolCallsPerTurn: MAX_TOOL_CALLS_PER_TURN,
|
|
271
274
|
maxTurnCostUsd: MAX_TURN_COST_USD,
|
|
272
275
|
maxConsecutiveAutomatedTurns: MAX_CONSECUTIVE_AUTOMATED_TURNS,
|
|
273
|
-
|
|
276
|
+
maxEventAutomationRuns: MAX_EVENT_AUTOMATION_RUNS,
|
|
277
|
+
eventAutomationRunWindowMs: EVENT_AUTOMATION_RUN_WINDOW_MS,
|
|
274
278
|
turnTimeoutMs: parseAgentTurnTimeoutMs(env.AGENT_TURN_TIMEOUT_MS, maxTurnTimeoutMs),
|
|
275
279
|
webSearchModelId: validateGatewayModelId(env.AI_WEB_SEARCH_MODEL) ?? DEFAULT_WEB_SEARCH_MODEL_ID
|
|
276
280
|
};
|
|
@@ -384,7 +388,9 @@ function setRuntimeLimits(limits) {
|
|
|
384
388
|
bot.maxAgentDepth = limits.maxAgentDepth;
|
|
385
389
|
}
|
|
386
390
|
if (limits?.maxConsecutiveAutomatedTurns !== void 0) bot.maxConsecutiveAutomatedTurns = requirePositiveLimit("maxConsecutiveAutomatedTurns", limits.maxConsecutiveAutomatedTurns);
|
|
387
|
-
|
|
391
|
+
const runLimit = limits?.eventAutomationRunLimit;
|
|
392
|
+
if (runLimit?.maxRuns !== void 0) bot.maxEventAutomationRuns = requirePositiveLimit("eventAutomationRunLimit.maxRuns", runLimit.maxRuns);
|
|
393
|
+
if (runLimit?.windowMs !== void 0) bot.eventAutomationRunWindowMs = requirePositiveLimit("eventAutomationRunLimit.windowMs", runLimit.windowMs);
|
|
388
394
|
if (limits?.maxSlicesPerTurn !== void 0) bot.maxSlicesPerTurn = requirePositiveLimit("maxSlicesPerTurn", limits.maxSlicesPerTurn);
|
|
389
395
|
if (limits?.maxToolCallsPerTurn !== void 0) bot.maxToolCallsPerTurn = requirePositiveLimit("maxToolCallsPerTurn", limits.maxToolCallsPerTurn);
|
|
390
396
|
if (limits?.maxTurnCostUsd !== void 0) bot.maxTurnCostUsd = requirePositiveLimit("maxTurnCostUsd", limits.maxTurnCostUsd);
|
|
@@ -418,6 +424,7 @@ function getRuntimeMetadata() {
|
|
|
418
424
|
}
|
|
419
425
|
/** Apply model overrides from createApp(). */
|
|
420
426
|
function setBotModelConfig(config) {
|
|
427
|
+
if (config.decisionModelId !== void 0) botConfig.decisionModelId = requireModelId("decisionModelId", config.decisionModelId, toOptionalTrimmed);
|
|
421
428
|
if (config.embeddingModelId !== void 0) botConfig.embeddingModelId = requireModelId("embeddingModelId", config.embeddingModelId, validateEmbeddingModelId);
|
|
422
429
|
if (config.fastModelId !== void 0) botConfig.fastModelId = requireModelId("fastModelId", config.fastModelId, validateGatewayModelId);
|
|
423
430
|
if (config.guardianModelId !== void 0) botConfig.guardianModelId = requireModelId("guardianModelId", config.guardianModelId, validateGatewayModelId);
|
|
@@ -440,5 +447,4 @@ function setSlackReactionConfig(overrides) {
|
|
|
440
447
|
if (overrides.processingReactionEmoji !== void 0) chatConfig.slack.processingReactionEmoji = parseReactionEmoji("processingReactionEmoji", overrides.processingReactionEmoji, chatConfig.slack.processingReactionEmoji);
|
|
441
448
|
if (overrides.completedReactionEmoji !== void 0) chatConfig.slack.completedReactionEmoji = parseReactionEmoji("completedReactionEmoji", overrides.completedReactionEmoji, chatConfig.slack.completedReactionEmoji);
|
|
442
449
|
}
|
|
443
|
-
//#endregion
|
|
444
450
|
export { snapshotRuntimeConfig as _, getRuntimeMetadata as a, getSlackClientSecret as c, restoreRuntimeConfig as d, setBotModelConfig as f, setSlackReactionConfig as g, setRuntimeLimits as h, getChatConfig as i, getSlackSigningSecret as l, setProfiles as m, botConfig as n, getSlackBotToken as o, setCrossActorMidRunMode as p, config_exports as r, getSlackClientId as s, DEFAULT_SQL_STATEMENT_TIMEOUT_MS as t, resetRuntimeConfig as u, normalizeSlackEmojiName as v };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { Ft as startOAuthFlow, c as deleteMcpAuthSessionsForUserProvider, l as deleteMcpServerSessionId, u as deleteMcpStoredOAuthCredentials } from "./agent-runner-CPSd7rKm.js";
|
|
2
|
+
import { n as botConfig } from "./config-Deqpfpg9.js";
|
|
3
|
+
import { A as deleteProviderIdentityForUser, c as getConversationEventStore, f as getSqlExecutor, k as deleteProviderIdentityForSlackUser } from "./viewer-B2_ABsYi.js";
|
|
4
|
+
import { u as hasRequiredOAuthScope } from "./registry-B_M_x_iS.js";
|
|
5
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-B8SuFPGb.js";
|
|
6
|
+
import { K as loadTurnCheckpoint, X as failTurnRecord, Z as getTurnRecord } from "./tasks-DieKX3d4.js";
|
|
7
|
+
import { r as getStateAdapter } from "./adapter-Bn0gFVSF.js";
|
|
8
|
+
import { a as getVercelConversationWorkQueue } from "./job-queue-vdGU-5ge.js";
|
|
9
|
+
import { m as ensureConversationWake, w as requestConversationWork } from "./store-B1GES4gC.js";
|
|
10
|
+
import { n as resolveTurnSessionRouting } from "./turn-session-routing-BlajheOU.js";
|
|
10
11
|
import { z } from "zod";
|
|
11
12
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
12
|
-
|
|
13
|
+
// src/chat/task-execution/authorized-turn.ts
|
|
13
14
|
/**
|
|
14
15
|
* OAuth callbacks save readiness, not agent history. The conversation worker
|
|
15
16
|
* consumes this event under its lease before it resumes the paused Turn.
|
|
@@ -56,8 +57,7 @@ async function getTurnAuthorization(turn) {
|
|
|
56
57
|
if (event?.data.type !== "structured_event") return void 0;
|
|
57
58
|
return authorizationSchema.parse(event.data.content);
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
-
//#region src/chat/task-execution/turn-wake.ts
|
|
60
|
+
// src/chat/task-execution/turn-wake.ts
|
|
61
61
|
/** Build the worker input for a paused turn. */
|
|
62
62
|
async function getPausedTurnRequest(args) {
|
|
63
63
|
const turn = (await loadTurnCheckpoint({
|
|
@@ -126,8 +126,170 @@ async function wakeAuthorizedTurn(args, queue) {
|
|
|
126
126
|
const request = await recordTurnAuthorization(args);
|
|
127
127
|
if (request) await wakePausedTurn(request, { queue });
|
|
128
128
|
}
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
// src/handlers/oauth-html.ts
|
|
130
|
+
/** Build pre-escaped callback HTML with the shared response security policy. */
|
|
131
|
+
function htmlCallbackResponse(title, message, status, options = {}) {
|
|
132
|
+
const footerMessage = options.footerMessage ?? `You can close this tab and return to ${botConfig.userName}.`;
|
|
133
|
+
const isSuccess = status >= 200 && status < 300;
|
|
134
|
+
const statusClass = isSuccess ? "success" : "error";
|
|
135
|
+
const statusIcon = isSuccess ? "" : "!";
|
|
136
|
+
const html = `<!DOCTYPE html>
|
|
137
|
+
<html lang="en">
|
|
138
|
+
<head>
|
|
139
|
+
<meta charset="utf-8">
|
|
140
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
141
|
+
<meta name="color-scheme" content="light dark">
|
|
142
|
+
<title>${title}</title>
|
|
143
|
+
<style>
|
|
144
|
+
:root {
|
|
145
|
+
color-scheme: light dark;
|
|
146
|
+
--canvas: #f4f1fa;
|
|
147
|
+
--surface: #ffffff;
|
|
148
|
+
--text: #211a2c;
|
|
149
|
+
--muted: #6e6479;
|
|
150
|
+
--border: #ded7e8;
|
|
151
|
+
--accent: #6c5fc7;
|
|
152
|
+
--success: #16835c;
|
|
153
|
+
--success-soft: #ddf5ea;
|
|
154
|
+
--error: #bc3d50;
|
|
155
|
+
--error-soft: #fce7eb;
|
|
156
|
+
--shadow: 0 24px 64px rgba(45, 31, 63, 0.14);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
* { box-sizing: border-box; }
|
|
160
|
+
|
|
161
|
+
body {
|
|
162
|
+
min-height: 100vh;
|
|
163
|
+
margin: 0;
|
|
164
|
+
display: grid;
|
|
165
|
+
place-items: center;
|
|
166
|
+
padding: 24px;
|
|
167
|
+
background: var(--canvas);
|
|
168
|
+
color: var(--text);
|
|
169
|
+
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
main {
|
|
173
|
+
width: min(100%, 480px);
|
|
174
|
+
padding: 48px 40px 40px;
|
|
175
|
+
text-align: center;
|
|
176
|
+
background: var(--surface);
|
|
177
|
+
border: 1px solid var(--border);
|
|
178
|
+
border-radius: 24px;
|
|
179
|
+
box-shadow: var(--shadow);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.brand {
|
|
183
|
+
display: inline-flex;
|
|
184
|
+
align-items: center;
|
|
185
|
+
gap: 8px;
|
|
186
|
+
margin-bottom: 32px;
|
|
187
|
+
color: var(--muted);
|
|
188
|
+
font-size: 14px;
|
|
189
|
+
font-weight: 700;
|
|
190
|
+
letter-spacing: 0.08em;
|
|
191
|
+
text-transform: uppercase;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.brand-mark {
|
|
195
|
+
width: 10px;
|
|
196
|
+
height: 10px;
|
|
197
|
+
background: var(--accent);
|
|
198
|
+
border-radius: 3px;
|
|
199
|
+
transform: rotate(12deg);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.status {
|
|
203
|
+
width: 64px;
|
|
204
|
+
height: 64px;
|
|
205
|
+
margin: 0 auto 24px;
|
|
206
|
+
display: grid;
|
|
207
|
+
place-items: center;
|
|
208
|
+
border-radius: 20px;
|
|
209
|
+
font-size: 32px;
|
|
210
|
+
font-weight: 750;
|
|
211
|
+
line-height: 1;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.status.success { color: var(--success); background: var(--success-soft); }
|
|
215
|
+
.status.success::before {
|
|
216
|
+
content: "";
|
|
217
|
+
width: 12px;
|
|
218
|
+
height: 24px;
|
|
219
|
+
margin-top: -5px;
|
|
220
|
+
border-right: 4px solid currentColor;
|
|
221
|
+
border-bottom: 4px solid currentColor;
|
|
222
|
+
transform: rotate(45deg);
|
|
223
|
+
}
|
|
224
|
+
.status.error { color: var(--error); background: var(--error-soft); }
|
|
225
|
+
|
|
226
|
+
h1 {
|
|
227
|
+
margin: 0;
|
|
228
|
+
font-size: clamp(28px, 7vw, 36px);
|
|
229
|
+
line-height: 1.12;
|
|
230
|
+
letter-spacing: -0.035em;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.message {
|
|
234
|
+
margin: 16px auto 0;
|
|
235
|
+
color: var(--muted);
|
|
236
|
+
font-size: 17px;
|
|
237
|
+
line-height: 1.6;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.footer {
|
|
241
|
+
margin: 32px 0 0;
|
|
242
|
+
padding-top: 24px;
|
|
243
|
+
color: var(--muted);
|
|
244
|
+
border-top: 1px solid var(--border);
|
|
245
|
+
font-size: 14px;
|
|
246
|
+
line-height: 1.5;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
@media (prefers-color-scheme: dark) {
|
|
250
|
+
:root {
|
|
251
|
+
--canvas: #15121a;
|
|
252
|
+
--surface: #211c28;
|
|
253
|
+
--text: #f6f1fb;
|
|
254
|
+
--muted: #b8adbf;
|
|
255
|
+
--border: #3a3243;
|
|
256
|
+
--accent: #a99af0;
|
|
257
|
+
--success: #72d6ad;
|
|
258
|
+
--success-soft: #193c30;
|
|
259
|
+
--error: #ff9aaa;
|
|
260
|
+
--error-soft: #48262e;
|
|
261
|
+
--shadow: 0 24px 64px rgba(0, 0, 0, 0.36);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
@media (max-width: 520px) {
|
|
266
|
+
body { padding: 16px; }
|
|
267
|
+
main { padding: 40px 24px 32px; border-radius: 20px; }
|
|
268
|
+
}
|
|
269
|
+
</style>
|
|
270
|
+
</head>
|
|
271
|
+
<body>
|
|
272
|
+
<main>
|
|
273
|
+
<div class="brand"><span class="brand-mark" aria-hidden="true"></span>${botConfig.userName}</div>
|
|
274
|
+
<div class="status ${statusClass}" aria-hidden="true">${statusIcon}</div>
|
|
275
|
+
<h1>${title}</h1>
|
|
276
|
+
<p class="message">${message}</p>
|
|
277
|
+
<p class="footer">${footerMessage}</p>
|
|
278
|
+
</main>
|
|
279
|
+
</body>
|
|
280
|
+
</html>`;
|
|
281
|
+
return new Response(html, {
|
|
282
|
+
status,
|
|
283
|
+
headers: {
|
|
284
|
+
"Cache-Control": "no-store",
|
|
285
|
+
"Content-Security-Policy": "default-src 'none'; style-src 'unsafe-inline'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'",
|
|
286
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
287
|
+
"Referrer-Policy": "no-referrer",
|
|
288
|
+
"X-Content-Type-Options": "nosniff"
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
// src/chat/conversations/web-authorization.ts
|
|
131
293
|
const WEB_AUTHORIZATION_PREFIX = "junior:web_authorization:v1";
|
|
132
294
|
const WEB_AUTHORIZATION_TTL_MS = 864e5;
|
|
133
295
|
function authorizationKey(conversationId, actorId) {
|
|
@@ -161,8 +323,7 @@ async function getWebAuthorization(args) {
|
|
|
161
323
|
async function deleteWebAuthorization(args) {
|
|
162
324
|
await getStateAdapter().delete(authorizationKey(args.conversationId, args.actorId));
|
|
163
325
|
}
|
|
164
|
-
|
|
165
|
-
//#region src/chat/credentials/unlink-provider.ts
|
|
326
|
+
// src/chat/credentials/unlink-provider.ts
|
|
166
327
|
/** Remove one provider connection and its exact stored account identity. */
|
|
167
328
|
async function unlinkProvider(userId, provider, userTokenStore, slackTeamId) {
|
|
168
329
|
const tokens = await userTokenStore.get(userId, provider);
|
|
@@ -174,8 +335,7 @@ async function unlinkProvider(userId, provider, userTokenStore, slackTeamId) {
|
|
|
174
335
|
deleteMcpAuthSessionsForUserProvider(userId, provider)
|
|
175
336
|
]);
|
|
176
337
|
}
|
|
177
|
-
|
|
178
|
-
//#region src/chat/credentials/connections.ts
|
|
338
|
+
// src/chat/credentials/connections.ts
|
|
179
339
|
/** Return stored OAuth tokens only when they still carry the manifest scope. */
|
|
180
340
|
async function readConnectedOAuthTokens(userId, plugin, userTokenStore) {
|
|
181
341
|
if (!plugin.manifest.oauth && !plugin.manifest.credentials) return;
|
|
@@ -240,5 +400,4 @@ async function disconnectConnection(userId, provider, userTokenStore, viewerUser
|
|
|
240
400
|
if (tokens?.account) await deleteProviderIdentityForUser(getSqlExecutor(), viewerUserId, provider, tokens.account.id);
|
|
241
401
|
await unlinkProvider(userId, provider, userTokenStore);
|
|
242
402
|
}
|
|
243
|
-
|
|
244
|
-
export { startConnection as a, deleteWebAuthorization as c, getPausedTurnRequest as d, wakeAuthorizedTurn as f, readConnectedOAuthTokens as i, getWebAuthorization as l, getTurnAuthorization as m, isConnectableProvider as n, unlinkProvider as o, wakePausedTurn as p, listConnections as r, createWebAuthorization as s, disconnectConnection as t, createPausedTurns as u };
|
|
403
|
+
export { startConnection as a, deleteWebAuthorization as c, createPausedTurns as d, getPausedTurnRequest as f, getTurnAuthorization as h, readConnectedOAuthTokens as i, getWebAuthorization as l, wakePausedTurn as m, isConnectableProvider as n, unlinkProvider as o, wakeAuthorizedTurn as p, listConnections as r, createWebAuthorization as s, disconnectConnection as t, htmlCallbackResponse as u };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as conversationTurnFailureReasonSchema, h as usageSchema, i as conversationTurnFailureCodeSchema } from "./history-
|
|
1
|
+
import { a as conversationTurnFailureReasonSchema, h as usageSchema, i as conversationTurnFailureCodeSchema } from "./history-AY8rs-FR.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, objectFactFields, objectTypeSchema } from "@sentry/junior-plugin-api";
|
|
4
|
-
|
|
4
|
+
// src/chat/automations/card.ts
|
|
5
5
|
/** Saved automation facts shown with a Message, not a live status view. */
|
|
6
6
|
const automationCardSchema = z.object({
|
|
7
7
|
kind: z.literal("automation"),
|
|
@@ -23,8 +23,7 @@ function automationCardText(card) {
|
|
|
23
23
|
`Automation ID: ${card.id}`
|
|
24
24
|
].filter(Boolean).join("\n");
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
//#region src/chat/conversations/cards.ts
|
|
26
|
+
// src/chat/conversations/cards.ts
|
|
28
27
|
const storedCardSchema = automationCardSchema.extend({ operation: z.enum([
|
|
29
28
|
"created",
|
|
30
29
|
"updated",
|
|
@@ -93,8 +92,7 @@ function annotationCard(annotation) {
|
|
|
93
92
|
title: value.label
|
|
94
93
|
};
|
|
95
94
|
}
|
|
96
|
-
|
|
97
|
-
//#region src/chat/briefs/schema.ts
|
|
95
|
+
// src/chat/briefs/schema.ts
|
|
98
96
|
/**
|
|
99
97
|
* Runtime schemas for the Brief record and the generator input. Both cross a
|
|
100
98
|
* durable or CLI edge, so these schemas own the exported types.
|
|
@@ -211,8 +209,7 @@ function parseBriefInput(input) {
|
|
|
211
209
|
entries: [...parsed.entries].sort((left, right) => left.index - right.index || left.createdAtMs - right.createdAtMs)
|
|
212
210
|
};
|
|
213
211
|
}
|
|
214
|
-
|
|
215
|
-
//#region src/chat/attachments/media.ts
|
|
212
|
+
// src/chat/attachments/media.ts
|
|
216
213
|
const INPUT_IMAGE_TYPES = [
|
|
217
214
|
"image/png",
|
|
218
215
|
"image/jpeg",
|
|
@@ -294,8 +291,7 @@ function isVisionImageMediaType(mediaType) {
|
|
|
294
291
|
const normalized = mediaType.split(";", 1)[0]?.trim().toLowerCase();
|
|
295
292
|
return normalized ? INPUT_IMAGE_TYPES.some((type) => type === normalized) : false;
|
|
296
293
|
}
|
|
297
|
-
|
|
298
|
-
//#region src/chat/attachments/input.ts
|
|
294
|
+
// src/chat/attachments/input.ts
|
|
299
295
|
/** Bound JSON image input below the hosting platform's request size limit. */
|
|
300
296
|
const MAX_INPUT_IMAGE_BYTES = 3145728;
|
|
301
297
|
const MAX_INPUT_IMAGES = 3;
|
|
@@ -316,8 +312,7 @@ const messageAttachmentSchema = z.object({
|
|
|
316
312
|
function readMessageAttachments(value) {
|
|
317
313
|
return messageAttachmentSchema.array().parse(value ?? []);
|
|
318
314
|
}
|
|
319
|
-
|
|
320
|
-
//#region src/api/schema/child-agent-totals.ts
|
|
315
|
+
// src/api/schema/child-agent-totals.ts
|
|
321
316
|
/**
|
|
322
317
|
* The part of a Conversation total that its child agents spent, at any depth.
|
|
323
318
|
* Present only when the Conversation has child agents. The Conversation's own
|
|
@@ -329,8 +324,7 @@ const conversationChildAgentTotalsSchema = z.object({
|
|
|
329
324
|
cumulativeDurationMs: z.number(),
|
|
330
325
|
cumulativeUsage: usageSchema.optional()
|
|
331
326
|
}).strict();
|
|
332
|
-
|
|
333
|
-
//#region src/api/schema/conversation.ts
|
|
327
|
+
// src/api/schema/conversation.ts
|
|
334
328
|
const conversationReportStatusSchema = z.enum([
|
|
335
329
|
"active",
|
|
336
330
|
"completed",
|
|
@@ -960,5 +954,4 @@ const conversationStatsReportSchema = z.object({
|
|
|
960
954
|
windowEnd: z.string(),
|
|
961
955
|
windowStart: z.string()
|
|
962
956
|
}).strict();
|
|
963
|
-
//#endregion
|
|
964
957
|
export { forkConversationBodySchema as A, briefLinkSchema as B, conversationReportEventSchema as C, conversationUsageSchema as D, conversationSummaryReportSchema as E, readMessageAttachments as F, messageCardRef as G, conversationBriefSchema as H, INPUT_IMAGE_TYPES as I, removedCardSchema as J, messageCardText as K, detectImageMediaType as L, conversationChildAgentTotalsSchema as M, MAX_INPUT_IMAGES as N, createConversationBodySchema as O, MAX_INPUT_IMAGE_BYTES as P, isVisionImageMediaType as R, conversationReportEventDataSchema as S, conversationStatsReportSchema as T, parseBriefInput as U, briefOutcomeStatusSchema as V, annotationCard as W, resolveMessageCards as Y, conversationParamsSchema as _, cancelConversationPendingMessagesBodySchema as a, conversationPendingMessageSchema as b, conversationAttachmentParamsSchema as c, conversationDetailReportSchema as d, conversationEventHistorySchema as f, conversationFeedSchema as g, conversationFeedQuerySchema as h, archiveConversationResponseSchema as i, forkConversationResponseSchema as j, createConversationMessageBodySchema as k, conversationAuxiliaryCostsSchema as l, conversationEventsQuerySchema as m, actorIdentitySchema as n, cancelConversationPendingMessagesResponseSchema as o, conversationEventPageSchema as p, readMessageCardRefs as q, archiveConversationBodySchema as r, conversationActivityPreviewSchema as s, acceptedConversationMessageSchema as t, conversationDetailQuerySchema as u, conversationPendingAuthorizationSchema as v, conversationStatsItemSchema as w, conversationPendingMessagesReportSchema as x, conversationPendingMessageDeliverySchema as y, briefCodeChangeSchema as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { m as logWarn } from "./logging-
|
|
1
|
+
import { m as logWarn } from "./logging-BStXN56b.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
|
-
|
|
3
|
+
// src/chat/conversation-privacy.ts
|
|
4
4
|
const SAFE_METADATA_KEY_LIMIT = 20;
|
|
5
5
|
const conversationPrivacyStorage = new AsyncLocalStorage();
|
|
6
6
|
/**
|
|
@@ -178,5 +178,4 @@ function toGenAiMessagesTraceAttributes(prefix, messages) {
|
|
|
178
178
|
...partTypes.size > 0 ? { [`${prefix}.part_types`]: [...partTypes] } : void 0
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
|
-
//#endregion
|
|
182
181
|
export { toCanonicalInputMessage as a, toGenAiPayloadMetadata as c, runWithConversationPrivacy as i, toGenAiPayloadTraceAttributes as l, getCurrentConversationPrivacy as n, toCanonicalOutputMessage as o, resolveConversationPrivacy as r, toGenAiMessagesTraceAttributes as s, canExposeConversationPayload as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/chat/local/conversation-work.ts
|
|
2
2
|
/**
|
|
3
3
|
* Run local conversation work in this process and wait for every accepted wake.
|
|
4
4
|
*
|
|
@@ -47,5 +47,4 @@ function createLocalConversationWork(processMessage) {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
//#endregion
|
|
51
50
|
export { createLocalConversationWork };
|