@sentry/junior 0.72.0 → 0.73.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/bin/junior.mjs +12 -10
- package/dist/app.d.ts +11 -2
- package/dist/app.js +936 -13042
- package/dist/chat/agent-dispatch/runner.d.ts +2 -0
- package/dist/chat/agent-dispatch/store.d.ts +2 -2
- package/dist/chat/agent-dispatch/types.d.ts +6 -3
- package/dist/chat/agent-dispatch/validation.d.ts +2 -3
- package/dist/chat/app/production.d.ts +8 -1
- package/dist/chat/app/services.d.ts +7 -0
- package/dist/chat/destination.d.ts +3 -1
- package/dist/chat/logging.d.ts +3 -0
- package/dist/chat/oauth-flow.d.ts +1 -1
- package/dist/chat/plugins/registry.d.ts +2 -0
- package/dist/chat/plugins/types.d.ts +2 -0
- package/dist/chat/prompt.d.ts +4 -1
- package/dist/chat/requester.d.ts +19 -12
- package/dist/chat/respond.d.ts +6 -2
- package/dist/chat/runtime/agent-continue-runner.d.ts +1 -1
- package/dist/chat/runtime/reply-executor.d.ts +3 -1
- package/dist/chat/runtime/slack-resume.d.ts +3 -3
- package/dist/chat/runtime/slack-runtime.d.ts +13 -3
- package/dist/chat/runtime/turn.d.ts +15 -1
- package/dist/chat/sandbox/egress-credentials.d.ts +5 -2
- package/dist/chat/sandbox/egress-policy.d.ts +5 -1
- package/dist/chat/sandbox/egress-proxy.d.ts +2 -0
- package/dist/chat/sandbox/egress-schemas.d.ts +4 -0
- package/dist/chat/sandbox/egress-session.d.ts +3 -1
- package/dist/chat/sandbox/egress-tracing.d.ts +7 -0
- package/dist/chat/sandbox/sandbox.d.ts +2 -0
- package/dist/chat/sandbox/session.d.ts +3 -2
- package/dist/chat/services/auth-pause-response.d.ts +1 -1
- package/dist/chat/services/auth-pause.d.ts +2 -1
- package/dist/chat/services/mcp-auth-orchestration.d.ts +1 -1
- package/dist/chat/services/message-actor-identity.d.ts +2 -2
- package/dist/chat/services/plugin-auth-orchestration.d.ts +9 -8
- package/dist/chat/services/turn-result.d.ts +3 -0
- package/dist/chat/slack/user.d.ts +2 -2
- package/dist/chat/task-execution/store.d.ts +1 -1
- package/dist/chat/tools/slack/canvas-tools.d.ts +3 -2
- package/dist/chat/tools/slack/channel-list-messages.d.ts +2 -2
- package/dist/chat/tools/slack/channel-post-message.d.ts +3 -2
- package/dist/chat/tools/slack/context.d.ts +15 -2
- package/dist/chat/tools/slack/message-add-reaction.d.ts +3 -2
- package/dist/chat/tools/slack/thread-read.d.ts +2 -2
- package/dist/chat/tools/types.d.ts +19 -19
- package/dist/{chunk-6GEYPE6T.js → chunk-3BYAPS6B.js} +30 -6
- package/dist/{chunk-GB3AL54K.js → chunk-7Q5YOUUT.js} +10 -2
- package/dist/{chunk-HNMUVGSR.js → chunk-AL5T52ZD.js} +6 -6
- package/dist/{chunk-PP7AGSBU.js → chunk-CYUI7JU5.js} +18 -8
- package/dist/{chunk-3FYPXHPL.js → chunk-DIMX5F3T.js} +1 -1
- package/dist/{chunk-4JXCSGSA.js → chunk-M4FLLXXD.js} +1 -1
- package/dist/chunk-OQSYYOLM.js +12787 -0
- package/dist/{chunk-55XEZFGD.js → chunk-OR6NQJ5E.js} +2 -2
- package/dist/{chunk-VLIO6RQR.js → chunk-RY6AL5C7.js} +4 -4
- package/dist/chunk-SJHUF3DP.js +43 -0
- package/dist/{chunk-ICKIDP7G.js → chunk-UOTZ3EEQ.js} +1 -1
- package/dist/{chunk-VSNA5KAB.js → chunk-UZVHXZ7V.js} +1276 -1481
- package/dist/{chunk-XC33FJZN.js → chunk-V4VYUY4A.js} +25 -4
- package/dist/{chunk-ZJQPA67D.js → chunk-WS2EG3GW.js} +224 -224
- package/dist/chunk-ZDA2HYX5.js +275 -0
- package/dist/cli/chat.js +205 -0
- package/dist/cli/check.js +9 -10
- package/dist/cli/run.js +10 -2
- package/dist/cli/snapshot-warmup.js +7 -7
- package/dist/cli/upgrade.js +8 -8
- package/dist/deployment.d.ts +4 -0
- package/dist/handlers/agent-dispatch.d.ts +6 -1
- package/dist/handlers/mcp-oauth-callback.d.ts +6 -1
- package/dist/handlers/oauth-callback.d.ts +6 -1
- package/dist/handlers/sandbox-egress-proxy.d.ts +2 -0
- package/dist/handlers/webhooks.d.ts +4 -2
- package/dist/instrumentation.js +17 -2
- package/dist/nitro.js +9 -10
- package/dist/reporting.js +19 -17
- package/dist/runner-LMAM4OGD.js +259 -0
- package/package.json +3 -3
- package/dist/chunk-6YY4Q3D4.js +0 -12
- package/dist/chunk-Z3YD6NHK.js +0 -12
package/dist/instrumentation.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
+
getDeploymentServiceVersion,
|
|
3
|
+
getDeploymentTelemetryAttributes,
|
|
2
4
|
sentry_exports
|
|
3
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SJHUF3DP.js";
|
|
4
6
|
import "./chunk-2KG3PWR4.js";
|
|
5
7
|
|
|
6
8
|
// src/instrumentation.ts
|
|
@@ -22,16 +24,29 @@ function initSentry() {
|
|
|
22
24
|
}
|
|
23
25
|
const dsn = process.env.SENTRY_DSN;
|
|
24
26
|
const enableLogs = getBoolean(process.env.SENTRY_ENABLE_LOGS, Boolean(dsn));
|
|
27
|
+
const serviceVersion = getDeploymentServiceVersion();
|
|
28
|
+
const deploymentSpanAttributes = getDeploymentTelemetryAttributes();
|
|
25
29
|
sentry_exports.init({
|
|
26
30
|
dsn,
|
|
27
31
|
environment: process.env.SENTRY_ENVIRONMENT ?? process.env.VERCEL_ENV ?? process.env.NODE_ENV,
|
|
28
|
-
release:
|
|
32
|
+
release: serviceVersion,
|
|
29
33
|
tracesSampleRate: getSampleRate(process.env.SENTRY_TRACES_SAMPLE_RATE, 1),
|
|
30
34
|
sendDefaultPii: true,
|
|
31
35
|
enabled: Boolean(dsn),
|
|
32
36
|
enableLogs,
|
|
33
37
|
registerEsmLoaderHooks: false,
|
|
34
38
|
streamGenAiSpans: true,
|
|
39
|
+
// Keep deployment identity centralized so every emitted Sentry span carries it.
|
|
40
|
+
beforeSendSpan(span) {
|
|
41
|
+
if (Object.keys(deploymentSpanAttributes).length === 0) {
|
|
42
|
+
return span;
|
|
43
|
+
}
|
|
44
|
+
span.data = {
|
|
45
|
+
...span.data,
|
|
46
|
+
...deploymentSpanAttributes
|
|
47
|
+
};
|
|
48
|
+
return span;
|
|
49
|
+
},
|
|
35
50
|
integrations: [
|
|
36
51
|
sentry_exports.vercelAIIntegration({
|
|
37
52
|
recordInputs: true,
|
package/dist/nitro.js
CHANGED
|
@@ -2,21 +2,20 @@ import {
|
|
|
2
2
|
pluginCatalogConfigFromPluginSet,
|
|
3
3
|
pluginHookRegistrationsFromPluginSet,
|
|
4
4
|
resolveConversationWorkQueueTopic
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import
|
|
7
|
-
JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
|
|
8
|
-
JUNIOR_HEARTBEAT_CRON_SCHEDULE,
|
|
9
|
-
JUNIOR_HEARTBEAT_ROUTE
|
|
10
|
-
} from "./chunk-6YY4Q3D4.js";
|
|
11
|
-
import "./chunk-XC33FJZN.js";
|
|
5
|
+
} from "./chunk-UOTZ3EEQ.js";
|
|
6
|
+
import "./chunk-V4VYUY4A.js";
|
|
12
7
|
import {
|
|
13
8
|
discoverInstalledPluginPackageContent,
|
|
14
9
|
isValidPackageName,
|
|
15
10
|
resolvePackageDir
|
|
16
11
|
} from "./chunk-KVZL5NZS.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import
|
|
12
|
+
import "./chunk-WS2EG3GW.js";
|
|
13
|
+
import "./chunk-3BYAPS6B.js";
|
|
14
|
+
import {
|
|
15
|
+
JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
|
|
16
|
+
JUNIOR_HEARTBEAT_CRON_SCHEDULE,
|
|
17
|
+
JUNIOR_HEARTBEAT_ROUTE
|
|
18
|
+
} from "./chunk-SJHUF3DP.js";
|
|
20
19
|
import "./chunk-2KG3PWR4.js";
|
|
21
20
|
|
|
22
21
|
// src/nitro.ts
|
package/dist/reporting.js
CHANGED
|
@@ -2,42 +2,44 @@ import {
|
|
|
2
2
|
GET,
|
|
3
3
|
buildSentryConversationUrl,
|
|
4
4
|
buildSentryTraceUrl,
|
|
5
|
-
buildSystemPrompt,
|
|
6
5
|
formatSlackConversationRedactedLabel,
|
|
7
|
-
getAgentPluginOperationalReports,
|
|
8
|
-
getAgentTurnSessionRecord,
|
|
9
6
|
getConversationDetails,
|
|
10
7
|
getConversationDetailsForIds,
|
|
11
|
-
listAgentTurnSessionSummariesForConversation,
|
|
12
8
|
resolveSlackConversationContextFromThreadId
|
|
13
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZDA2HYX5.js";
|
|
10
|
+
import {
|
|
11
|
+
buildSystemPrompt,
|
|
12
|
+
getAgentPluginOperationalReports,
|
|
13
|
+
getAgentTurnSessionRecord,
|
|
14
|
+
listAgentTurnSessionSummariesForConversation
|
|
15
|
+
} from "./chunk-UZVHXZ7V.js";
|
|
14
16
|
import {
|
|
15
17
|
discoverSkills
|
|
16
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-OR6NQJ5E.js";
|
|
17
19
|
import {
|
|
18
20
|
getConversation,
|
|
19
21
|
listConversationsByActivity
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
+
} from "./chunk-AL5T52ZD.js";
|
|
23
|
+
import "./chunk-V4VYUY4A.js";
|
|
22
24
|
import "./chunk-G3E7SCME.js";
|
|
23
25
|
import {
|
|
24
26
|
getPluginPackageContent,
|
|
25
27
|
getPluginProviders
|
|
26
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-7Q5YOUUT.js";
|
|
27
29
|
import {
|
|
28
30
|
homeDir
|
|
29
31
|
} from "./chunk-KVZL5NZS.js";
|
|
30
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-DIMX5F3T.js";
|
|
31
33
|
import {
|
|
32
34
|
canExposeConversationPayload,
|
|
33
35
|
parseSlackThreadId,
|
|
34
36
|
resolveConversationPrivacy
|
|
35
|
-
} from "./chunk-
|
|
36
|
-
import "./chunk-
|
|
37
|
+
} from "./chunk-WS2EG3GW.js";
|
|
38
|
+
import "./chunk-CYUI7JU5.js";
|
|
37
39
|
import {
|
|
38
40
|
isRecord
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import "./chunk-
|
|
41
|
+
} from "./chunk-3BYAPS6B.js";
|
|
42
|
+
import "./chunk-SJHUF3DP.js";
|
|
41
43
|
import "./chunk-2KG3PWR4.js";
|
|
42
44
|
|
|
43
45
|
// src/reporting.ts
|
|
@@ -655,10 +657,10 @@ function isConversationMessage(message) {
|
|
|
655
657
|
function countConversationMessages(transcript) {
|
|
656
658
|
return transcript.filter(isConversationMessage).length;
|
|
657
659
|
}
|
|
658
|
-
function systemPromptMessage() {
|
|
660
|
+
function systemPromptMessage(destination) {
|
|
659
661
|
return {
|
|
660
662
|
role: "system",
|
|
661
|
-
parts: [{ type: "text", text: buildSystemPrompt() }]
|
|
663
|
+
parts: [{ type: "text", text: buildSystemPrompt({ source: destination }) }]
|
|
662
664
|
};
|
|
663
665
|
}
|
|
664
666
|
function turnScopedMessages(messages, turnStartMessageIndex) {
|
|
@@ -816,7 +818,7 @@ async function readConversationReport(conversationId) {
|
|
|
816
818
|
);
|
|
817
819
|
const transcriptMessageCount = countConversationMessages(normalizedTranscript);
|
|
818
820
|
const transcript = canExposeTranscript ? [
|
|
819
|
-
...scopedMessages.startsAtRunBoundary && normalizedTranscript.length > 0 ? [systemPromptMessage()] : [],
|
|
821
|
+
...scopedMessages.startsAtRunBoundary && normalizedTranscript.length > 0 && sessionRecord?.destination ? [systemPromptMessage(sessionRecord.destination)] : [],
|
|
820
822
|
...normalizedTranscript
|
|
821
823
|
] : [];
|
|
822
824
|
const transcriptMetadata = canExposeTranscript ? void 0 : normalizedTranscript.map(redactTranscriptMessage);
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildConversationContext,
|
|
3
|
+
buildDeliveredTurnStatePatch,
|
|
4
|
+
coerceThreadArtifactsState,
|
|
5
|
+
generateAssistantReply,
|
|
6
|
+
getPersistedSandboxState,
|
|
7
|
+
getPersistedThreadState,
|
|
8
|
+
markConversationMessage,
|
|
9
|
+
markTurnFailed,
|
|
10
|
+
normalizeConversationText,
|
|
11
|
+
persistThreadStateById,
|
|
12
|
+
startActiveTurn,
|
|
13
|
+
updateConversationStats,
|
|
14
|
+
upsertConversationMessage
|
|
15
|
+
} from "./chunk-OQSYYOLM.js";
|
|
16
|
+
import {
|
|
17
|
+
commitMessages,
|
|
18
|
+
loadProjection
|
|
19
|
+
} from "./chunk-UZVHXZ7V.js";
|
|
20
|
+
import "./chunk-OR6NQJ5E.js";
|
|
21
|
+
import {
|
|
22
|
+
coerceThreadConversationState
|
|
23
|
+
} from "./chunk-M4FLLXXD.js";
|
|
24
|
+
import "./chunk-AL5T52ZD.js";
|
|
25
|
+
import "./chunk-V4VYUY4A.js";
|
|
26
|
+
import "./chunk-RY6AL5C7.js";
|
|
27
|
+
import "./chunk-G3E7SCME.js";
|
|
28
|
+
import "./chunk-7Q5YOUUT.js";
|
|
29
|
+
import "./chunk-KVZL5NZS.js";
|
|
30
|
+
import "./chunk-DIMX5F3T.js";
|
|
31
|
+
import {
|
|
32
|
+
stripRuntimeTurnContext,
|
|
33
|
+
trimTrailingAssistantMessages
|
|
34
|
+
} from "./chunk-WS2EG3GW.js";
|
|
35
|
+
import "./chunk-CYUI7JU5.js";
|
|
36
|
+
import "./chunk-3BYAPS6B.js";
|
|
37
|
+
import "./chunk-SJHUF3DP.js";
|
|
38
|
+
import "./chunk-2KG3PWR4.js";
|
|
39
|
+
|
|
40
|
+
// src/chat/local/runner.ts
|
|
41
|
+
import { THREAD_STATE_TTL_MS } from "chat";
|
|
42
|
+
import {
|
|
43
|
+
localDestinationSchema
|
|
44
|
+
} from "@sentry/junior-plugin-api";
|
|
45
|
+
var DELIVERED_STATE_PERSIST_ATTEMPTS = 3;
|
|
46
|
+
function localDestination(conversationId) {
|
|
47
|
+
const parsed = localDestinationSchema.safeParse({
|
|
48
|
+
platform: "local",
|
|
49
|
+
conversationId
|
|
50
|
+
});
|
|
51
|
+
if (!parsed.success) {
|
|
52
|
+
throw new Error("Invalid local conversation id");
|
|
53
|
+
}
|
|
54
|
+
return parsed.data;
|
|
55
|
+
}
|
|
56
|
+
function localTurnId(sequence) {
|
|
57
|
+
return `local-turn-${sequence}`;
|
|
58
|
+
}
|
|
59
|
+
function localReply(reply) {
|
|
60
|
+
return {
|
|
61
|
+
...reply.files ? { files: reply.files } : {},
|
|
62
|
+
text: reply.text
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function sleep(ms) {
|
|
66
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
67
|
+
}
|
|
68
|
+
function nextUserMessageSequence(conversation) {
|
|
69
|
+
return conversation.messages.filter((message) => message.role === "user").length + 1;
|
|
70
|
+
}
|
|
71
|
+
function preparedLocalPiMessages(messages) {
|
|
72
|
+
return stripRuntimeTurnContext(trimTrailingAssistantMessages(messages));
|
|
73
|
+
}
|
|
74
|
+
async function loadLocalPiMessages(args) {
|
|
75
|
+
const projection = await loadProjection({
|
|
76
|
+
conversationId: args.conversationId
|
|
77
|
+
});
|
|
78
|
+
if (args.fallback.length >= projection.length && args.fallback.length > 0) {
|
|
79
|
+
return preparedLocalPiMessages(args.fallback);
|
|
80
|
+
}
|
|
81
|
+
if (projection.length > 0) {
|
|
82
|
+
return preparedLocalPiMessages(projection);
|
|
83
|
+
}
|
|
84
|
+
return void 0;
|
|
85
|
+
}
|
|
86
|
+
async function persistDeliveredLocalTurnState(conversationId, patch) {
|
|
87
|
+
let lastError;
|
|
88
|
+
for (let attempt = 1; attempt <= DELIVERED_STATE_PERSIST_ATTEMPTS; attempt += 1) {
|
|
89
|
+
try {
|
|
90
|
+
await persistThreadStateById(conversationId, patch);
|
|
91
|
+
return;
|
|
92
|
+
} catch (error) {
|
|
93
|
+
lastError = error;
|
|
94
|
+
if (attempt < DELIVERED_STATE_PERSIST_ATTEMPTS) {
|
|
95
|
+
await sleep(attempt * 100);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
throw lastError;
|
|
100
|
+
}
|
|
101
|
+
async function runLocalAgentTurn(input, deps) {
|
|
102
|
+
const text = input.message.trim();
|
|
103
|
+
if (!text) {
|
|
104
|
+
throw new Error("Local agent message must not be empty");
|
|
105
|
+
}
|
|
106
|
+
if (!deps.deliverReply) {
|
|
107
|
+
throw new Error("Local reply delivery is required");
|
|
108
|
+
}
|
|
109
|
+
const destination = localDestination(input.conversationId);
|
|
110
|
+
const generateAssistantReply2 = deps.generateAssistantReply ?? generateAssistantReply;
|
|
111
|
+
const now = deps.now ?? (() => Date.now());
|
|
112
|
+
const persisted = await getPersistedThreadState(input.conversationId);
|
|
113
|
+
const conversation = coerceThreadConversationState(persisted);
|
|
114
|
+
let artifacts = coerceThreadArtifactsState(persisted);
|
|
115
|
+
let { sandboxId, sandboxDependencyProfileHash } = getPersistedSandboxState(persisted);
|
|
116
|
+
const initialArtifacts = artifacts;
|
|
117
|
+
const initialSandboxId = sandboxId;
|
|
118
|
+
const initialSandboxDependencyProfileHash = sandboxDependencyProfileHash;
|
|
119
|
+
const sequence = nextUserMessageSequence(conversation);
|
|
120
|
+
const turnId = localTurnId(sequence);
|
|
121
|
+
const userMessageId = `${turnId}:user`;
|
|
122
|
+
const startedAtMs = now();
|
|
123
|
+
upsertConversationMessage(conversation, {
|
|
124
|
+
id: userMessageId,
|
|
125
|
+
role: "user",
|
|
126
|
+
text: normalizeConversationText(text),
|
|
127
|
+
createdAtMs: startedAtMs,
|
|
128
|
+
author: {
|
|
129
|
+
fullName: "Local CLI",
|
|
130
|
+
userId: "local-cli",
|
|
131
|
+
userName: "local"
|
|
132
|
+
},
|
|
133
|
+
meta: {
|
|
134
|
+
explicitMention: true,
|
|
135
|
+
replied: false
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
startActiveTurn({
|
|
139
|
+
conversation,
|
|
140
|
+
nextTurnId: turnId,
|
|
141
|
+
updateConversationStats
|
|
142
|
+
});
|
|
143
|
+
await persistThreadStateById(input.conversationId, { conversation });
|
|
144
|
+
let reply;
|
|
145
|
+
let completedState;
|
|
146
|
+
let piMessagesBeforeRun;
|
|
147
|
+
try {
|
|
148
|
+
const piMessages = await loadLocalPiMessages({
|
|
149
|
+
conversationId: input.conversationId,
|
|
150
|
+
fallback: conversation.piMessages
|
|
151
|
+
});
|
|
152
|
+
piMessagesBeforeRun = piMessages;
|
|
153
|
+
reply = await generateAssistantReply2(text, {
|
|
154
|
+
authorizationFlowMode: "disabled",
|
|
155
|
+
conversationContext: buildConversationContext(conversation, {
|
|
156
|
+
excludeMessageId: userMessageId
|
|
157
|
+
}),
|
|
158
|
+
artifactState: artifacts,
|
|
159
|
+
credentialContext: {
|
|
160
|
+
actor: { type: "system", id: "local-cli" }
|
|
161
|
+
},
|
|
162
|
+
destination,
|
|
163
|
+
requester: {
|
|
164
|
+
fullName: "Local CLI",
|
|
165
|
+
platform: "local",
|
|
166
|
+
userId: "local-cli",
|
|
167
|
+
userName: "local"
|
|
168
|
+
},
|
|
169
|
+
piMessages,
|
|
170
|
+
surface: "internal",
|
|
171
|
+
correlation: {
|
|
172
|
+
conversationId: input.conversationId,
|
|
173
|
+
turnId,
|
|
174
|
+
runId: turnId
|
|
175
|
+
},
|
|
176
|
+
sandbox: {
|
|
177
|
+
sandboxId,
|
|
178
|
+
sandboxDependencyProfileHash
|
|
179
|
+
},
|
|
180
|
+
onArtifactStateUpdated: async (nextArtifacts) => {
|
|
181
|
+
artifacts = nextArtifacts;
|
|
182
|
+
await persistThreadStateById(input.conversationId, {
|
|
183
|
+
artifacts,
|
|
184
|
+
conversation,
|
|
185
|
+
sandboxId,
|
|
186
|
+
sandboxDependencyProfileHash
|
|
187
|
+
});
|
|
188
|
+
},
|
|
189
|
+
onSandboxAcquired: async (sandbox) => {
|
|
190
|
+
sandboxId = sandbox.sandboxId;
|
|
191
|
+
sandboxDependencyProfileHash = sandbox.sandboxDependencyProfileHash;
|
|
192
|
+
await persistThreadStateById(input.conversationId, {
|
|
193
|
+
artifacts,
|
|
194
|
+
conversation,
|
|
195
|
+
sandboxId,
|
|
196
|
+
sandboxDependencyProfileHash
|
|
197
|
+
});
|
|
198
|
+
},
|
|
199
|
+
onStatus: async (status) => {
|
|
200
|
+
await deps.onStatus?.(status.text);
|
|
201
|
+
},
|
|
202
|
+
onTextDelta: deps.onTextDelta
|
|
203
|
+
});
|
|
204
|
+
completedState = buildDeliveredTurnStatePatch({
|
|
205
|
+
artifacts,
|
|
206
|
+
conversation,
|
|
207
|
+
reply,
|
|
208
|
+
sessionId: turnId,
|
|
209
|
+
userMessageId
|
|
210
|
+
});
|
|
211
|
+
await deps.deliverReply(localReply(reply));
|
|
212
|
+
} catch (error) {
|
|
213
|
+
if (reply) {
|
|
214
|
+
await commitMessages({
|
|
215
|
+
conversationId: input.conversationId,
|
|
216
|
+
messages: piMessagesBeforeRun ?? [],
|
|
217
|
+
ttlMs: THREAD_STATE_TTL_MS
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
markTurnFailed({
|
|
221
|
+
conversation,
|
|
222
|
+
nowMs: now(),
|
|
223
|
+
sessionId: turnId,
|
|
224
|
+
userMessageId,
|
|
225
|
+
markConversationMessage,
|
|
226
|
+
updateConversationStats
|
|
227
|
+
});
|
|
228
|
+
await persistThreadStateById(input.conversationId, {
|
|
229
|
+
artifacts: initialArtifacts,
|
|
230
|
+
conversation,
|
|
231
|
+
sandboxId: initialSandboxId ?? "",
|
|
232
|
+
sandboxDependencyProfileHash: initialSandboxDependencyProfileHash ?? ""
|
|
233
|
+
});
|
|
234
|
+
throw error;
|
|
235
|
+
}
|
|
236
|
+
await persistDeliveredLocalTurnState(input.conversationId, {
|
|
237
|
+
artifacts: completedState.artifacts ?? artifacts,
|
|
238
|
+
conversation: reply.piMessages ? {
|
|
239
|
+
...completedState.conversation,
|
|
240
|
+
piMessages: reply.piMessages
|
|
241
|
+
} : completedState.conversation,
|
|
242
|
+
sandboxId: reply.sandboxId ?? sandboxId,
|
|
243
|
+
sandboxDependencyProfileHash: reply.sandboxDependencyProfileHash ?? sandboxDependencyProfileHash
|
|
244
|
+
});
|
|
245
|
+
if (reply.piMessages) {
|
|
246
|
+
await commitMessages({
|
|
247
|
+
conversationId: input.conversationId,
|
|
248
|
+
messages: reply.piMessages,
|
|
249
|
+
ttlMs: THREAD_STATE_TTL_MS
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
return {
|
|
253
|
+
conversationId: input.conversationId,
|
|
254
|
+
outcome: reply.diagnostics.outcome
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
export {
|
|
258
|
+
runLocalAgentTurn
|
|
259
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.73.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"node-html-markdown": "^2.0.0",
|
|
66
66
|
"yaml": "^2.9.0",
|
|
67
67
|
"zod": "^4.4.3",
|
|
68
|
-
"@sentry/junior-plugin-api": "0.
|
|
68
|
+
"@sentry/junior-plugin-api": "0.73.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@types/node": "^25.9.1",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"typescript": "^6.0.3",
|
|
79
79
|
"vercel": "^54.4.0",
|
|
80
80
|
"vitest": "^4.1.7",
|
|
81
|
-
"@sentry/junior-scheduler": "0.
|
|
81
|
+
"@sentry/junior-scheduler": "0.73.0"
|
|
82
82
|
},
|
|
83
83
|
"scripts": {
|
|
84
84
|
"build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",
|
package/dist/chunk-6YY4Q3D4.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// src/deployment.ts
|
|
2
|
-
var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
|
|
3
|
-
var JUNIOR_HEARTBEAT_CRON_SCHEDULE = "* * * * *";
|
|
4
|
-
var JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE = "/api/internal/agent/continue";
|
|
5
|
-
var LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION = "api/internal/agent/continue.ts";
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
JUNIOR_HEARTBEAT_ROUTE,
|
|
9
|
-
JUNIOR_HEARTBEAT_CRON_SCHEDULE,
|
|
10
|
-
JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
|
|
11
|
-
LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION
|
|
12
|
-
};
|
package/dist/chunk-Z3YD6NHK.js
DELETED