@sentry/junior 0.256.0 → 0.258.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/{admin-BhucwVfy.js → admin-My1SLGVO.js} +2 -3
- package/dist/{agent-hooks-DlSK8PQQ.js → agent-hooks-BJ_5mlRH.js} +71 -111
- package/dist/{agent-invocations-BY60iNw-.js → agent-invocations-Qfz7dWgU.js} +8 -13
- package/dist/{agent-runner-C6_cd61V.js → agent-runner-DGsFQw72.js} +278 -467
- package/dist/api/schema.d.ts +454 -448
- package/dist/api/schema.js +5 -5
- package/dist/api.d.ts +2 -12
- package/dist/api.js +189 -165
- package/dist/{app-B0gT1Slp.d.ts → app-PX2H1PxU.d.ts} +20 -37
- package/dist/app.d.ts +3 -3
- package/dist/app.js +565 -305
- package/dist/{assistant-reply-yn5G-YEG.js → assistant-reply-H1M-91oF.js} +3 -5
- package/dist/{automation-CHdlHVZP.js → automation-DWBFBenG.js} +6 -11
- package/dist/{briefs-U6Bi3IYw.js → briefs-vYoK85rJ.js} +8 -11
- package/dist/{cadence-D00SCzT1.js → cadence-R7Em4RjE.js} +1 -2
- package/dist/{catalog-runtime-DF5OWqCc.js → catalog-runtime-BN4DVxco.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 +4 -5
- package/dist/cli/plugins.d.ts +2 -4
- package/dist/cli/plugins.js +7 -8
- package/dist/cli/run.d.ts +1 -2
- package/dist/cli/run.js +1 -2
- package/dist/cli/snapshot-create.d.ts +1 -3
- package/dist/cli/snapshot-create.js +4 -5
- package/dist/cli/upgrade.d.ts +3 -6
- package/dist/cli/upgrade.js +11 -17
- package/dist/{client-BVrAp-pq.js → client-DbyHuMFU.js} +9 -16
- package/dist/{config-DdBiDanf.js → config-_WO_AjCB.js} +18 -15
- package/dist/{connections-CG04HdpC.js → connections-ag_1JOhB.js} +21 -21
- package/dist/{conversation-T18Xlkx9.js → conversation-DjN3mlog.js} +11 -17
- package/dist/{conversation-privacy-CpSYOWnP.js → conversation-privacy-DHP_xnVj.js} +2 -3
- package/dist/{conversation-work-C6y3T5Hx.js → conversation-work-BaT_T6EB.js} +1 -2
- package/dist/{credential-sync-DKWNdcgm.js → credential-sync-B-CPX_ag.js} +89 -52
- package/dist/{db-Ca9Nt5ci.d.ts → db-BnRqQ7G5.d.ts} +1 -1
- package/dist/{executor-BroK9oKy.js → executor-RvG6kVe1.js} +58 -70
- package/dist/{experimental-Qn9rKLgx.js → experimental-BNK1l1jv.js} +2 -3
- 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-D0VZ5nv0.js → images-C2J_bj2g.js} +5 -6
- package/dist/instrumentation.d.ts +1 -3
- package/dist/instrumentation.js +6 -8
- package/dist/{job-queue-BbGg3gvu.js → job-queue-DVe37it2.js} +6 -12
- package/dist/{logging-tPQeUe2i.js → logging-DsHONhVm.js} +54 -24
- package/dist/{message-DdPGRYQP.js → message-DyitL8no.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-B-2errCX.js → oauth-callback-server-CDby-pCn.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-DT3MRVW8.js → pending-auth-D8J1uJUS.js} +37 -28
- package/dist/{plugin-module-CVvEUSMH.js → plugin-module-Cf5gVPWP.js} +1 -2
- package/dist/{plugins-CjfUP5gJ.d.ts → plugins-B11Mfkmv.d.ts} +0 -4
- 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-Bb1zCVGP.js → profile-DpYjfKke.js} +16 -28
- package/dist/{prompt-C04mP1hu.js → prompt-xgpyMtg7.js} +5 -9
- package/dist/{queue-B5SnqRln.d.ts → queue-C37RbDVc.d.ts} +0 -2
- package/dist/{registry-CsNavQ_Z.js → registry-Du566MtJ.js} +57 -30
- package/dist/{resolve-B6ZZ9duG.js → resolve-ClCIgh8E.js} +7 -12
- package/dist/{result-j9nS0se-.js → result-BBbKA61B.js} +13 -17
- package/dist/{rolldown-runtime-B4FMCO8f.js → rolldown-runtime-nwUcYXjP.js} +1 -2
- package/dist/{runner-Y331DoZ5.js → runner-CCuqFSqx.js} +12 -13
- package/dist/{sandbox-egress-signals-BUfjEdHY.js → sandbox-egress-signals-DY1mbKF4.js} +2 -3
- package/dist/{schema-BBgv0MNf.js → schema-DrMh3NtR.js} +17 -27
- package/dist/{sentry-CgWZM_kV.js → sentry-BBUlHih9.js} +2 -3
- package/dist/{session-stop-q-6GNHx6.js → session-stop-CIoFiwwe.js} +57 -41
- package/dist/{skills-CyvTsR9M.js → skills-DyQBLIrK.js} +9 -9
- package/dist/{spawn-Do5mX3d_.js → spawn-Dqfeo7XP.js} +4 -5
- package/dist/{store-DoewL5mG.d.ts → store-CG0VJyye.d.ts} +0 -14
- package/dist/{store-D2It0ozF.js → store-DJLwq4x8.js} +13 -15
- package/dist/{task-queue-ZMk9bLRT.js → task-queue-BzW4MaWU.js} +5 -7
- package/dist/{task-runner-cIGU5VwJ.js → task-runner-D3qJh4fK.js} +22 -26
- package/dist/{tasks-CODtRzvX.js → tasks-CEXKTASS.js} +78 -79
- package/dist/{thread-state-BPkwVmvK.js → thread-state-W3f6kAtz.js} +13 -19
- package/dist/{turn-failure-response-ChmMeKar.js → turn-failure-response-CWx7aNIh.js} +16 -22
- package/dist/{turn-lifecycle-BUP7ZOVa.js → turn-lifecycle-C9JFst7-.js} +2 -3
- package/dist/{turn-session-routing-BcWM3PLm.js → turn-session-routing-CUxtfpr7.js} +2 -3
- package/dist/{validation-DCd69-cP.js → validation-BHRxa5G4.js} +3 -4
- package/dist/vercel.d.ts +1 -3
- package/dist/vercel.js +1 -2
- package/dist/{version-DBc4Qt_P.js → version-C0U6rHg0.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-C-9nFKYr.js → viewer-CGvvRqKp.js} +61 -44
- package/dist/{web-input-Cv42P3ni.js → web-input-Keb5GRWj.js} +139 -198
- package/dist/{web-message-id-xPI_EFSC.js → web-message-id-CJSUiksE.js} +3 -6
- package/dist/{work-6UmVQq1V.js → work-DRcsJ3hV.js} +14 -16
- package/dist/{worker-DAoBZuZn.js → worker-Cjo-QqPq.js} +7 -8
- package/migrations/0059_automation_run_version.sql +2 -0
- package/migrations/0060_identity_signed_in_at.sql +1 -0
- package/migrations/meta/0059_snapshot.json +3619 -0
- package/migrations/meta/0060_snapshot.json +3465 -0
- package/migrations/meta/_journal.json +15 -1
- package/package.json +8 -6
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { 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, y as withScope } from "./sentry-
|
|
2
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
1
|
+
import { 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, y as withScope } from "./sentry-BBUlHih9.js";
|
|
2
|
+
import { t as JUNIOR_VERSION } from "./version-C0U6rHg0.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
|
+
// src/chat/coerce.ts
|
|
8
8
|
/** Narrow an unknown value to a non-empty string, or undefined. */
|
|
9
9
|
function toOptionalString(value) {
|
|
10
10
|
return typeof value === "string" && value.trim() ? value : void 0;
|
|
@@ -17,8 +17,26 @@ function toOptionalNumber(value) {
|
|
|
17
17
|
function isRecord(value) {
|
|
18
18
|
return typeof value === "object" && value !== null;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
// src/chat/identities/identity.ts
|
|
21
|
+
/**
|
|
22
|
+
* Provider of the native Google identity. Core links it through Google
|
|
23
|
+
* sign-in. Its tenant is empty and its subject is the Google OIDC `sub`.
|
|
24
|
+
*/
|
|
25
|
+
const GOOGLE_IDENTITY_PROVIDER = "google";
|
|
26
|
+
const NATIVE_IDENTITY_PROVIDERS = /* @__PURE__ */ new Set(["slack", GOOGLE_IDENTITY_PROVIDER]);
|
|
27
|
+
/**
|
|
28
|
+
* Return whether only core may link identities for this provider. Plugin
|
|
29
|
+
* OAuth accounts must not link under these names, because other checks trust
|
|
30
|
+
* them.
|
|
31
|
+
*/
|
|
32
|
+
function isNativeIdentityProvider(provider) {
|
|
33
|
+
return NATIVE_IDENTITY_PROVIDERS.has(provider);
|
|
34
|
+
}
|
|
35
|
+
/** Canonicalize email addresses for identity lookup and linking. */
|
|
36
|
+
function normalizeIdentityEmail(email) {
|
|
37
|
+
return email?.trim().toLowerCase() || void 0;
|
|
38
|
+
}
|
|
39
|
+
// src/chat/log-context.ts
|
|
22
40
|
/** Async attribute domain consumed directly by LogTape. */
|
|
23
41
|
const logContextStorage = new AsyncLocalStorage();
|
|
24
42
|
/** Typed context domain retained for consumers such as native Sentry scope fields. */
|
|
@@ -38,11 +56,15 @@ function logContextToAttributes(context) {
|
|
|
38
56
|
"messaging.system": context.platform === "slack" ? "slack" : context.platform,
|
|
39
57
|
"messaging.message.conversation_id": context.messageConversationId,
|
|
40
58
|
"messaging.destination.name": context.destinationName,
|
|
41
|
-
"
|
|
42
|
-
"
|
|
59
|
+
"user.id": context.userId,
|
|
60
|
+
"user.name": context.userName,
|
|
61
|
+
"user.email": normalizeIdentityEmail(context.userEmail),
|
|
62
|
+
"user.full_name": context.userFullName,
|
|
43
63
|
"app.run.id": context.runId,
|
|
44
64
|
"app.actor.type": context.actorType,
|
|
45
65
|
"app.actor.id": context.actorId,
|
|
66
|
+
"app.task.id": context.taskId,
|
|
67
|
+
"app.credential.allowed_when": context.credentialAllowedWhen,
|
|
46
68
|
"gen_ai.agent.name": context.assistantUserName,
|
|
47
69
|
"gen_ai.request.model": context.modelId,
|
|
48
70
|
"app.skill.name": context.skillName,
|
|
@@ -77,14 +99,7 @@ function getBoundLogContext() {
|
|
|
77
99
|
function getBoundLogAttributes() {
|
|
78
100
|
return logContextStorage.getStore() ?? {};
|
|
79
101
|
}
|
|
80
|
-
|
|
81
|
-
//#region src/chat/identities/identity.ts
|
|
82
|
-
/** Canonicalize email addresses for identity lookup and linking. */
|
|
83
|
-
function normalizeIdentityEmail(email) {
|
|
84
|
-
return email?.trim().toLowerCase() || void 0;
|
|
85
|
-
}
|
|
86
|
-
//#endregion
|
|
87
|
-
//#region src/deployment.ts
|
|
102
|
+
// src/deployment.ts
|
|
88
103
|
const JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
|
|
89
104
|
const JUNIOR_HEARTBEAT_CRON_SCHEDULE = "* * * * *";
|
|
90
105
|
const JUNIOR_RETENTION_ROUTE = "/api/internal/retention";
|
|
@@ -114,8 +129,7 @@ function getDeploymentTelemetryAttributes() {
|
|
|
114
129
|
if (deploymentId) attributes["deployment.id"] = deploymentId;
|
|
115
130
|
return attributes;
|
|
116
131
|
}
|
|
117
|
-
|
|
118
|
-
//#region src/chat/logging.ts
|
|
132
|
+
// src/chat/logging.ts
|
|
119
133
|
/**
|
|
120
134
|
* Structured logging for Junior runtime events.
|
|
121
135
|
*
|
|
@@ -218,8 +232,10 @@ const CONSOLE_PRIORITY_INDEX = new Map([
|
|
|
218
232
|
const CONSOLE_ALWAYS_HIDDEN_KEYS = /* @__PURE__ */ new Set([
|
|
219
233
|
"gen_ai.agent.name",
|
|
220
234
|
"app.platform",
|
|
221
|
-
"
|
|
222
|
-
"
|
|
235
|
+
"user.id",
|
|
236
|
+
"user.name",
|
|
237
|
+
"user.email",
|
|
238
|
+
"user.full_name",
|
|
223
239
|
"http.request.method",
|
|
224
240
|
"messaging.system",
|
|
225
241
|
"url.full",
|
|
@@ -246,8 +262,10 @@ const SENTRY_TAG_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
|
|
|
246
262
|
function getSentryEnvironment() {
|
|
247
263
|
return (process.env.SENTRY_ENVIRONMENT ?? process.env.VERCEL_ENV ?? process.env.NODE_ENV ?? "").trim().toLowerCase();
|
|
248
264
|
}
|
|
249
|
-
|
|
250
|
-
|
|
265
|
+
/** Marks an audit event. Sentry keeps it in production. */
|
|
266
|
+
const AUDIT_LOG_ATTRIBUTE = "app.log.audit";
|
|
267
|
+
function shouldSuppressInfoLog(level, attributes) {
|
|
268
|
+
return getSentryEnvironment() === "production" && level === "info" && attributes[AUDIT_LOG_ATTRIBUTE] !== true;
|
|
251
269
|
}
|
|
252
270
|
function shouldEmitConsole(level) {
|
|
253
271
|
if (process.env.NODE_ENV === "test") return level === "error";
|
|
@@ -516,7 +534,7 @@ function getLogTapeLogger(category = []) {
|
|
|
516
534
|
return logger;
|
|
517
535
|
}
|
|
518
536
|
function emitSentry(level, body, attributes) {
|
|
519
|
-
if (shouldSuppressInfoLog(level)) return;
|
|
537
|
+
if (shouldSuppressInfoLog(level, attributes)) return;
|
|
520
538
|
const loggerFn = logger?.[level];
|
|
521
539
|
if (typeof loggerFn === "function") {
|
|
522
540
|
loggerFn(body, attributes);
|
|
@@ -946,6 +964,19 @@ function logInfo(eventName, attributes = {}) {
|
|
|
946
964
|
log.info(eventName, attributes);
|
|
947
965
|
}
|
|
948
966
|
/**
|
|
967
|
+
* Emit an audit event: an info event that Sentry also keeps in production.
|
|
968
|
+
*
|
|
969
|
+
* Use it only to record who caused an external side effect and why. Other
|
|
970
|
+
* info events stay out of Sentry in production. Sentry log retention is not
|
|
971
|
+
* durable audit storage.
|
|
972
|
+
*/
|
|
973
|
+
function logAudit(eventName, attributes = {}) {
|
|
974
|
+
log.info(eventName, {
|
|
975
|
+
...attributes,
|
|
976
|
+
[AUDIT_LOG_ATTRIBUTE]: true
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
949
980
|
* Emit a warning event with occurrence-specific attributes.
|
|
950
981
|
*
|
|
951
982
|
* Bind correlation context at the owning operation boundary instead of
|
|
@@ -1206,5 +1237,4 @@ function extractGenAiUsageAttributes(...sources) {
|
|
|
1206
1237
|
...cost?.total !== void 0 ? { "app.cost.total_usd": cost.total } : void 0
|
|
1207
1238
|
};
|
|
1208
1239
|
}
|
|
1209
|
-
|
|
1210
|
-
export { JUNIOR_RETENTION_ROUTE as A, withLogContext as C, JUNIOR_HEARTBEAT_ROUTE as D, JUNIOR_HEARTBEAT_CRON_SCHEDULE as E, normalizeIdentityEmail as F, isRecord as I, toOptionalNumber as L, LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION as M, getDeploymentServiceVersion as N, JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE as O, getDeploymentTelemetryAttributes as P, toOptionalString as R, withContext as S, JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE as T, setSentryUser as _, extractGenAiUsageSummary as a, setTags as b, getLogContextAttributesForSpan as c, logException as d, logInfo as f, serializeGenAiAttribute as g, runBestEffort as h, extractGenAiUsageAttributes as i, JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE as j, JUNIOR_RETENTION_CRON_SCHEDULE as k, getTracePropagationHeaders as l, normalizeGenAiFinishReason as m, createChatSdkLogger as n, getActiveTraceId as o, logWarn as p, createRequestContext as r, getLogContextAttributes as s, buildTurnFailureResponse as t, logError as u, setSpanAttributes as v, withSpan as w, summarizeMessageText as x, setSpanStatus as y };
|
|
1240
|
+
export { JUNIOR_RETENTION_CRON_SCHEDULE as A, toOptionalNumber as B, withContext as C, JUNIOR_HEARTBEAT_CRON_SCHEDULE as D, JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE as E, getDeploymentTelemetryAttributes as F, GOOGLE_IDENTITY_PROVIDER as I, isNativeIdentityProvider as L, JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE as M, LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION as N, JUNIOR_HEARTBEAT_ROUTE as O, getDeploymentServiceVersion as P, normalizeIdentityEmail as R, summarizeMessageText as S, withSpan as T, toOptionalString as V, serializeGenAiAttribute as _, extractGenAiUsageSummary as a, setSpanStatus as b, getLogContextAttributesForSpan as c, logError as d, logException as f, runBestEffort as g, normalizeGenAiFinishReason as h, extractGenAiUsageAttributes as i, JUNIOR_RETENTION_ROUTE as j, JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE as k, getTracePropagationHeaders as l, logWarn as m, createChatSdkLogger as n, getActiveTraceId as o, logInfo as p, createRequestContext as r, getLogContextAttributes as s, buildTurnFailureResponse as t, logAudit as u, setSentryUser as v, withLogContext as w, setTags as x, setSpanAttributes as y, isRecord as z };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { Ht as toolInvocationDestination, Q as getActiveAgentInvocationForConversation, Vt as actorFromRun, Y as createAgentInvocationForMessage, Z as findChildAgentConversationId, _t as AgentMessageTargetError, vt as PARENT_AGENT_TARGET } from "./agent-runner-
|
|
3
|
-
import { n as enqueueAgentMessageToParent } from "./result-
|
|
4
|
-
import { r as enqueueAgentInvocation } from "./work-
|
|
5
|
-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
+
import { Ht as toolInvocationDestination, Q as getActiveAgentInvocationForConversation, Vt as actorFromRun, Y as createAgentInvocationForMessage, Z as findChildAgentConversationId, _t as AgentMessageTargetError, vt as PARENT_AGENT_TARGET } from "./agent-runner-DGsFQw72.js";
|
|
3
|
+
import { n as enqueueAgentMessageToParent } from "./result-BBbKA61B.js";
|
|
4
|
+
import { r as enqueueAgentInvocation } from "./work-DRcsJ3hV.js";
|
|
5
|
+
// src/chat/agent-invocations/message.ts
|
|
6
6
|
var message_exports = /* @__PURE__ */ __exportAll({ bindMessageAgent: () => bindMessageAgent });
|
|
7
7
|
/**
|
|
8
8
|
* Bind a Run's Actor and credentials to messages for its parent and child
|
|
@@ -55,5 +55,4 @@ function bindMessageAgent(run, options) {
|
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
//#endregion
|
|
59
58
|
export { message_exports as n, bindMessageAgent as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
// src/chat/reasoning-level.ts
|
|
3
3
|
const TURN_REASONING_LEVELS = [
|
|
4
4
|
"none",
|
|
5
5
|
"low",
|
|
@@ -11,8 +11,7 @@ const TURN_REASONING_LEVELS = [
|
|
|
11
11
|
function parseTurnReasoningLevel(value) {
|
|
12
12
|
return z.enum(TURN_REASONING_LEVELS).parse(value);
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
//#region src/chat/model-profile.ts
|
|
14
|
+
// src/chat/model-profile.ts
|
|
16
15
|
/** Keep durable profile names stable and safe to expose in tool schemas. */
|
|
17
16
|
const modelProfileSchema = z.string().regex(/^[a-z][a-z0-9_-]*$/);
|
|
18
17
|
/** Shared model profiles used when the app does not configure its own. */
|
|
@@ -58,5 +57,4 @@ function profileConfig(config, profile) {
|
|
|
58
57
|
if (!profileConfig) throw new ModelProfileNotConfiguredError(profile);
|
|
59
58
|
return profileConfig;
|
|
60
59
|
}
|
|
61
|
-
//#endregion
|
|
62
60
|
export { formatModelProfiles as a, profileConfig as c, formatModelProfile as i, TURN_REASONING_LEVELS as l, ModelProfileNotConfiguredError as n, modelIdForProfile as o, defaultModelId as r, modelProfileSchema as s, DEFAULT_MODEL_PROFILES as t, parseTurnReasoningLevel as u };
|
package/dist/nitro.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { r as JuniorDashboardOptions } from "./app-
|
|
2
|
-
import { n as JuniorPluginSet } from "./plugins-
|
|
3
|
-
//#region src/nitro.d.ts
|
|
1
|
+
import { r as JuniorDashboardOptions } from "./app-PX2H1PxU.js";
|
|
2
|
+
import { n as JuniorPluginSet } from "./plugins-B11Mfkmv.js";
|
|
4
3
|
export type JuniorNitroDashboardOptions = JuniorDashboardOptions;
|
|
5
4
|
export interface JuniorPluginModuleReference {
|
|
6
5
|
/** Runtime-safe module that exports a `defineJuniorPlugins(...)` set. */
|
|
@@ -31,5 +30,4 @@ export declare function juniorNitro(options?: JuniorNitroOptions): {
|
|
|
31
30
|
nitro: {
|
|
32
31
|
setup(nitro: unknown): void;
|
|
33
32
|
};
|
|
34
|
-
};
|
|
35
|
-
//#endregion
|
|
33
|
+
};
|
package/dist/nitro.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-
|
|
3
|
-
import { o as resolveConversationWorkQueueTopic, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-
|
|
4
|
-
import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-
|
|
5
|
-
import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-
|
|
6
|
-
import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-
|
|
1
|
+
import { A as JUNIOR_RETENTION_CRON_SCHEDULE, D as JUNIOR_HEARTBEAT_CRON_SCHEDULE, E as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, M as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, O as JUNIOR_HEARTBEAT_ROUTE, j as JUNIOR_RETENTION_ROUTE, k as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE } from "./logging-DsHONhVm.js";
|
|
2
|
+
import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DJBompdd.js";
|
|
3
|
+
import { o as resolveConversationWorkQueueTopic, t as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC } from "./job-queue-DVe37it2.js";
|
|
4
|
+
import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-DOm9Y6qI.js";
|
|
5
|
+
import { t as PLUGIN_TASK_QUEUE_TOPIC } from "./task-queue-BzW4MaWU.js";
|
|
6
|
+
import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cf5gVPWP.js";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { cpSync, existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
|
|
9
|
-
|
|
9
|
+
// src/build/rolldown-workarounds.ts
|
|
10
10
|
/**
|
|
11
11
|
* Override rolldown's treeshake config so that module side effects survive
|
|
12
12
|
* bundling.
|
|
@@ -28,15 +28,13 @@ function applyRolldownTreeshakeWorkaround(nitro) {
|
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
//#region src/build/glob-to-regex.ts
|
|
31
|
+
// src/build/glob-to-regex.ts
|
|
33
32
|
/** Convert a simple file glob (supporting `*` wildcards) into a RegExp. */
|
|
34
33
|
function globToRegex(pattern) {
|
|
35
34
|
const escaped = pattern.replace(/[\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
|
|
36
35
|
return new RegExp(`^${escaped}$`);
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
//#region src/build/copy-build-content.ts
|
|
37
|
+
// src/build/copy-build-content.ts
|
|
40
38
|
const DASHBOARD_PACKAGE_NAME = "@sentry/junior-dashboard";
|
|
41
39
|
const JUNIOR_PACKAGE_NAME = "@sentry/junior";
|
|
42
40
|
const DASHBOARD_ASSET_NAMES = ["client.js", "tailwind.css"];
|
|
@@ -93,7 +91,7 @@ function parseIncludePattern(pattern) {
|
|
|
93
91
|
const normalized = pattern.trim().replace(/^node_modules\//, "");
|
|
94
92
|
const parts = normalized.split("/");
|
|
95
93
|
if (!normalized || path.isAbsolute(normalized) || parts.some((part) => !part || part === "." || part === "..")) throw new Error(`includeFiles entry "${pattern}" must be a package subpath pattern`);
|
|
96
|
-
const packagePartCount = parts[0]
|
|
94
|
+
const packagePartCount = parts[0]?.startsWith("@") ?? false ? 2 : 1;
|
|
97
95
|
const pkgName = parts.slice(0, packagePartCount).join("/");
|
|
98
96
|
const subpath = parts.slice(packagePartCount).join("/");
|
|
99
97
|
if (!pkgName || !isValidPackageName(pkgName) || !subpath) throw new Error(`includeFiles entry "${pattern}" must include a package subpath`);
|
|
@@ -140,8 +138,7 @@ function nodeModulesRelativePath(sourcePath) {
|
|
|
140
138
|
if (nodeModulesIndex === -1 || nodeModulesIndex === parts.length - 1) return null;
|
|
141
139
|
return path.join("node_modules", ...parts.slice(nodeModulesIndex + 1));
|
|
142
140
|
}
|
|
143
|
-
|
|
144
|
-
//#region src/build/virtual-config.ts
|
|
141
|
+
// src/build/virtual-config.ts
|
|
145
142
|
function renderRuntimePluginImport(module) {
|
|
146
143
|
if (module.exportName === "default") return `import juniorRuntimePluginSet from ${JSON.stringify(module.specifier)};`;
|
|
147
144
|
return `import { ${module.exportName} as juniorRuntimePluginSet } from ${JSON.stringify(module.specifier)};`;
|
|
@@ -177,8 +174,7 @@ function injectVirtualConfig(nitro, options = {}) {
|
|
|
177
174
|
});
|
|
178
175
|
};
|
|
179
176
|
}
|
|
180
|
-
|
|
181
|
-
//#region src/nitro.ts
|
|
177
|
+
// src/nitro.ts
|
|
182
178
|
const DEFAULT_FUNCTION_MAX_DURATION_SECONDS = 300;
|
|
183
179
|
const VERCEL_QUEUE_TRIGGER_TYPE = "queue/v2beta";
|
|
184
180
|
function isPluginModuleReference(value) {
|
|
@@ -320,5 +316,4 @@ function juniorNitro(options = {}) {
|
|
|
320
316
|
});
|
|
321
317
|
} } };
|
|
322
318
|
}
|
|
323
|
-
//#endregion
|
|
324
319
|
export { juniorNitro };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/chat/runtime/turn.ts
|
|
2
2
|
/** Classified Slack turn failure carrying the owning Sentry capture outward. */
|
|
3
3
|
var ConversationTurnBoundaryError = class extends Error {
|
|
4
4
|
eventId;
|
|
@@ -89,11 +89,9 @@ function markTurnFailed(args) {
|
|
|
89
89
|
skippedReason: "reply failed"
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
//#region src/chat/oauth-authorization.ts
|
|
92
|
+
// src/chat/oauth-authorization.ts
|
|
94
93
|
/** Build the stable event identity shared by authorization request and completion. */
|
|
95
94
|
function authorizationId(args) {
|
|
96
95
|
return `${args.sessionId}:${args.kind}:${args.provider}`;
|
|
97
96
|
}
|
|
98
|
-
//#endregion
|
|
99
97
|
export { TurnInputDeferredError as a, isTurnInputCommitLostError as c, markTurnCompleted as d, markTurnFailed as f, TurnInputCommitLostError as i, isTurnInputDeferredError as l, ConversationTurnBoundaryError as n, getConversationTurnBoundaryError as o, startActiveTurn as p, CooperativeTurnYieldError as r, isCooperativeTurnYieldError as s, authorizationId as t, markTurnClosed as u };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Lt as createUserTokenStore } from "./agent-runner-
|
|
2
|
-
import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-
|
|
1
|
+
import { Lt as createUserTokenStore } from "./agent-runner-DGsFQw72.js";
|
|
2
|
+
import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-B-CPX_ag.js";
|
|
3
3
|
import { createServer } from "node:http";
|
|
4
|
-
|
|
4
|
+
// src/chat/local/oauth-callback-server.ts
|
|
5
5
|
const LOCAL_OAUTH_TIMEOUT_MS = 6e5;
|
|
6
6
|
const LOCAL_OAUTH_CALLBACK_TIMEOUT_MS = 6e4;
|
|
7
7
|
function decodeProvider(value) {
|
|
@@ -126,5 +126,4 @@ async function startLocalOAuthCallbackServer() {
|
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
|
-
//#endregion
|
|
130
129
|
export { startLocalOAuthCallbackServer };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { randomBytes } from "node:crypto";
|
|
4
4
|
import { SignJWT, jwtVerify } from "jose";
|
|
5
|
-
|
|
5
|
+
// src/chat/local/oauth-relay.ts
|
|
6
6
|
var oauth_relay_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
createLocalOAuthState: () => createLocalOAuthState,
|
|
8
8
|
relayLocalOAuthCallback: () => relayLocalOAuthCallback
|
|
@@ -58,5 +58,4 @@ async function relayLocalOAuthCallback(request) {
|
|
|
58
58
|
url.searchParams.set("jr_local_relay", "complete");
|
|
59
59
|
return Response.redirect(url, 302);
|
|
60
60
|
}
|
|
61
|
-
//#endregion
|
|
62
61
|
export { relayLocalOAuthCallback as n, oauth_relay_exports as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import fs, { statSync } from "node:fs";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
|
|
6
|
+
// src/package-resolution.ts
|
|
7
7
|
function isDirectory$1(targetPath) {
|
|
8
8
|
try {
|
|
9
9
|
return statSync(targetPath).isDirectory();
|
|
@@ -51,9 +51,9 @@ function isValidPackageSegment(segment) {
|
|
|
51
51
|
/** Return whether a string is shaped like an npm package name. */
|
|
52
52
|
function isValidPackageName(packageName) {
|
|
53
53
|
if (!packageName || packageName.includes("\\") || path.isAbsolute(packageName)) return false;
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
return
|
|
54
|
+
const [scopeOrName = "", name, ...rest] = packageName.split("/");
|
|
55
|
+
if (scopeOrName.startsWith("@")) return name !== void 0 && rest.length === 0 && scopeOrName.length > 1 && isValidPackageSegment(scopeOrName.slice(1)) && isValidPackageSegment(name);
|
|
56
|
+
return name === void 0 && isValidPackageSegment(scopeOrName);
|
|
57
57
|
}
|
|
58
58
|
function findPackageRoot(entryPath) {
|
|
59
59
|
let dir = path.dirname(entryPath);
|
|
@@ -106,8 +106,7 @@ function resolvePackageLocation(cwd, packageName, options) {
|
|
|
106
106
|
function resolvePackageDir(cwd, packageName) {
|
|
107
107
|
return resolvePackageLocation(cwd, packageName)?.dir;
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
//#region src/chat/discovery.ts
|
|
109
|
+
// src/chat/discovery.ts
|
|
111
110
|
var discovery_exports = /* @__PURE__ */ __exportAll({
|
|
112
111
|
builtInSkillsDir: () => builtInSkillsDir,
|
|
113
112
|
dataDir: () => dataDir,
|
|
@@ -252,7 +251,6 @@ function resolveHomeDir(cwd = process.cwd(), options) {
|
|
|
252
251
|
const directApp = path.resolve(resolvedCwd, "app");
|
|
253
252
|
if (pathExists(directApp) && hasAnyDataMarkers(directApp)) return directApp;
|
|
254
253
|
const candidates = resolveCandidateAppDirs(resolvedCwd, options?.projectRoots);
|
|
255
|
-
if (candidates.length === 0) return directApp;
|
|
256
254
|
candidates.sort((left, right) => {
|
|
257
255
|
const leftScore = scoreAppCandidate(left);
|
|
258
256
|
const rightScore = scoreAppCandidate(right);
|
|
@@ -262,11 +260,11 @@ function resolveHomeDir(cwd = process.cwd(), options) {
|
|
|
262
260
|
if (leftDistance !== rightDistance) return leftDistance - rightDistance;
|
|
263
261
|
return left.localeCompare(right);
|
|
264
262
|
});
|
|
265
|
-
return candidates[0];
|
|
263
|
+
return candidates[0] ?? directApp;
|
|
266
264
|
}
|
|
267
|
-
function
|
|
268
|
-
if (subdir === "data") return
|
|
269
|
-
return
|
|
265
|
+
function resolveContentRoot(subdir) {
|
|
266
|
+
if (subdir === "data") return homeDir();
|
|
267
|
+
return path.join(homeDir(), subdir);
|
|
270
268
|
}
|
|
271
269
|
/** Return the built-in skills directory in source and packaged builds. */
|
|
272
270
|
function builtInSkillsDir() {
|
|
@@ -278,7 +276,7 @@ function builtInSkillsDir() {
|
|
|
278
276
|
}
|
|
279
277
|
/** Return the data directory (same as homeDir). */
|
|
280
278
|
function dataDir() {
|
|
281
|
-
return
|
|
279
|
+
return resolveContentRoot("data");
|
|
282
280
|
}
|
|
283
281
|
/** Return the path to the SOUL.md file. */
|
|
284
282
|
function soulPath() {
|
|
@@ -294,23 +292,23 @@ function descriptionPath() {
|
|
|
294
292
|
}
|
|
295
293
|
/** Return the skills directory path. */
|
|
296
294
|
function skillsDir() {
|
|
297
|
-
return
|
|
295
|
+
return resolveContentRoot("skills");
|
|
298
296
|
}
|
|
299
297
|
/** Return the plugins directory path. */
|
|
300
298
|
function pluginsDir() {
|
|
301
|
-
return
|
|
299
|
+
return resolveContentRoot("plugins");
|
|
302
300
|
}
|
|
303
301
|
/** Return all unique data root directories. */
|
|
304
302
|
function dataRoots() {
|
|
305
|
-
return unique(
|
|
303
|
+
return unique([resolveContentRoot("data")]);
|
|
306
304
|
}
|
|
307
305
|
/** Return all unique skill root directories. */
|
|
308
306
|
function skillRoots() {
|
|
309
|
-
return unique([builtInSkillsDir(),
|
|
307
|
+
return unique([builtInSkillsDir(), resolveContentRoot("skills")]);
|
|
310
308
|
}
|
|
311
309
|
/** Return all unique plugin root directories. */
|
|
312
310
|
function pluginRoots() {
|
|
313
|
-
return unique(
|
|
311
|
+
return unique([resolveContentRoot("plugins")]);
|
|
314
312
|
}
|
|
315
313
|
/** Return candidate paths where SOUL.md might be found. */
|
|
316
314
|
function soulPathCandidates() {
|
|
@@ -339,8 +337,7 @@ function listReferenceFiles() {
|
|
|
339
337
|
return [];
|
|
340
338
|
}
|
|
341
339
|
}
|
|
342
|
-
|
|
343
|
-
//#region src/chat/plugins/package-discovery.ts
|
|
340
|
+
// src/chat/plugins/package-discovery.ts
|
|
344
341
|
function normalizeForGlob(targetPath) {
|
|
345
342
|
return targetPath.split(path.sep).join("/");
|
|
346
343
|
}
|
|
@@ -451,5 +448,4 @@ function discoverInstalledPluginPackageContent(cwd = process.cwd(), options) {
|
|
|
451
448
|
tracingIncludes: uniqueStringsInOrder(tracingIncludes)
|
|
452
449
|
};
|
|
453
450
|
}
|
|
454
|
-
//#endregion
|
|
455
451
|
export { listReferenceFiles as a, soulPathCandidates as c, resolvePackageDir as d, homeDir as i, worldPathCandidates as l, normalizePluginPackageNames as n, pluginRoots as o, discovery_exports as r, skillRoots as s, discoverInstalledPluginPackageContent as t, isValidPackageName as u };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { v as isProviderRetryError } from "./client-
|
|
2
|
-
import {
|
|
3
|
-
import { r as isExperimentalFeatureEnabled } from "./experimental-
|
|
1
|
+
import { v as isProviderRetryError } from "./client-DbyHuMFU.js";
|
|
2
|
+
import { J as abandonTurnRecord, ln as estimateTextTokens } from "./tasks-CEXKTASS.js";
|
|
3
|
+
import { r as isExperimentalFeatureEnabled } from "./experimental-BNK1l1jv.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
|
|
5
|
+
// src/chat/state/turn-id.ts
|
|
6
6
|
/** Build a stable turn identifier from a message ID. */
|
|
7
7
|
function buildDeterministicTurnId(messageId) {
|
|
8
8
|
return `turn_${messageId.replace(/[^a-zA-Z0-9_-]/g, "_")}`;
|
|
@@ -11,8 +11,7 @@ function buildDeterministicTurnId(messageId) {
|
|
|
11
11
|
function buildDeterministicAssistantMessageId(turnId) {
|
|
12
12
|
return `${turnId}:assistant:1`;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
//#region src/chat/services/subscribed-reply-router-policy.ts
|
|
14
|
+
// src/chat/services/subscribed-reply-router-policy.ts
|
|
16
15
|
/**
|
|
17
16
|
* Passive subscribed-thread reply router policy.
|
|
18
17
|
*
|
|
@@ -64,8 +63,20 @@ Assess conversation floor ownership and whether the latest message continues wor
|
|
|
64
63
|
- Use low confidence only for genuinely ambiguous floor ownership. Do not lower confidence merely because the assistant was addressed implicitly.
|
|
65
64
|
- Keep the reason to one concise sentence under 160 characters grounded in floor ownership or continuity.`;
|
|
66
65
|
}
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
// src/chat/services/subscribed-decision.ts
|
|
67
|
+
/** Why the subscribed-thread router chose to reply or stay silent. */
|
|
68
|
+
const SubscribedReplyReason = {
|
|
69
|
+
ThreadOptOut: "thread_opt_out",
|
|
70
|
+
ExplicitMention: "explicit_mention",
|
|
71
|
+
DirectedFollowUp: "directed_follow_up",
|
|
72
|
+
DirectedToOtherParty: "directed_to_other_party",
|
|
73
|
+
EmptyMessage: "empty_message",
|
|
74
|
+
Classifier: "llm_classifier",
|
|
75
|
+
SideConversation: "side_conversation",
|
|
76
|
+
LowConfidence: "low_confidence",
|
|
77
|
+
ClassifierError: "classifier_error",
|
|
78
|
+
PassiveDisabled: "passive_disabled"
|
|
79
|
+
};
|
|
69
80
|
const replyDecisionSchema = z.object({
|
|
70
81
|
should_reply: z.boolean().describe("Whether Junior should respond to this thread message."),
|
|
71
82
|
should_unsubscribe: z.boolean().describe("Whether Junior should unsubscribe from this thread because the user clearly asked it to stop participating."),
|
|
@@ -131,13 +142,13 @@ function getThreadStopDecision(args) {
|
|
|
131
142
|
if (hasBangStop(rawText, text)) return {
|
|
132
143
|
shouldReply: false,
|
|
133
144
|
shouldUnsubscribe: true,
|
|
134
|
-
reason:
|
|
145
|
+
reason: SubscribedReplyReason.ThreadOptOut,
|
|
135
146
|
reasonDetail: "!stop"
|
|
136
147
|
};
|
|
137
148
|
if (isBareStop(rawText, text)) return {
|
|
138
149
|
shouldReply: false,
|
|
139
150
|
shouldUnsubscribe: true,
|
|
140
|
-
reason:
|
|
151
|
+
reason: SubscribedReplyReason.ThreadOptOut,
|
|
141
152
|
reasonDetail: "stop"
|
|
142
153
|
};
|
|
143
154
|
}
|
|
@@ -167,7 +178,7 @@ function parseTranscriptMessages(conversationContext) {
|
|
|
167
178
|
const lines = conversationContext.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
168
179
|
for (const line of lines) {
|
|
169
180
|
const match = line.match(TRANSCRIPT_MESSAGE_LINE_RE);
|
|
170
|
-
if (!match) continue;
|
|
181
|
+
if (!match?.[1]) continue;
|
|
171
182
|
const role = match[1].toLowerCase();
|
|
172
183
|
if (role !== "assistant" && role !== "user") continue;
|
|
173
184
|
messages.push({
|
|
@@ -279,7 +290,7 @@ function getSubscribedReplyPreflightDecision(args) {
|
|
|
279
290
|
if (!leadingOtherPartyAddress) return;
|
|
280
291
|
return {
|
|
281
292
|
shouldReply: false,
|
|
282
|
-
reason:
|
|
293
|
+
reason: SubscribedReplyReason.DirectedToOtherParty,
|
|
283
294
|
reasonDetail: leadingOtherPartyAddress
|
|
284
295
|
};
|
|
285
296
|
}
|
|
@@ -303,26 +314,26 @@ async function decideSubscribedThreadReply(args) {
|
|
|
303
314
|
if (preflightDecision) return preflightDecision;
|
|
304
315
|
if (!text && !args.input.hasAttachments) return {
|
|
305
316
|
shouldReply: false,
|
|
306
|
-
reason:
|
|
317
|
+
reason: SubscribedReplyReason.EmptyMessage
|
|
307
318
|
};
|
|
308
319
|
if (args.input.isExplicitMention) return {
|
|
309
320
|
shouldReply: true,
|
|
310
|
-
reason:
|
|
321
|
+
reason: SubscribedReplyReason.ExplicitMention
|
|
311
322
|
};
|
|
312
323
|
if (!isExperimentalFeatureEnabled("passive-routing")) return {
|
|
313
324
|
shouldReply: false,
|
|
314
|
-
reason:
|
|
325
|
+
reason: SubscribedReplyReason.PassiveDisabled,
|
|
315
326
|
reasonDetail: "passive-routing"
|
|
316
327
|
};
|
|
317
328
|
if (!args.input.hasAttachments && isAcknowledgmentOnly(text)) return {
|
|
318
329
|
shouldReply: false,
|
|
319
|
-
reason:
|
|
330
|
+
reason: SubscribedReplyReason.SideConversation,
|
|
320
331
|
reasonDetail: "acknowledgment"
|
|
321
332
|
};
|
|
322
333
|
const evidence = buildRouterEvidence(args.input);
|
|
323
334
|
if (evidence.assistantWasLastSpeaker && evidence.humanMessagesSinceLastAssistant === 0 && !evidence.currentMessageHasAttachments && (evidence.currentMessageHasDirectedFollowUpCue || evidence.currentMessageIsTerseClarification)) return {
|
|
324
335
|
shouldReply: true,
|
|
325
|
-
reason:
|
|
336
|
+
reason: SubscribedReplyReason.DirectedFollowUp,
|
|
326
337
|
reasonDetail: evidence.currentMessageIsTerseClarification ? "immediate terse clarification" : "immediate directed follow-up cue"
|
|
327
338
|
};
|
|
328
339
|
try {
|
|
@@ -348,33 +359,33 @@ async function decideSubscribedThreadReply(args) {
|
|
|
348
359
|
if (parsed.confidence < ROUTER_CONFIDENCE_THRESHOLD) return {
|
|
349
360
|
...result.costUsd !== void 0 ? { costUsd: result.costUsd } : void 0,
|
|
350
361
|
shouldReply: false,
|
|
351
|
-
reason:
|
|
362
|
+
reason: SubscribedReplyReason.LowConfidence,
|
|
352
363
|
reasonDetail: `${parsed.confidence.toFixed(2)}: ${reason}`
|
|
353
364
|
};
|
|
354
365
|
return {
|
|
355
366
|
...result.costUsd !== void 0 ? { costUsd: result.costUsd } : void 0,
|
|
356
367
|
shouldReply: false,
|
|
357
368
|
shouldUnsubscribe: true,
|
|
358
|
-
reason:
|
|
369
|
+
reason: SubscribedReplyReason.ThreadOptOut,
|
|
359
370
|
reasonDetail: reason
|
|
360
371
|
};
|
|
361
372
|
}
|
|
362
373
|
if (!parsed.should_reply) return {
|
|
363
374
|
...result.costUsd !== void 0 ? { costUsd: result.costUsd } : void 0,
|
|
364
375
|
shouldReply: false,
|
|
365
|
-
reason:
|
|
376
|
+
reason: SubscribedReplyReason.SideConversation,
|
|
366
377
|
reasonDetail: reason
|
|
367
378
|
};
|
|
368
379
|
if (parsed.confidence < ROUTER_CONFIDENCE_THRESHOLD) return {
|
|
369
380
|
...result.costUsd !== void 0 ? { costUsd: result.costUsd } : void 0,
|
|
370
381
|
shouldReply: false,
|
|
371
|
-
reason:
|
|
382
|
+
reason: SubscribedReplyReason.LowConfidence,
|
|
372
383
|
reasonDetail: `${parsed.confidence.toFixed(2)}: ${reason}`
|
|
373
384
|
};
|
|
374
385
|
return {
|
|
375
386
|
...result.costUsd !== void 0 ? { costUsd: result.costUsd } : void 0,
|
|
376
387
|
shouldReply: true,
|
|
377
|
-
reason:
|
|
388
|
+
reason: SubscribedReplyReason.Classifier,
|
|
378
389
|
reasonDetail: reason
|
|
379
390
|
};
|
|
380
391
|
} catch (error) {
|
|
@@ -382,12 +393,11 @@ async function decideSubscribedThreadReply(args) {
|
|
|
382
393
|
args.logClassifierFailure(error, args.input);
|
|
383
394
|
return {
|
|
384
395
|
shouldReply: false,
|
|
385
|
-
reason:
|
|
396
|
+
reason: SubscribedReplyReason.ClassifierError
|
|
386
397
|
};
|
|
387
398
|
}
|
|
388
399
|
}
|
|
389
|
-
|
|
390
|
-
//#region src/chat/services/pending-auth.ts
|
|
400
|
+
// src/chat/services/pending-auth.ts
|
|
391
401
|
const AUTH_LINK_REUSE_WINDOW_MS = 6e5;
|
|
392
402
|
/** Decide whether the same agent-run session can reuse its fresh auth link. */
|
|
393
403
|
function canReusePendingAuthLink(args) {
|
|
@@ -425,9 +435,8 @@ function wasPendingAuthStopped(conversation, pendingAuth) {
|
|
|
425
435
|
const message = conversation.messages[index];
|
|
426
436
|
if (message?.role !== "user") continue;
|
|
427
437
|
if (buildDeterministicTurnId(message.id) === pendingAuth.sessionId) return false;
|
|
428
|
-
if (message.meta?.skippedReason?.startsWith(
|
|
438
|
+
if (message.meta?.skippedReason?.startsWith(`${SubscribedReplyReason.ThreadOptOut}:`)) return true;
|
|
429
439
|
}
|
|
430
440
|
return false;
|
|
431
441
|
}
|
|
432
|
-
|
|
433
|
-
export { wasPendingAuthStopped as a, getThreadStopDecision as c, getConversationPendingAuth as i, buildDeterministicAssistantMessageId as l, canReusePendingAuthLink as n, decideSubscribedThreadReply as o, clearPendingAuth as r, getSubscribedReplyPreflightDecision as s, abandonReplacedPendingAuth as t, buildDeterministicTurnId as u };
|
|
442
|
+
export { wasPendingAuthStopped as a, getSubscribedReplyPreflightDecision as c, buildDeterministicTurnId as d, getConversationPendingAuth as i, getThreadStopDecision as l, canReusePendingAuthLink as n, SubscribedReplyReason as o, clearPendingAuth as r, decideSubscribedThreadReply as s, abandonReplacedPendingAuth as t, buildDeterministicAssistantMessageId as u };
|
|
@@ -2,7 +2,7 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { statSync } from "node:fs";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
|
-
|
|
5
|
+
// src/plugin-module.ts
|
|
6
6
|
const PLUGIN_MODULE_EXTENSIONS = [
|
|
7
7
|
"",
|
|
8
8
|
".ts",
|
|
@@ -77,5 +77,4 @@ async function loadAppPluginSet(cwd, importModule) {
|
|
|
77
77
|
}
|
|
78
78
|
return await loadPluginSetFromModule(pluginModule, importModule);
|
|
79
79
|
}
|
|
80
|
-
//#endregion
|
|
81
80
|
export { loadPluginSetFromModule as n, resolvePluginModule as r, loadAppPluginSet as t };
|