@sentry/junior 0.121.0 → 0.122.1
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/{agent-hooks-CQDGDBCP.js → agent-hooks-65WXVKKX.js} +8 -8
- package/dist/api.js +14 -14
- package/dist/app.js +604 -997
- package/dist/{catalog-runtime-AD3YNTTM.js → catalog-runtime-VNNMSKCB.js} +5 -5
- package/dist/chat/agent/index.d.ts +19 -2
- package/dist/chat/agent/request.d.ts +8 -8
- package/dist/chat/agent/resume.d.ts +1 -3
- package/dist/chat/agent/retry-usage.d.ts +8 -0
- package/dist/chat/agent/skills.d.ts +0 -9
- package/dist/chat/conversations/messages.d.ts +7 -0
- package/dist/chat/conversations/projection.d.ts +16 -0
- package/dist/chat/logging.d.ts +46 -13
- package/dist/chat/mcp/tool-manager.d.ts +11 -0
- package/dist/chat/plugins/agent-hooks.d.ts +8 -0
- package/dist/chat/runtime/processing-reaction.d.ts +2 -4
- package/dist/chat/runtime/slack-runtime.d.ts +2 -2
- package/dist/chat/services/assistant-reply.d.ts +16 -0
- package/dist/chat/services/empty-output-continuation.d.ts +20 -0
- package/dist/chat/services/turn-failure-response.d.ts +1 -3
- package/dist/chat/services/turn-result.d.ts +0 -5
- package/dist/chat/services/turn-session-record.d.ts +0 -11
- package/dist/chat/tool-support/zod-tool.d.ts +11 -6
- package/dist/chat/tools/execute-tool.d.ts +1 -33
- package/dist/chat/tools/execution/tool-error-handler.d.ts +2 -2
- package/dist/chat/tools/query-conversation-events.d.ts +3 -1
- package/dist/chat/tools/sandbox/bash.d.ts +1 -33
- package/dist/chat/tools/sandbox/edit-file.d.ts +1 -33
- package/dist/chat/tools/sandbox/find-files.d.ts +1 -33
- package/dist/chat/tools/sandbox/grep.d.ts +1 -33
- package/dist/chat/tools/sandbox/list-dir.d.ts +1 -33
- package/dist/chat/tools/sandbox/read-file.d.ts +1 -33
- package/dist/chat/tools/sandbox/write-file.d.ts +1 -33
- package/dist/{chunk-VWBKDPMQ.js → chunk-3KYLHUVC.js} +487 -686
- package/dist/{chunk-JZ47AFSH.js → chunk-4JPJTFUH.js} +37 -45
- package/dist/{chunk-ET2SDCNV.js → chunk-4ZV2GNHX.js} +16 -31
- package/dist/{chunk-WUP7NWMP.js → chunk-73TQBD5S.js} +1 -1
- package/dist/{chunk-Z2XXPUZG.js → chunk-BXT63TNS.js} +2061 -2015
- package/dist/{chunk-JYDIBXFY.js → chunk-GPQLJDT5.js} +13 -19
- package/dist/{chunk-LE77HHF3.js → chunk-HGREP4UX.js} +1 -1
- package/dist/{chunk-XDRGYDED.js → chunk-IEE5CSAP.js} +1 -1
- package/dist/{chunk-D2EMOH3N.js → chunk-LZ4XXS76.js} +3 -3
- package/dist/{chunk-254MFDOF.js → chunk-M7KAZXTE.js} +2 -2
- package/dist/{chunk-ITMEXX5H.js → chunk-MSDKKTRG.js} +4 -4
- package/dist/{chunk-UXQ5XSA2.js → chunk-PXPBBOIU.js} +2 -2
- package/dist/{chunk-IK4QSS5H.js → chunk-PYS4QZAF.js} +1 -1
- package/dist/{chunk-7HYV7KFM.js → chunk-QE33ATQW.js} +83 -92
- package/dist/{chunk-HDFGNU5E.js → chunk-S7G34U75.js} +3 -1
- package/dist/{chunk-IDXLBKPS.js → chunk-TI7SYDD4.js} +11 -22
- package/dist/{chunk-3DBMANUI.js → chunk-U5PRRZMZ.js} +22 -45
- package/dist/{chunk-KLUMVJRQ.js → chunk-VLRECFIC.js} +133 -206
- package/dist/{chunk-UURFXX66.js → chunk-WFJ2EG4E.js} +1 -1
- package/dist/{chunk-TRECK7RV.js → chunk-XBYNPBPQ.js} +14 -29
- package/dist/cli/chat.js +22 -22
- package/dist/cli/check.js +6 -6
- package/dist/cli/plugins.js +11 -11
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +6 -6
- package/dist/{db-7HQT2SXQ.js → db-36HXKAKH.js} +6 -6
- package/dist/instrumentation.js +3 -3
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-VHTUCNHK.js → oauth-callback-server-UKOO7KKP.js} +15 -15
- package/dist/{runner-3ONPZRED.js → runner-M66KMCQ7.js} +62 -51
- package/dist/{skills-WGAYGGPA.js → skills-TTXTVFOG.js} +6 -6
- package/dist/{validation-ZIWNBG4D.js → validation-TGASRGNN.js} +6 -6
- package/dist/version.js +1 -1
- package/package.json +8 -8
|
@@ -22,28 +22,28 @@ import {
|
|
|
22
22
|
persistThreadStateById,
|
|
23
23
|
stripRuntimeTurnContext,
|
|
24
24
|
updateConversationStats
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-BXT63TNS.js";
|
|
26
26
|
import {
|
|
27
27
|
createPluginEmbedder,
|
|
28
28
|
createPluginLogger,
|
|
29
29
|
createPluginModel,
|
|
30
30
|
createPluginState,
|
|
31
31
|
getPlugins
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-QE33ATQW.js";
|
|
33
33
|
import {
|
|
34
34
|
getDb
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-M7KAZXTE.js";
|
|
36
36
|
import {
|
|
37
37
|
getStateAdapter
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-WFJ2EG4E.js";
|
|
39
39
|
import {
|
|
40
40
|
ProviderError,
|
|
41
41
|
getProviderErrorAttributes,
|
|
42
42
|
getProviderErrorUserMessage
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-TI7SYDD4.js";
|
|
44
44
|
import {
|
|
45
45
|
buildTurnFailureResponse
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-4JPJTFUH.js";
|
|
47
47
|
import {
|
|
48
48
|
parseSlackMessageTs
|
|
49
49
|
} from "./chunk-F3B2YJ76.js";
|
|
@@ -413,7 +413,7 @@ function getExecutionFailureReason(reply) {
|
|
|
413
413
|
function getFailureCapture(reply) {
|
|
414
414
|
if (reply.diagnostics.outcome === "provider_error") {
|
|
415
415
|
return {
|
|
416
|
-
eventName: "
|
|
416
|
+
eventName: "agent.turn.provider_error",
|
|
417
417
|
error: reply.diagnostics.providerError ?? new Error(
|
|
418
418
|
reply.diagnostics.errorMessage ?? "Provider error without explicit message"
|
|
419
419
|
),
|
|
@@ -423,7 +423,7 @@ function getFailureCapture(reply) {
|
|
|
423
423
|
}
|
|
424
424
|
const failureReason = getExecutionFailureReason(reply);
|
|
425
425
|
return {
|
|
426
|
-
eventName: "
|
|
426
|
+
eventName: "agent.turn.execution.failed",
|
|
427
427
|
error: new Error(`Agent turn execution failure: ${failureReason}`),
|
|
428
428
|
attributes: {
|
|
429
429
|
"app.ai.execution_failure_reason": failureReason
|
|
@@ -454,17 +454,11 @@ function finalizeFailedTurnReplyWithEvent(args) {
|
|
|
454
454
|
}
|
|
455
455
|
const capture = getFailureCapture(args.reply);
|
|
456
456
|
const eventId = requireTurnFailureEventId(
|
|
457
|
-
args.logException(
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
...getAgentTurnDiagnosticsAttributes(args.reply),
|
|
463
|
-
...args.attributes,
|
|
464
|
-
...capture.attributes
|
|
465
|
-
},
|
|
466
|
-
capture.body
|
|
467
|
-
),
|
|
457
|
+
args.logException(capture.error, capture.eventName, {
|
|
458
|
+
...getAgentTurnDiagnosticsAttributes(args.reply),
|
|
459
|
+
...args.attributes,
|
|
460
|
+
...capture.attributes
|
|
461
|
+
}),
|
|
468
462
|
capture.eventName
|
|
469
463
|
);
|
|
470
464
|
const providerPartialText = args.reply.diagnostics.outcome === "provider_error" && args.reply.diagnostics.assistantMessageCount > 0 ? args.reply.text.trim() : "";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "@sentry/junior",
|
|
4
|
-
version: "0.
|
|
4
|
+
version: "0.122.1",
|
|
5
5
|
private: false,
|
|
6
6
|
publishConfig: {
|
|
7
7
|
access: "public"
|
|
@@ -70,8 +70,8 @@ var package_default = {
|
|
|
70
70
|
"@chat-adapter/slack": "4.29.0",
|
|
71
71
|
"@chat-adapter/state-memory": "4.29.0",
|
|
72
72
|
"@chat-adapter/state-redis": "4.29.0",
|
|
73
|
-
"@earendil-works/pi-agent-core": "
|
|
74
|
-
"@earendil-works/pi-ai": "
|
|
73
|
+
"@earendil-works/pi-agent-core": "catalog:",
|
|
74
|
+
"@earendil-works/pi-ai": "catalog:",
|
|
75
75
|
"@logtape/logtape": "^2.1.1",
|
|
76
76
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
77
77
|
"@neondatabase/serverless": "^1.1.0",
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
TURN_REASONING_LEVELS,
|
|
10
10
|
getChatConfig,
|
|
11
11
|
modelProfileSchema
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-TI7SYDD4.js";
|
|
13
13
|
import {
|
|
14
14
|
juniorDestinations
|
|
15
15
|
} from "./chunk-VFUK3X5B.js";
|
|
16
16
|
import {
|
|
17
17
|
normalizeIdentityEmail
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-4JPJTFUH.js";
|
|
19
19
|
import {
|
|
20
20
|
parseSlackChannelReferenceId,
|
|
21
21
|
parseSlackTeamId
|
|
@@ -2,18 +2,18 @@ import {
|
|
|
2
2
|
SANDBOX_WORKSPACE_ROOT,
|
|
3
3
|
getStateAdapter,
|
|
4
4
|
sleep
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-WFJ2EG4E.js";
|
|
6
6
|
import {
|
|
7
7
|
toOptionalTrimmed
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TI7SYDD4.js";
|
|
9
9
|
import {
|
|
10
10
|
pluginCatalogRuntime
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-73TQBD5S.js";
|
|
12
12
|
import {
|
|
13
13
|
setSpanAttributes,
|
|
14
14
|
setSpanStatus,
|
|
15
15
|
withSpan
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-4JPJTFUH.js";
|
|
17
17
|
|
|
18
18
|
// src/chat/sandbox/snapshot/profile.ts
|
|
19
19
|
import { createHash } from "crypto";
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-PE44LDDQ.js";
|
|
4
4
|
import {
|
|
5
5
|
normalizeSlackConversationId
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QE33ATQW.js";
|
|
7
7
|
import {
|
|
8
8
|
parseSlackThreadId
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-S7G34U75.js";
|
|
10
10
|
|
|
11
11
|
// src/handlers/health.ts
|
|
12
12
|
function readHealthReport() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDb
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-M7KAZXTE.js";
|
|
4
4
|
import {
|
|
5
5
|
juniorConversationAnnotations,
|
|
6
6
|
juniorIdentities,
|
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
SANDBOX_WORKSPACE_ROOT,
|
|
11
11
|
getStateAdapter,
|
|
12
12
|
sleep
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WFJ2EG4E.js";
|
|
14
14
|
import {
|
|
15
15
|
botConfig,
|
|
16
16
|
completeObject,
|
|
17
17
|
embedTexts,
|
|
18
18
|
getSlackBotToken,
|
|
19
19
|
standardModelId
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-TI7SYDD4.js";
|
|
21
21
|
import {
|
|
22
22
|
isActorUserId,
|
|
23
23
|
parseActorUserId
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
setSpanAttributes,
|
|
31
31
|
setSpanStatus,
|
|
32
32
|
withSpan
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-4JPJTFUH.js";
|
|
34
34
|
import {
|
|
35
35
|
parseSlackChannelReferenceId,
|
|
36
36
|
parseSlackMessageTs,
|
|
@@ -109,29 +109,24 @@ async function listConversationAnnotations(db, conversationId) {
|
|
|
109
109
|
function createPluginLogger(plugin) {
|
|
110
110
|
return {
|
|
111
111
|
info(message, metadata) {
|
|
112
|
-
logInfo(
|
|
113
|
-
"
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
);
|
|
112
|
+
logInfo("plugin.log.info", {
|
|
113
|
+
"app.log.message": message,
|
|
114
|
+
"app.plugin.name": plugin,
|
|
115
|
+
...metadata
|
|
116
|
+
});
|
|
118
117
|
},
|
|
119
118
|
warn(message, metadata) {
|
|
120
|
-
logWarn(
|
|
121
|
-
"
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
);
|
|
119
|
+
logWarn("plugin.log.warn", {
|
|
120
|
+
"app.log.message": message,
|
|
121
|
+
"app.plugin.name": plugin,
|
|
122
|
+
...metadata
|
|
123
|
+
});
|
|
126
124
|
},
|
|
127
125
|
error(message, metadata) {
|
|
128
|
-
logException(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
{ "app.plugin.name": plugin, ...metadata },
|
|
133
|
-
message
|
|
134
|
-
);
|
|
126
|
+
logException(new Error(message), "plugin.log.error", {
|
|
127
|
+
"app.plugin.name": plugin,
|
|
128
|
+
...metadata
|
|
129
|
+
});
|
|
135
130
|
}
|
|
136
131
|
};
|
|
137
132
|
}
|
|
@@ -698,27 +693,17 @@ async function withSlackRetries(task, maxAttempts = 3, context = {}) {
|
|
|
698
693
|
...context.attributes ?? {}
|
|
699
694
|
};
|
|
700
695
|
if (!isRetryable || attempt >= maxAttempts || remainingDelayBudgetMs <= 0) {
|
|
701
|
-
logWarn(
|
|
702
|
-
|
|
703
|
-
{}
|
|
704
|
-
|
|
705
|
-
...baseLogAttributes,
|
|
706
|
-
...mapped.errorData ? { "app.slack.error_data": mapped.errorData } : {}
|
|
707
|
-
},
|
|
708
|
-
"Slack action failed"
|
|
709
|
-
);
|
|
696
|
+
logWarn("slack.action.failed", {
|
|
697
|
+
...baseLogAttributes,
|
|
698
|
+
...mapped.errorData ? { "app.slack.error_data": mapped.errorData } : {}
|
|
699
|
+
});
|
|
710
700
|
throw mapped;
|
|
711
701
|
}
|
|
712
|
-
logWarn(
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
"app.slack.retry_attempt": attempt,
|
|
718
|
-
"app.slack.retry_class": retryClass
|
|
719
|
-
},
|
|
720
|
-
"Retrying Slack action after transient failure"
|
|
721
|
-
);
|
|
702
|
+
logWarn("slack.action.retrying", {
|
|
703
|
+
...baseLogAttributes,
|
|
704
|
+
"app.slack.retry_attempt": attempt,
|
|
705
|
+
"app.slack.retry_class": retryClass
|
|
706
|
+
});
|
|
722
707
|
const retryAfterMs = retryClass === "rate_limited" && mapped.retryAfterSeconds && mapped.retryAfterSeconds > 0 ? mapped.retryAfterSeconds * 1e3 : void 0;
|
|
723
708
|
const backoffMs = Math.min(2e3, 250 * 2 ** (attempt - 1));
|
|
724
709
|
const delayMs = Math.min(
|
|
@@ -1105,16 +1090,11 @@ function toUserPromptContributionContext(args) {
|
|
|
1105
1090
|
};
|
|
1106
1091
|
}
|
|
1107
1092
|
function logInvalidPromptContributions(args) {
|
|
1108
|
-
logWarn(
|
|
1109
|
-
"
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
"app.plugin.name": args.pluginName,
|
|
1114
|
-
"app.plugin.validation_reason": "invalid_shape"
|
|
1115
|
-
},
|
|
1116
|
-
"Plugin prompt contribution result invalid"
|
|
1117
|
-
);
|
|
1093
|
+
logWarn("plugin.prompt.contribution_result.invalid", {
|
|
1094
|
+
"app.plugin.hook": args.hookName,
|
|
1095
|
+
"app.plugin.name": args.pluginName,
|
|
1096
|
+
"app.plugin.validation_reason": "invalid_shape"
|
|
1097
|
+
});
|
|
1118
1098
|
}
|
|
1119
1099
|
function validatePlugins(plugins) {
|
|
1120
1100
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -1189,28 +1169,18 @@ async function getPluginSystemPromptContributions(source) {
|
|
|
1189
1169
|
0
|
|
1190
1170
|
);
|
|
1191
1171
|
if (totalChars + pluginContributionChars > PLUGIN_PROMPT_CONTRIBUTION_TOTAL_MAX_CHARS) {
|
|
1192
|
-
logWarn(
|
|
1193
|
-
"
|
|
1194
|
-
|
|
1195
|
-
{
|
|
1196
|
-
"app.plugin.name": pluginName
|
|
1197
|
-
},
|
|
1198
|
-
"Plugin system prompt contributions exceeded budget"
|
|
1199
|
-
);
|
|
1172
|
+
logWarn("plugin.system_prompt.contribution_budget_exceeded", {
|
|
1173
|
+
"app.plugin.name": pluginName
|
|
1174
|
+
});
|
|
1200
1175
|
continue;
|
|
1201
1176
|
}
|
|
1202
1177
|
totalChars += pluginContributionChars;
|
|
1203
1178
|
contributions.push(...acceptedContributions);
|
|
1204
1179
|
} catch (error) {
|
|
1205
|
-
logWarn(
|
|
1206
|
-
"
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
"app.plugin.name": pluginName,
|
|
1210
|
-
"exception.message": safeErrorMessage(error)
|
|
1211
|
-
},
|
|
1212
|
-
"Plugin system prompt hook failed"
|
|
1213
|
-
);
|
|
1180
|
+
logWarn("plugin.system_prompt.hook.failed", {
|
|
1181
|
+
"app.plugin.name": pluginName,
|
|
1182
|
+
"exception.message": safeErrorMessage(error)
|
|
1183
|
+
});
|
|
1214
1184
|
}
|
|
1215
1185
|
}
|
|
1216
1186
|
return contributions;
|
|
@@ -1264,29 +1234,19 @@ async function getPluginUserPromptContributions(args) {
|
|
|
1264
1234
|
0
|
|
1265
1235
|
);
|
|
1266
1236
|
if (totalChars + pluginContributionChars > PLUGIN_PROMPT_CONTRIBUTION_TOTAL_MAX_CHARS || totalContextBytes + pluginContextBytes > PLUGIN_PROMPT_CONTEXT_TOTAL_MAX_BYTES) {
|
|
1267
|
-
logWarn(
|
|
1268
|
-
"
|
|
1269
|
-
|
|
1270
|
-
{
|
|
1271
|
-
"app.plugin.name": pluginName
|
|
1272
|
-
},
|
|
1273
|
-
"Plugin user prompt contributions exceeded budget"
|
|
1274
|
-
);
|
|
1237
|
+
logWarn("plugin.user_prompt.contribution_budget_exceeded", {
|
|
1238
|
+
"app.plugin.name": pluginName
|
|
1239
|
+
});
|
|
1275
1240
|
continue;
|
|
1276
1241
|
}
|
|
1277
1242
|
totalChars += pluginContributionChars;
|
|
1278
1243
|
totalContextBytes += pluginContextBytes;
|
|
1279
1244
|
contributions.push(...validContributions);
|
|
1280
1245
|
} catch (error) {
|
|
1281
|
-
logWarn(
|
|
1282
|
-
"
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
"app.plugin.name": pluginName,
|
|
1286
|
-
"exception.message": safeErrorMessage(error)
|
|
1287
|
-
},
|
|
1288
|
-
"Plugin user prompt hook failed"
|
|
1289
|
-
);
|
|
1246
|
+
logWarn("plugin.user_prompt.hook.failed", {
|
|
1247
|
+
"app.plugin.name": pluginName,
|
|
1248
|
+
"exception.message": safeErrorMessage(error)
|
|
1249
|
+
});
|
|
1290
1250
|
}
|
|
1291
1251
|
}
|
|
1292
1252
|
return contributions;
|
|
@@ -1847,6 +1807,40 @@ function createSandboxCapability(workspace) {
|
|
|
1847
1807
|
function createPluginHookRunner(input = {}) {
|
|
1848
1808
|
const loaded = getPlugins();
|
|
1849
1809
|
return {
|
|
1810
|
+
async afterMcpTool(tool) {
|
|
1811
|
+
for (const plugin of loaded) {
|
|
1812
|
+
if (plugin.manifest.name !== tool.provider) {
|
|
1813
|
+
continue;
|
|
1814
|
+
}
|
|
1815
|
+
const hook = plugin.hooks?.afterMcpTool;
|
|
1816
|
+
if (!hook) {
|
|
1817
|
+
continue;
|
|
1818
|
+
}
|
|
1819
|
+
const annotations = tool.conversationId ? createPluginAnnotations({
|
|
1820
|
+
conversationId: tool.conversationId,
|
|
1821
|
+
db: getDb(),
|
|
1822
|
+
plugin: plugin.manifest.name
|
|
1823
|
+
}) : void 0;
|
|
1824
|
+
try {
|
|
1825
|
+
await hook({
|
|
1826
|
+
...basePluginContext(plugin),
|
|
1827
|
+
...tool.conversationId ? { conversationId: tool.conversationId } : {},
|
|
1828
|
+
...annotations ? { annotations } : {},
|
|
1829
|
+
result: tool.structuredContent !== void 0 ? { structuredContent: tool.structuredContent } : {},
|
|
1830
|
+
tool: {
|
|
1831
|
+
arguments: tool.arguments,
|
|
1832
|
+
name: tool.toolName
|
|
1833
|
+
}
|
|
1834
|
+
});
|
|
1835
|
+
} catch (error) {
|
|
1836
|
+
logWarn("agent.plugin.after_mcp_tool.failed", {
|
|
1837
|
+
"app.plugin.name": plugin.manifest.name,
|
|
1838
|
+
"gen_ai.tool.name": tool.toolName,
|
|
1839
|
+
"exception.message": error instanceof Error ? error.message : String(error)
|
|
1840
|
+
});
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
},
|
|
1850
1844
|
async prepareSandbox(sandbox) {
|
|
1851
1845
|
const sandboxCapability = createSandboxCapability(sandbox);
|
|
1852
1846
|
for (const plugin of loaded) {
|
|
@@ -1855,12 +1849,9 @@ function createPluginHookRunner(input = {}) {
|
|
|
1855
1849
|
if (!hook) {
|
|
1856
1850
|
continue;
|
|
1857
1851
|
}
|
|
1858
|
-
logInfo(
|
|
1859
|
-
"
|
|
1860
|
-
|
|
1861
|
-
{ "app.plugin.name": pluginName },
|
|
1862
|
-
"Running agent plugin sandbox prepare hook"
|
|
1863
|
-
);
|
|
1852
|
+
logInfo("agent.plugin.sandbox_preparation.started", {
|
|
1853
|
+
"app.plugin.name": pluginName
|
|
1854
|
+
});
|
|
1864
1855
|
await hook({
|
|
1865
1856
|
...basePluginContext(plugin),
|
|
1866
1857
|
actor: input.actor,
|
|
@@ -165,9 +165,11 @@ function toGenAiPayloadMetadata(payload) {
|
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
167
|
function toGenAiPayloadTraceAttributes(prefix, payload) {
|
|
168
|
+
const size = serializedLength(payload);
|
|
168
169
|
const attributes = {
|
|
169
170
|
[`${prefix}.type`]: payloadType(payload),
|
|
170
|
-
[`${prefix}.size_chars`]:
|
|
171
|
+
[`${prefix}.size_chars`]: size,
|
|
172
|
+
[`${prefix}.size`]: size
|
|
171
173
|
};
|
|
172
174
|
const keys = payloadKeys(payload);
|
|
173
175
|
if (keys) {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
toCanonicalInputMessage,
|
|
5
5
|
toCanonicalOutputMessage,
|
|
6
6
|
toGenAiMessagesTraceAttributes
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-S7G34U75.js";
|
|
8
8
|
import {
|
|
9
9
|
extractGenAiUsageAttributes,
|
|
10
10
|
logException,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
normalizeGenAiFinishReason,
|
|
13
13
|
serializeGenAiAttribute,
|
|
14
14
|
withSpan
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-4JPJTFUH.js";
|
|
16
16
|
|
|
17
17
|
// src/chat/config.ts
|
|
18
18
|
import { getModel as getModel2 } from "@earendil-works/pi-ai/compat";
|
|
@@ -407,15 +407,10 @@ async function completeText(params) {
|
|
|
407
407
|
setSpanAttributes(endAttributes);
|
|
408
408
|
if (message.stopReason === "error") {
|
|
409
409
|
const providerMessage2 = message.errorMessage?.trim() || "Unknown provider error";
|
|
410
|
-
logWarn(
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
...baseAttributes,
|
|
415
|
-
"exception.message": providerMessage2
|
|
416
|
-
},
|
|
417
|
-
"AI completion returned provider error"
|
|
418
|
-
);
|
|
410
|
+
logWarn("ai.completion.provider_error", {
|
|
411
|
+
...baseAttributes,
|
|
412
|
+
"exception.message": providerMessage2
|
|
413
|
+
});
|
|
419
414
|
throw createProviderError(providerMessage2, { modelId: params.modelId });
|
|
420
415
|
}
|
|
421
416
|
return {
|
|
@@ -541,17 +536,11 @@ async function embedTexts(params) {
|
|
|
541
536
|
if (isProviderRetryError(providerError)) {
|
|
542
537
|
throw providerError;
|
|
543
538
|
}
|
|
544
|
-
logException(
|
|
545
|
-
|
|
546
|
-
"
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
"gen_ai.provider.name": GEN_AI_PROVIDER_NAME,
|
|
550
|
-
"gen_ai.operation.name": GEN_AI_OPERATION_EMBEDDINGS,
|
|
551
|
-
"gen_ai.request.model": params.modelId
|
|
552
|
-
},
|
|
553
|
-
"AI embeddings failed"
|
|
554
|
-
);
|
|
539
|
+
logException(providerError, "ai.embeddings.failed", {
|
|
540
|
+
"gen_ai.provider.name": GEN_AI_PROVIDER_NAME,
|
|
541
|
+
"gen_ai.operation.name": GEN_AI_OPERATION_EMBEDDINGS,
|
|
542
|
+
"gen_ai.request.model": params.modelId
|
|
543
|
+
});
|
|
555
544
|
throw providerError;
|
|
556
545
|
}
|
|
557
546
|
}
|
|
@@ -6,29 +6,29 @@ import {
|
|
|
6
6
|
isDmChannel,
|
|
7
7
|
normalizeSlackConversationId,
|
|
8
8
|
withSlackRetries
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QE33ATQW.js";
|
|
10
10
|
import {
|
|
11
11
|
getDb,
|
|
12
12
|
parseDestination
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-M7KAZXTE.js";
|
|
14
14
|
import {
|
|
15
15
|
acquireActiveLock,
|
|
16
16
|
getStateAdapter,
|
|
17
17
|
sleep
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-WFJ2EG4E.js";
|
|
19
19
|
import {
|
|
20
20
|
normalizeSlackEmojiName
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-TI7SYDD4.js";
|
|
22
22
|
import {
|
|
23
23
|
pluginCatalogRuntime
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-73TQBD5S.js";
|
|
25
25
|
import {
|
|
26
26
|
fetchWithBoundedOAuthErrorBodies
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-4ZV2GNHX.js";
|
|
28
28
|
import {
|
|
29
29
|
logInfo,
|
|
30
30
|
logWarn
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-4JPJTFUH.js";
|
|
32
32
|
import {
|
|
33
33
|
isRecord
|
|
34
34
|
} from "./chunk-OB42YVAE.js";
|
|
@@ -739,12 +739,9 @@ async function deliverPrivateMessage(input) {
|
|
|
739
739
|
try {
|
|
740
740
|
client = getSlackClient();
|
|
741
741
|
} catch {
|
|
742
|
-
logWarn(
|
|
743
|
-
"
|
|
744
|
-
|
|
745
|
-
{ "app.reason": "missing_bot_token" },
|
|
746
|
-
"Skipped private message delivery \u2014 no SLACK_BOT_TOKEN"
|
|
747
|
-
);
|
|
742
|
+
logWarn("oauth.private_delivery.skipped", {
|
|
743
|
+
"app.reason": "missing_bot_token"
|
|
744
|
+
});
|
|
748
745
|
return false;
|
|
749
746
|
}
|
|
750
747
|
if (input.channelId) {
|
|
@@ -765,15 +762,10 @@ async function deliverPrivateMessage(input) {
|
|
|
765
762
|
}
|
|
766
763
|
return "in_context";
|
|
767
764
|
} catch (error) {
|
|
768
|
-
logWarn(
|
|
769
|
-
"
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
"app.slack.error": error instanceof Error ? error.message : String(error),
|
|
773
|
-
"app.slack.channel": input.channelId
|
|
774
|
-
},
|
|
775
|
-
"Private message delivery failed, falling back to DM"
|
|
776
|
-
);
|
|
765
|
+
logWarn("oauth.private_delivery.failed", {
|
|
766
|
+
"app.slack.error": error instanceof Error ? error.message : String(error),
|
|
767
|
+
"app.slack.channel": input.channelId
|
|
768
|
+
});
|
|
777
769
|
}
|
|
778
770
|
}
|
|
779
771
|
try {
|
|
@@ -786,25 +778,15 @@ async function deliverPrivateMessage(input) {
|
|
|
786
778
|
}
|
|
787
779
|
)).channel?.id;
|
|
788
780
|
if (!dmChannelId) {
|
|
789
|
-
logWarn(
|
|
790
|
-
"oauth_dm_fallback_failed",
|
|
791
|
-
{},
|
|
792
|
-
{ "app.reason": "no_dm_channel_id" },
|
|
793
|
-
"conversations.open returned no channel ID"
|
|
794
|
-
);
|
|
781
|
+
logWarn("oauth.dm.fallback.failed", { "app.reason": "no_dm_channel_id" });
|
|
795
782
|
return false;
|
|
796
783
|
}
|
|
797
784
|
await postSlackMessage({ channelId: dmChannelId, text: input.text });
|
|
798
785
|
return "fallback_dm";
|
|
799
786
|
} catch (error) {
|
|
800
|
-
logWarn(
|
|
801
|
-
"
|
|
802
|
-
|
|
803
|
-
{
|
|
804
|
-
"app.slack.error": error instanceof Error ? error.message : String(error)
|
|
805
|
-
},
|
|
806
|
-
"DM fallback delivery failed"
|
|
807
|
-
);
|
|
787
|
+
logWarn("oauth.dm.fallback.failed", {
|
|
788
|
+
"app.slack.error": error instanceof Error ? error.message : String(error)
|
|
789
|
+
});
|
|
808
790
|
return false;
|
|
809
791
|
}
|
|
810
792
|
}
|
|
@@ -873,15 +855,10 @@ async function startOAuthFlow(provider, input) {
|
|
|
873
855
|
)) {
|
|
874
856
|
authorizeParams.set(key, value);
|
|
875
857
|
}
|
|
876
|
-
logInfo(
|
|
877
|
-
"
|
|
878
|
-
{}
|
|
879
|
-
|
|
880
|
-
"app.credential.provider": provider,
|
|
881
|
-
...input.activeSkillName ? { "app.skill.name": input.activeSkillName } : {}
|
|
882
|
-
},
|
|
883
|
-
"Initiated OAuth authorization code flow"
|
|
884
|
-
);
|
|
858
|
+
logInfo("jr_rpc.oauth.started", {
|
|
859
|
+
"app.credential.provider": provider,
|
|
860
|
+
...input.activeSkillName ? { "app.skill.name": input.activeSkillName } : {}
|
|
861
|
+
});
|
|
885
862
|
const authorizationUrl = `${providerConfig.authorizeEndpoint}?${authorizeParams.toString()}`;
|
|
886
863
|
const authorizationRequest = {
|
|
887
864
|
authorizationUrl,
|