@sentry/junior 0.94.0 → 0.95.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/{agent-hooks-ZG7IDOIN.js → agent-hooks-FTQ5EGPO.js} +9 -10
- package/dist/api/people/list.js +7 -7
- package/dist/api/people/profile.js +7 -7
- package/dist/api/people/shared.d.ts +2 -2
- package/dist/api-reference.d.ts +1 -1
- package/dist/app.js +427 -196
- package/dist/{catalog-runtime-NZHMSMYC.js → catalog-runtime-2D7IVKUT.js} +3 -3
- package/dist/chat/advisor-request.d.ts +4 -0
- package/dist/chat/agent/request.d.ts +2 -0
- package/dist/chat/agent/resume.d.ts +2 -0
- package/dist/chat/conversations/history.d.ts +128 -0
- package/dist/chat/conversations/legacy-import.d.ts +38 -0
- package/dist/chat/conversations/messages.d.ts +39 -0
- package/dist/chat/conversations/projection.d.ts +94 -0
- package/dist/chat/conversations/retention.d.ts +36 -0
- package/dist/chat/conversations/sql/conversation-row.d.ts +14 -0
- package/dist/chat/conversations/sql/history.d.ts +4 -0
- package/dist/chat/conversations/sql/legacy-history-import.d.ts +55 -0
- package/dist/chat/conversations/sql/messages.d.ts +4 -0
- package/dist/chat/conversations/sql/migrations.d.ts +14 -3
- package/dist/chat/conversations/sql/purge.d.ts +53 -0
- package/dist/chat/conversations/sql/store.d.ts +7 -2
- package/dist/chat/conversations/store.d.ts +19 -0
- package/dist/chat/conversations/visible-compactions.d.ts +11 -0
- package/dist/chat/conversations/visible-messages.d.ts +47 -0
- package/dist/chat/db.d.ts +12 -1
- package/dist/chat/identities/sql.d.ts +1 -1
- package/dist/chat/logging.d.ts +2 -1
- package/dist/chat/resource-events/store.d.ts +2 -1
- package/dist/chat/runtime/reply-executor.d.ts +8 -0
- package/dist/chat/runtime/thread-state.d.ts +2 -0
- package/dist/chat/sandbox/resources.d.ts +4 -0
- package/dist/chat/services/mcp-auth-orchestration.d.ts +8 -0
- package/dist/chat/services/plugin-auth-orchestration.d.ts +12 -0
- package/dist/chat/services/turn-session-record.d.ts +14 -2
- package/dist/chat/sleep.d.ts +2 -0
- package/dist/chat/state/conversation.d.ts +7 -4
- package/dist/chat/state/session-log.d.ts +23 -1
- package/dist/chat/state/turn-session.d.ts +6 -0
- package/dist/chat/tool-support/private-trace-result.d.ts +4 -0
- package/dist/chat/tool-support/zod-tool.d.ts +1 -0
- package/dist/chat/tools/advisor/tool.d.ts +9 -4
- package/dist/chat/tools/definition.d.ts +2 -0
- package/dist/chat/tools/execution/tool-error-handler.d.ts +2 -2
- package/dist/chat/tools/system-time.d.ts +8 -0
- package/dist/chat/xml.d.ts +2 -0
- package/dist/{chunk-NYWPISSO.js → chunk-2XXEKR44.js} +1 -1
- package/dist/{chunk-QGEWC27H.js → chunk-5XMNOD3S.js} +5 -7
- package/dist/{chunk-NFXSLTYG.js → chunk-6ONME5IG.js} +864 -62
- package/dist/{chunk-LFLTJQVR.js → chunk-7FBGKXPE.js} +4 -0
- package/dist/{chunk-MC4ZZE4Q.js → chunk-AYP4ERVZ.js} +1 -1
- package/dist/{chunk-GHGPTPBL.js → chunk-B7PUBQQM.js} +1 -1
- package/dist/chunk-CM5EZD5F.js +17 -0
- package/dist/chunk-CRRBJ3JP.js +1037 -0
- package/dist/{chunk-G3E7SCME.js → chunk-CZEX6KIQ.js} +23 -0
- package/dist/{chunk-TNUUATT7.js → chunk-E3E2XNCN.js} +2 -2
- package/dist/{chunk-LNCREA5Z.js → chunk-EKNJM5IG.js} +3 -127
- package/dist/{chunk-NAPITCZ6.js → chunk-GUE7HTNR.js} +251 -6
- package/dist/{chunk-BTH37NCU.js → chunk-GVOUCI2O.js} +1 -1
- package/dist/{chunk-YYBX2BD5.js → chunk-GY34VGP5.js} +1 -1
- package/dist/{chunk-KRMANDHI.js → chunk-HCXXB35T.js} +1481 -349
- package/dist/{chunk-YTNPU7I2.js → chunk-HDTO3A74.js} +2 -2
- package/dist/{chunk-YJ4OPVNA.js → chunk-HZNJLKKI.js} +1 -1
- package/dist/{chunk-HDNWZMUN.js → chunk-KDPCGVIT.js} +116 -51
- package/dist/chunk-N4RNJ32C.js +48 -0
- package/dist/{chunk-UUB3D2XI.js → chunk-NSCHU54X.js} +8 -10
- package/dist/{chunk-PFXC67GJ.js → chunk-RAIB6WSG.js} +6 -80
- package/dist/chunk-WAGQ377B.js +724 -0
- package/dist/{chunk-6H4PP63X.js → chunk-WCMQJE4F.js} +24 -14
- package/dist/{chunk-S6QKIGRM.js → chunk-WPOJ443W.js} +15 -25
- package/dist/{chunk-MAVOJ54A.js → chunk-XX4N4E6C.js} +25 -388
- package/dist/cli/chat.js +24 -23
- package/dist/cli/check.js +4 -4
- package/dist/cli/plugins.js +11 -12
- package/dist/cli/snapshot-warmup.js +7 -8
- package/dist/cli/upgrade.js +78 -17
- package/dist/db/schema/agent-steps.d.ts +134 -0
- package/dist/db/schema/conversation-messages.d.ts +153 -0
- package/dist/{chat/conversations/sql → db}/schema/conversations.d.ts +34 -0
- package/dist/{chat/conversations/sql → db}/schema.d.ts +319 -8
- package/dist/db-W55B74OP.js +24 -0
- package/dist/deployment.d.ts +2 -0
- package/dist/handlers/retention.d.ts +6 -0
- package/dist/instrumentation.js +16 -3
- package/dist/legacy-import-ZPLGLAFD.js +17 -0
- package/dist/nitro.js +14 -4
- package/dist/reporting/conversations/activity.d.ts +40 -0
- package/dist/reporting/conversations/context.d.ts +8 -0
- package/dist/reporting/conversations/details.d.ts +6 -0
- package/dist/reporting/conversations/index.d.ts +4 -0
- package/dist/reporting/conversations/shared.d.ts +9 -0
- package/dist/reporting/conversations/statistics.d.ts +4 -0
- package/dist/reporting/conversations/summaries.d.ts +17 -0
- package/dist/reporting/conversations/transcript.d.ts +28 -0
- package/dist/reporting/conversations/types.d.ts +178 -0
- package/dist/reporting/conversations.d.ts +1 -178
- package/dist/reporting.d.ts +4 -3
- package/dist/reporting.js +603 -827
- package/dist/{runner-XAZPJNAQ.js → runner-OOSBDYRK.js} +35 -41
- package/dist/{validation-KYAWETI4.js → validation-QCGRFRFZ.js} +4 -4
- package/migrations/README.md +32 -0
- package/migrations/meta/0000_snapshot.json +978 -0
- package/migrations/meta/_journal.json +13 -0
- package/package.json +10 -7
- package/dist/chat/sql/schema.d.ts +0 -1049
- package/dist/chat/state/conversation-details.d.ts +0 -47
- package/dist/chunk-7STN2ZSK.js +0 -250
- package/dist/chunk-LE5ANBUZ.js +0 -1040
- package/dist/chunk-QL66APYJ.js +0 -1377
- package/dist/db-YDN6AFJH.js +0 -18
- /package/dist/{chat/sql → db}/db.d.ts +0 -0
- /package/dist/{chat/sql → db}/executor.d.ts +0 -0
- /package/dist/{chat/sql → db}/neon.d.ts +0 -0
- /package/dist/{chat/sql → db}/postgres.d.ts +0 -0
- /package/dist/{chat/conversations/sql → db}/schema/destinations.d.ts +0 -0
- /package/dist/{chat/conversations/sql → db}/schema/identities.d.ts +0 -0
- /package/dist/{chat/conversations/sql → db}/schema/migrations.d.ts +0 -0
- /package/dist/{chat/conversations/sql → db}/schema/timestamps.d.ts +0 -0
- /package/dist/{chat/conversations/sql → db}/schema/users.d.ts +0 -0
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
buildConversationContext,
|
|
3
2
|
buildDeliveredTurnStatePatch,
|
|
4
3
|
finalizeFailedTurnReply,
|
|
5
|
-
markConversationMessage,
|
|
6
|
-
normalizeConversationText,
|
|
7
4
|
processPluginTask,
|
|
8
|
-
scheduleSessionCompletedPluginTasks
|
|
9
|
-
|
|
10
|
-
upsertConversationMessage
|
|
11
|
-
} from "./chunk-MAVOJ54A.js";
|
|
5
|
+
scheduleSessionCompletedPluginTasks
|
|
6
|
+
} from "./chunk-XX4N4E6C.js";
|
|
12
7
|
import "./chunk-KNFROR7R.js";
|
|
13
8
|
import {
|
|
14
9
|
coerceThreadArtifactsState,
|
|
@@ -18,31 +13,40 @@ import {
|
|
|
18
13
|
markTurnFailed,
|
|
19
14
|
persistThreadStateById,
|
|
20
15
|
startActiveTurn
|
|
21
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-KDPCGVIT.js";
|
|
22
17
|
import {
|
|
23
18
|
coerceThreadConversationState
|
|
24
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-RAIB6WSG.js";
|
|
25
20
|
import {
|
|
26
21
|
commitMessages,
|
|
27
22
|
loadProjection
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
} from "./chunk-WAGQ377B.js";
|
|
24
|
+
import {
|
|
25
|
+
buildConversationContext,
|
|
26
|
+
hydrateConversationMessages,
|
|
27
|
+
markConversationMessage,
|
|
28
|
+
normalizeConversationText,
|
|
29
|
+
updateConversationStats,
|
|
30
|
+
upsertConversationMessage
|
|
31
|
+
} from "./chunk-CRRBJ3JP.js";
|
|
32
|
+
import "./chunk-NSCHU54X.js";
|
|
33
|
+
import "./chunk-E3E2XNCN.js";
|
|
34
|
+
import {
|
|
35
|
+
sleep
|
|
36
|
+
} from "./chunk-CZEX6KIQ.js";
|
|
37
|
+
import "./chunk-6ONME5IG.js";
|
|
34
38
|
import {
|
|
35
39
|
stripRuntimeTurnContext,
|
|
36
40
|
trimTrailingAssistantMessages
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
41
|
+
} from "./chunk-GUE7HTNR.js";
|
|
42
|
+
import "./chunk-GY34VGP5.js";
|
|
43
|
+
import "./chunk-B7PUBQQM.js";
|
|
40
44
|
import {
|
|
41
45
|
logException
|
|
42
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-WPOJ443W.js";
|
|
43
47
|
import "./chunk-OB42YVAE.js";
|
|
44
48
|
import "./chunk-3DA7X2U3.js";
|
|
45
|
-
import "./chunk-
|
|
49
|
+
import "./chunk-7FBGKXPE.js";
|
|
46
50
|
import "./chunk-MLKGABMK.js";
|
|
47
51
|
|
|
48
52
|
// src/chat/local/runner.ts
|
|
@@ -50,7 +54,6 @@ import {
|
|
|
50
54
|
createLocalSource,
|
|
51
55
|
localDestinationSchema
|
|
52
56
|
} from "@sentry/junior-plugin-api";
|
|
53
|
-
import { THREAD_STATE_TTL_MS } from "chat";
|
|
54
57
|
var DELIVERED_STATE_PERSIST_ATTEMPTS = 3;
|
|
55
58
|
function localDestination(conversationId) {
|
|
56
59
|
const parsed = localDestinationSchema.safeParse({
|
|
@@ -70,26 +73,17 @@ function localReply(reply) {
|
|
|
70
73
|
text: reply.text
|
|
71
74
|
};
|
|
72
75
|
}
|
|
73
|
-
function sleep(ms) {
|
|
74
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
75
|
-
}
|
|
76
76
|
function nextUserMessageSequence(conversation) {
|
|
77
77
|
return conversation.messages.filter((message) => message.role === "user").length + 1;
|
|
78
78
|
}
|
|
79
|
-
function preparedLocalPiMessages(messages) {
|
|
80
|
-
return stripRuntimeTurnContext(trimTrailingAssistantMessages(messages));
|
|
81
|
-
}
|
|
82
79
|
async function loadLocalPiMessages(args) {
|
|
83
80
|
const projection = await loadProjection({
|
|
84
81
|
conversationId: args.conversationId
|
|
85
82
|
});
|
|
86
|
-
if (
|
|
87
|
-
return
|
|
83
|
+
if (projection.length === 0) {
|
|
84
|
+
return void 0;
|
|
88
85
|
}
|
|
89
|
-
|
|
90
|
-
return preparedLocalPiMessages(projection);
|
|
91
|
-
}
|
|
92
|
-
return void 0;
|
|
86
|
+
return stripRuntimeTurnContext(trimTrailingAssistantMessages(projection));
|
|
93
87
|
}
|
|
94
88
|
async function persistDeliveredLocalTurnState(conversationId, patch) {
|
|
95
89
|
let lastError;
|
|
@@ -119,6 +113,10 @@ async function runLocalAgentTurn(input, deps) {
|
|
|
119
113
|
const now = deps.now ?? (() => Date.now());
|
|
120
114
|
const persisted = await getPersistedThreadState(input.conversationId);
|
|
121
115
|
const conversation = coerceThreadConversationState(persisted);
|
|
116
|
+
await hydrateConversationMessages({
|
|
117
|
+
conversation,
|
|
118
|
+
conversationId: input.conversationId
|
|
119
|
+
});
|
|
122
120
|
let artifacts = coerceThreadArtifactsState(persisted);
|
|
123
121
|
let { sandboxId, sandboxDependencyProfileHash } = getPersistedSandboxState(persisted);
|
|
124
122
|
const initialArtifacts = artifacts;
|
|
@@ -160,8 +158,7 @@ async function runLocalAgentTurn(input, deps) {
|
|
|
160
158
|
};
|
|
161
159
|
try {
|
|
162
160
|
const piMessages = await loadLocalPiMessages({
|
|
163
|
-
conversationId: input.conversationId
|
|
164
|
-
fallback: conversation.piMessages
|
|
161
|
+
conversationId: input.conversationId
|
|
165
162
|
});
|
|
166
163
|
piMessagesBeforeRun = piMessages;
|
|
167
164
|
const outcome = await deps.agentRunner.run({
|
|
@@ -251,8 +248,7 @@ async function runLocalAgentTurn(input, deps) {
|
|
|
251
248
|
if (reply) {
|
|
252
249
|
await commitMessages({
|
|
253
250
|
conversationId: input.conversationId,
|
|
254
|
-
messages: piMessagesBeforeRun ?? []
|
|
255
|
-
ttlMs: THREAD_STATE_TTL_MS
|
|
251
|
+
messages: piMessagesBeforeRun ?? []
|
|
256
252
|
});
|
|
257
253
|
}
|
|
258
254
|
markTurnFailed({
|
|
@@ -273,10 +269,7 @@ async function runLocalAgentTurn(input, deps) {
|
|
|
273
269
|
}
|
|
274
270
|
await persistDeliveredLocalTurnState(input.conversationId, {
|
|
275
271
|
artifacts: completedState.artifacts ?? artifacts,
|
|
276
|
-
conversation:
|
|
277
|
-
...completedState.conversation,
|
|
278
|
-
piMessages: reply.piMessages
|
|
279
|
-
} : completedState.conversation,
|
|
272
|
+
conversation: completedState.conversation,
|
|
280
273
|
sandboxId: reply.sandboxId ?? sandboxId,
|
|
281
274
|
sandboxDependencyProfileHash: reply.sandboxDependencyProfileHash ?? sandboxDependencyProfileHash
|
|
282
275
|
});
|
|
@@ -288,6 +281,7 @@ async function runLocalAgentTurn(input, deps) {
|
|
|
288
281
|
messages: reply.piMessages,
|
|
289
282
|
durationMs: reply.diagnostics.durationMs,
|
|
290
283
|
usage: reply.diagnostics.usage,
|
|
284
|
+
reasoningLevel: reply.diagnostics.thinkingLevel,
|
|
291
285
|
destination,
|
|
292
286
|
source,
|
|
293
287
|
actor: localActor,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
validatePluginEgressCredentialHooks,
|
|
3
3
|
validatePluginRegistrations
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-AYP4ERVZ.js";
|
|
5
|
+
import "./chunk-GVOUCI2O.js";
|
|
6
|
+
import "./chunk-WPOJ443W.js";
|
|
7
7
|
import "./chunk-OB42YVAE.js";
|
|
8
8
|
import "./chunk-3DA7X2U3.js";
|
|
9
9
|
import "./chunk-6APU57E6.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-7FBGKXPE.js";
|
|
11
11
|
import "./chunk-MLKGABMK.js";
|
|
12
12
|
export {
|
|
13
13
|
validatePluginEgressCredentialHooks,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# SQL migrations for `@sentry/junior`
|
|
2
|
+
|
|
3
|
+
drizzle-kit is the DDL **generator** for the shared Junior SQL schema
|
|
4
|
+
(`src/db/schema.ts`). It is **not** the applier: `junior upgrade` applies
|
|
5
|
+
checksum-pinned migrations under an advisory lock with the expand-only deploy
|
|
6
|
+
contract (`specs/conversation-storage.md`). Never run `drizzle-kit migrate` or
|
|
7
|
+
`migrate()` in any runtime path.
|
|
8
|
+
|
|
9
|
+
## Baseline (0000)
|
|
10
|
+
|
|
11
|
+
`meta/0000_snapshot.json` + `meta/_journal.json` are the kit baseline for the
|
|
12
|
+
schema that migrations `0001_conversation_core` through
|
|
13
|
+
`0005_conversation_transcripts` already provision on live databases. They exist
|
|
14
|
+
only so `pnpm --filter @sentry/junior db:generate` diffs future schema edits
|
|
15
|
+
against the current state.
|
|
16
|
+
|
|
17
|
+
The `0000_*.sql` baseline file is intentionally **deleted** and must never be
|
|
18
|
+
registered with the runner — the inline `0001`–`0005` migrations in
|
|
19
|
+
`src/chat/conversations/sql/migrations.ts` own that DDL and their recorded
|
|
20
|
+
checksums must stay byte-stable.
|
|
21
|
+
|
|
22
|
+
## Migrations 0006 onward
|
|
23
|
+
|
|
24
|
+
1. Edit the Drizzle schema under `src/db/schema/`.
|
|
25
|
+
2. Run `pnpm --filter @sentry/junior db:generate`. Keep the generated
|
|
26
|
+
`0006_*.sql` file (do not delete it like the baseline) plus its snapshot.
|
|
27
|
+
3. Register it as one line in `src/chat/conversations/sql/migrations.ts`:
|
|
28
|
+
`defineMigrationFromFile("0006_<name>", "0006_<name>.sql")`.
|
|
29
|
+
|
|
30
|
+
`db:generate` emitting **"No schema changes, nothing to migrate"** means the
|
|
31
|
+
Drizzle schema and the recorded snapshot agree — run it in CI as the schema/DDL
|
|
32
|
+
parity check.
|