@sentry/junior 0.277.0 → 0.279.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/{adapter-BtfBHVM5.js → adapter-phTTgw7H.js} +1 -1
- package/dist/{admin-DzAKbZsm.js → admin-PcpJDugZ.js} +1 -1
- package/dist/{agent-invocations-Crs3XHhg.js → agent-invocations-CUg_SODU.js} +0 -1
- package/dist/{agent-runner-BsYAbniN.js → agent-runner-DwvT1BY0.js} +321 -847
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +6 -6
- package/dist/api.d.ts +1 -1
- package/dist/api.js +46 -414
- package/dist/{app-BjEQwNVP.d.ts → app-DVs6noo7.d.ts} +6 -27
- package/dist/app.d.ts +2 -2
- package/dist/app.js +460 -78
- package/dist/{assistant-reply-NebRGG4G.js → assistant-reply-BXfxczd7.js} +28 -6
- package/dist/{automation-Cql9h2vO.js → automation-BehArCcq.js} +1 -1
- package/dist/{background-compaction-queue-hh18yCeU.js → background-compaction-queue-CcbuLJrZ.js} +2 -2
- package/dist/{briefs-BBo0Eimi.js → briefs-Dd_ezwED.js} +10 -10
- package/dist/{catalog-runtime-DE-F4Awo.js → catalog-runtime-BWVMeZhW.js} +2 -2
- package/dist/cli/chat.js +16 -16
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +0 -2
- package/dist/cli/main.js +4 -4
- package/dist/cli/plugins.js +5 -5
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +4 -4
- package/dist/{client-DZ8HTnYH.js → client-Bpxe4vKa.js} +8 -4
- package/dist/{config-D5uUtrCP.js → config-C_bmRhrJ.js} +25 -100
- package/dist/{connections-Do24CGP5.js → connections-B2rHe5W5.js} +10 -10
- package/dist/{conversation-SsASlWL7.js → conversation-CIiJtx5q.js} +56 -104
- package/dist/conversation-pending-messages-CnBvE6-6.js +173 -0
- package/dist/{conversation-privacy-VuylvlKr.js → conversation-privacy-CzOfcz0U.js} +1 -1
- package/dist/{credential-sync-BGQK3pOa.js → credential-sync-Dal_unpv.js} +15 -15
- package/dist/{db-DEiwO5Sh.d.ts → db-CyLrV9C7.d.ts} +1 -1
- package/dist/{executor-hPfFTH0C.js → executor-BfYH-Wws.js} +6 -4
- package/dist/instrumentation.d.ts +12 -0
- package/dist/instrumentation.js +56 -23
- package/dist/{logging-cI3T1dNc.js → logging-CkT3_Xxp.js} +2 -2
- package/dist/{media-DstkkoNP.js → media-DTAA8Qs_.js} +21 -23
- package/dist/{message-DBwsAl7O.js → message-Q5dkgaJ5.js} +23 -29
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +18 -6
- package/dist/{oauth-callback-server-DXrnbplb.js → oauth-callback-server-BDRaqe8O.js} +2 -2
- package/dist/{oauth-relay-C6ZAyJgf.js → oauth-relay-D0G3T16m.js} +1 -1
- package/dist/{package-discovery-DJBompdd.js → package-discovery-DJhGdS4c.js} +1 -1
- package/dist/{plugins-DOm9Y6qI.js → plugins-HYh_JOdw.js} +1 -1
- package/dist/{projection-7EFIqzuj.js → projection-DWxX7pb1.js} +214 -138
- package/dist/{prompt-oRfGsxd3.js → prompt--dwus7Y-.js} +1 -1
- package/dist/proxy-path-BHYoKZdq.js +15 -0
- package/dist/{registry-Bzefs7kT.js → registry-DnrdeO4s.js} +2 -2
- package/dist/{resolve-CuiEY_2u.js → resolve-C_QXfqD_.js} +3 -3
- package/dist/{result-DrcUtFaD.js → result-DNmOxT-N.js} +10 -10
- package/dist/{runner-CDE4CZ52.js → runner-zd_noJ1l.js} +11 -11
- package/dist/{sandbox-egress-signals-0tcmGd13.js → sandbox-egress-signals-DQjv-nbG.js} +1 -1
- package/dist/{schema-Dzi3lkdP.js → schema-CNJNzvr8.js} +4 -4
- package/dist/{schema-B6N2nc6v.d.ts → schema-e90H5FIN.d.ts} +2176 -967
- package/dist/sentry-BRTJqumy.js +51 -0
- package/dist/sentry-DrKC2NeM.d.ts +1 -0
- package/dist/sentry-route-name-BhwWnfqj.js +51 -0
- package/dist/{service-account-BOz9pqOE.js → service-account-BK26XlHo.js} +3 -3
- package/dist/{service-account-DIyz_9Uh.js → service-account-CCH2Hv4h.js} +3 -3
- package/dist/{session-stop-0juF_BP0.js → session-stop-6Tf--T7G.js} +23 -16
- package/dist/{skills-CU5Is147.js → skills-BNrk8gi4.js} +4 -4
- package/dist/{spawn-6C9jHH4b.js → spawn-C75hAB9l.js} +3 -4
- package/dist/{stop-6FVG1c-r.js → stop-RYbf7PWi.js} +742 -207
- package/dist/{store-DtHZviJ1.js → store-CO5vGjwD.js} +9 -16
- package/dist/{store-DKs1WwdB.js → store-G3h2djJU.js} +3 -3
- package/dist/{task-queue-CcvFQE_p.js → task-queue-DlN58XeM.js} +3 -3
- package/dist/{task-runner-DBkNejLl.js → task-runner-B-Bdm23d.js} +22 -10
- package/dist/{thread-state-4hjEIkIq.js → thread-state-Cj_7Slru.js} +4 -4
- package/dist/{turn-failure-response-BZNLydC3.js → turn-failure-response-CE7gaoC7.js} +7 -7
- package/dist/{turn-lifecycle-BhqYjaa4.js → turn-lifecycle-7sXwXLJ6.js} +1 -1
- package/dist/{turn-session-routing-jnLOfBHJ.js → turn-session-routing-FBdaH1zf.js} +10 -10
- package/dist/{validation-BUFmsnKs.js → validation-DLWxEzWW.js} +2 -2
- package/dist/{version-DJTk0ZCE.js → version-DtQ8WFIZ.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-WY0RYE4E.js → viewer-vsM8_90o.js} +53 -22
- package/dist/{work-C5AKvXJV.js → work-DsoFRO_0.js} +12 -17
- package/dist/{worker-BcYVDVUy.js → worker-6kZEsCXs.js} +7 -7
- package/migrations/0077_drop_agent_invocation_model_profile.sql +1 -0
- package/migrations/0078_plugin_conversation_index.sql +20 -0
- package/migrations/0079_conversation_event_author_index.sql +20 -0
- package/migrations/meta/0075_snapshot.json +98 -314
- package/migrations/meta/0076_snapshot.json +98 -314
- package/migrations/meta/0077_snapshot.json +4141 -0
- package/migrations/meta/0078_snapshot.json +4175 -0
- package/migrations/meta/0079_snapshot.json +4203 -0
- package/migrations/meta/_journal.json +22 -1
- package/package.json +5 -5
- package/dist/common-Eu6sx09c.js +0 -107
- package/dist/model-profile-B998sjVd.js +0 -67
- package/dist/rolldown-runtime-nwUcYXjP.js +0 -27
- package/dist/sentry-MDkYAVPV.js +0 -23
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as getSqlExecutor, x as getConversationStore } from "./viewer-
|
|
3
|
-
import { a as juniorAgentInvocations, i as juniorAgentBindings, n as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, t as AGENT_INVOCATION_MAILBOX_STATUSES } from "./agent-invocations-
|
|
4
|
-
import "./executor-
|
|
5
|
-
import { p as credentialContextSchema } from "./registry-
|
|
1
|
+
import { g as TURN_REASONING_LEVELS } from "./config-C_bmRhrJ.js";
|
|
2
|
+
import { C as getSqlExecutor, x as getConversationStore } from "./viewer-vsM8_90o.js";
|
|
3
|
+
import { a as juniorAgentInvocations, i as juniorAgentBindings, n as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, t as AGENT_INVOCATION_MAILBOX_STATUSES } from "./agent-invocations-CUg_SODU.js";
|
|
4
|
+
import "./executor-BfYH-Wws.js";
|
|
5
|
+
import { p as credentialContextSchema } from "./registry-DnrdeO4s.js";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { and, asc, count, countDistinct, desc, eq, inArray, lt, ne, or, sql } from "drizzle-orm";
|
|
@@ -105,8 +105,7 @@ function markTurnFailed(args) {
|
|
|
105
105
|
* code reads only these fields, never a type name, so types can later come
|
|
106
106
|
* from configuration. Types do not limit tools: Guardian reviews each child
|
|
107
107
|
* action against the root user's messages, as for any child. A child keeps its
|
|
108
|
-
* type for later agent invocations
|
|
109
|
-
* a type starts fresh.
|
|
108
|
+
* type for later agent invocations. A child without a type starts fresh.
|
|
110
109
|
*/
|
|
111
110
|
const AGENT_TYPES = [
|
|
112
111
|
"fork",
|
|
@@ -114,8 +113,8 @@ const AGENT_TYPES = [
|
|
|
114
113
|
"reviewer"
|
|
115
114
|
];
|
|
116
115
|
/**
|
|
117
|
-
* Stored name of a child agent type.
|
|
118
|
-
*
|
|
116
|
+
* Stored name of a child agent type. A stored name stays readable after its
|
|
117
|
+
* type is removed; the runtime then treats the child as a
|
|
119
118
|
* child without a type.
|
|
120
119
|
*/
|
|
121
120
|
const agentTypeSchema = z.string().regex(/^[a-z][a-z0-9_-]*$/);
|
|
@@ -179,7 +178,6 @@ const agentInvocationBaseSchema = z.object({
|
|
|
179
178
|
parentConversationId: exactStringSchema,
|
|
180
179
|
parentToolCallId: exactStringSchema.optional(),
|
|
181
180
|
agentType: agentTypeSchema.optional(),
|
|
182
|
-
modelProfile: modelProfileSchema.optional(),
|
|
183
181
|
reasoningLevel: z.enum(TURN_REASONING_LEVELS).optional(),
|
|
184
182
|
source: sourceSchema,
|
|
185
183
|
title: exactStringSchema.optional(),
|
|
@@ -218,7 +216,6 @@ const createAgentInvocationSchema = z.object({
|
|
|
218
216
|
parentConversationId: exactStringSchema,
|
|
219
217
|
parentToolCallId: exactStringSchema.optional(),
|
|
220
218
|
agentType: agentTypeSchema.optional(),
|
|
221
|
-
modelProfile: modelProfileSchema.optional(),
|
|
222
219
|
reasoningLevel: z.enum(TURN_REASONING_LEVELS).optional(),
|
|
223
220
|
title: exactStringSchema.optional()
|
|
224
221
|
}).strict();
|
|
@@ -385,7 +382,6 @@ function invocationFromRow(row) {
|
|
|
385
382
|
...row.parentMailboxStatus ? { parentMailboxStatus: row.parentMailboxStatus } : void 0,
|
|
386
383
|
...row.parentToolCallId ? { parentToolCallId: row.parentToolCallId } : void 0,
|
|
387
384
|
...row.agentType ? { agentType: row.agentType } : void 0,
|
|
388
|
-
...row.modelProfile ? { modelProfile: row.modelProfile } : void 0,
|
|
389
385
|
...row.reasoningLevel ? { reasoningLevel: row.reasoningLevel } : void 0,
|
|
390
386
|
...row.result !== null ? { result: row.result } : void 0,
|
|
391
387
|
source: row.source,
|
|
@@ -401,7 +397,7 @@ function invocationFromRow(row) {
|
|
|
401
397
|
* stored title wins.
|
|
402
398
|
*/
|
|
403
399
|
function sameCreateInput(invocation, input) {
|
|
404
|
-
return invocation.parentConversationId === input.parentConversationId && invocation.agentName === input.agentName && invocation.input === input.input && invocation.agentType === input.agentType && invocation.
|
|
400
|
+
return invocation.parentConversationId === input.parentConversationId && invocation.agentName === input.agentName && invocation.input === input.input && invocation.agentType === input.agentType && invocation.reasoningLevel === input.reasoningLevel && JSON.stringify(invocation.actor) === JSON.stringify(input.actor) && JSON.stringify(invocation.credentialContext) === JSON.stringify(input.credentialContext) && JSON.stringify(invocation.destination) === JSON.stringify(input.destination);
|
|
405
401
|
}
|
|
406
402
|
/** Read one durable agent invocation. */
|
|
407
403
|
async function getAgentInvocation(invocationId) {
|
|
@@ -503,7 +499,6 @@ async function createAgentInvocation(rawInput, nowMs = Date.now()) {
|
|
|
503
499
|
source: { kind: "agent_invocation" },
|
|
504
500
|
destination: input.destination,
|
|
505
501
|
agentType: input.agentType ?? null,
|
|
506
|
-
modelProfile: input.modelProfile ?? null,
|
|
507
502
|
reasoningLevel: input.reasoningLevel ?? null,
|
|
508
503
|
parentToolCallId: input.parentToolCallId ?? null,
|
|
509
504
|
status: "pending",
|
|
@@ -538,7 +533,6 @@ async function createAgentInvocationFromLatest(args, nowMs = Date.now()) {
|
|
|
538
533
|
source: args.runAs?.source ?? { kind: "agent_invocation" },
|
|
539
534
|
destination: args.latest.destination,
|
|
540
535
|
agentType: args.latest.agentType ?? null,
|
|
541
|
-
modelProfile: args.latest.modelProfile ?? null,
|
|
542
536
|
reasoningLevel: args.latest.reasoningLevel ?? null,
|
|
543
537
|
status: "pending",
|
|
544
538
|
mailboxStatus: "pending",
|
|
@@ -593,7 +587,6 @@ async function createAgentInvocationForMessage(input, nowMs = Date.now()) {
|
|
|
593
587
|
source: { kind: "agent_invocation" },
|
|
594
588
|
destination: input.destination,
|
|
595
589
|
agentType: latest.agentType ?? null,
|
|
596
|
-
modelProfile: latest.modelProfile ?? null,
|
|
597
590
|
reasoningLevel: latest.reasoningLevel ?? null,
|
|
598
591
|
parentToolCallId: input.parentToolCallId,
|
|
599
592
|
status: "pending",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { At as
|
|
2
|
-
import { x as getConversationStore } from "./viewer-
|
|
3
|
-
import "./background-compaction-queue-
|
|
1
|
+
import { At as requestAnotherSlice$1, Dt as recordConversationRetry$1, Et as recordAttemptFailure$1, Mt as startConversationWork$1, Nt as steerWebPendingMessages$1, Ot as releaseConversationWork$1, Pt as stopConversationWork$1, Tt as markConversationWorkEnqueued$1, _t as drainConversationMailbox$1, ct as appendInboundMessage, dt as checkInConversationWork$1, ft as clearConsumedConversationWake$1, gt as deadLetterAttempt$1, ht as completeConversationWork$1, jt as requestConversationWork$1, kt as removeActiveConversation$1, lt as beginConversationResume$1, mt as completeConversationStop$1, ot as ackMessages$1, pt as clearExpiredConversationLease$1, st as appendExclusiveInboundMessage, ut as cancelHumanFacingPendingMessages$1, vt as getConversation$1, wt as listActiveConversationIds$1, yt as getConversationWorkState$1 } from "./projection-DWxX7pb1.js";
|
|
2
|
+
import { x as getConversationStore } from "./viewer-vsM8_90o.js";
|
|
3
|
+
import "./background-compaction-queue-CcbuLJrZ.js";
|
|
4
4
|
// src/chat/task-execution/store.ts
|
|
5
5
|
function metadataStore(options) {
|
|
6
6
|
return options.conversationStore ?? getConversationStore();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as logWarn } from "./logging-
|
|
2
|
-
import { _ as runWithTurnRequestDeadline, f as QUEUE_SIGNATURE_MAX_AGE_MS, h as getQueueProvider, m as verifyQueueMessage, p as signQueueMessage } from "./background-compaction-queue-
|
|
1
|
+
import { h as logWarn } from "./logging-CkT3_Xxp.js";
|
|
2
|
+
import { _ as runWithTurnRequestDeadline, f as QUEUE_SIGNATURE_MAX_AGE_MS, h as getQueueProvider, m as verifyQueueMessage, p as signQueueMessage } from "./background-compaction-queue-CcbuLJrZ.js";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
// src/chat/queue/callback.ts
|
|
@@ -110,7 +110,7 @@ function pluginTaskCallback() {
|
|
|
110
110
|
maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
|
|
111
111
|
onRejected: logPluginTaskQueueMessageRejected,
|
|
112
112
|
run: async (message) => {
|
|
113
|
-
const { processPluginTask } = await import("./task-runner-
|
|
113
|
+
const { processPluginTask } = await import("./task-runner-B-Bdm23d.js").then((n) => n.r);
|
|
114
114
|
await processPluginTask(message);
|
|
115
115
|
},
|
|
116
116
|
topic: PLUGIN_TASK_QUEUE_TOPIC,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
+
import { Aa as createPluginLogger, Bn as coreTaskRegistrations, Gr as createPluginState, Gt as getPiMessageRole, Ln as getPlugins, Ua as createPluginConversationEvents, Xt as instructionTextForProjection, do as createPluginCache, en as isToolResultError, ga as createPluginModel, ha as createPluginEmbedder, in as stripRuntimeTurnContext, ka as createPluginModelCostRecorder, nn as normalizeToolNameFromResult, tn as isToolResultMessage, tt as getTurnRecord, v as hydrateConversationMessages } from "./projection-DWxX7pb1.js";
|
|
3
3
|
import { h as parseSlackMessageTs } from "./actor-B4DYygOB.js";
|
|
4
|
-
import { S as getDb, i as readActorIdentity, x as getConversationStore } from "./viewer-
|
|
5
|
-
import { _ as sameActorIdentity } from "./media-
|
|
6
|
-
import { r as getStateAdapter } from "./adapter-
|
|
7
|
-
import { t as resolveConversationRouting, u as getDispatchRecord } from "./turn-session-routing-
|
|
8
|
-
import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-
|
|
9
|
-
import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-
|
|
4
|
+
import { S as getDb, i as readActorIdentity, x as getConversationStore } from "./viewer-vsM8_90o.js";
|
|
5
|
+
import { _ as sameActorIdentity } from "./media-DTAA8Qs_.js";
|
|
6
|
+
import { r as getStateAdapter } from "./adapter-phTTgw7H.js";
|
|
7
|
+
import { t as resolveConversationRouting, u as getDispatchRecord } from "./turn-session-routing-FBdaH1zf.js";
|
|
8
|
+
import { o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-Cj_7Slru.js";
|
|
9
|
+
import { i as pluginTaskParamsSchema, r as pluginTaskId, s as sendVercelPluginTask } from "./task-queue-DlN58XeM.js";
|
|
10
10
|
import { pluginRunContextSchema } from "@sentry/junior-plugin-api";
|
|
11
11
|
// src/chat/plugins/task-runner.ts
|
|
12
12
|
/**
|
|
@@ -209,9 +209,18 @@ async function loadPluginRun(params) {
|
|
|
209
209
|
function taskPluginContext(plugin, message, options = {}) {
|
|
210
210
|
const pluginName = plugin.manifest.name;
|
|
211
211
|
const sessionParams = pluginTaskParamsSchema.parse(message.params);
|
|
212
|
+
const onCost = createPluginModelCostRecorder({
|
|
213
|
+
conversationId: sessionParams.conversationId,
|
|
214
|
+
pluginName,
|
|
215
|
+
source: "task",
|
|
216
|
+
turnId: sessionParams.sessionId
|
|
217
|
+
});
|
|
212
218
|
return {
|
|
213
219
|
db: getDb(),
|
|
214
|
-
embedder: createPluginEmbedder(pluginName, {
|
|
220
|
+
embedder: createPluginEmbedder(pluginName, {
|
|
221
|
+
onCost,
|
|
222
|
+
signal: options.signal
|
|
223
|
+
}),
|
|
215
224
|
events: createPluginConversationEvents({
|
|
216
225
|
conversationId: sessionParams.conversationId,
|
|
217
226
|
operationId: pluginTaskId(message),
|
|
@@ -220,7 +229,10 @@ function taskPluginContext(plugin, message, options = {}) {
|
|
|
220
229
|
}),
|
|
221
230
|
id: pluginTaskId(message),
|
|
222
231
|
log: createPluginLogger(pluginName),
|
|
223
|
-
model: createPluginModel(pluginName, plugin.model, {
|
|
232
|
+
model: createPluginModel(pluginName, plugin.model, {
|
|
233
|
+
onCost,
|
|
234
|
+
signal: options.signal
|
|
235
|
+
}),
|
|
224
236
|
name: message.name,
|
|
225
237
|
plugin: { name: pluginName },
|
|
226
238
|
cache: createPluginCache(pluginName),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { G as toOptionalNumber, K as toOptionalString, W as isRecord } from "./logging-
|
|
3
|
-
import { S as getDb } from "./viewer-
|
|
4
|
-
import { r as getStateAdapter } from "./adapter-
|
|
1
|
+
import { Rr as JUNIOR_THREAD_STATE_TTL_MS, fo as createDurableLocationConfigurationService, y as persistConversationMessages } from "./projection-DWxX7pb1.js";
|
|
2
|
+
import { G as toOptionalNumber, K as toOptionalString, W as isRecord } from "./logging-CkT3_Xxp.js";
|
|
3
|
+
import { S as getDb } from "./viewer-vsM8_90o.js";
|
|
4
|
+
import { r as getStateAdapter } from "./adapter-phTTgw7H.js";
|
|
5
5
|
// src/chat/state/conversation.ts
|
|
6
6
|
function defaultConversationState() {
|
|
7
7
|
return {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { W as isRecord, t as buildTurnFailureResponse } from "./logging-
|
|
1
|
+
import { K as clearPendingAuth, M as markConversationMessage, oo as listConversationAnnotations, un as buildDeterministicTurnId, v as hydrateConversationMessages } from "./projection-DWxX7pb1.js";
|
|
2
|
+
import { b as getProviderErrorUserMessage, g as ProviderError, v as findProviderError, y as getProviderErrorAttributes } from "./client-Bpxe4vKa.js";
|
|
3
|
+
import { W as isRecord, t as buildTurnFailureResponse } from "./logging-CkT3_Xxp.js";
|
|
4
4
|
import { h as parseSlackMessageTs } from "./actor-B4DYygOB.js";
|
|
5
|
-
import { S as getDb, y as getConversationEventStore } from "./viewer-
|
|
6
|
-
import {
|
|
7
|
-
import { O as parseAgentInvocationResultMessageId, Q as markTurnCompleted, Z as markTurnClosed, c as getAgentInvocation, m as getAgentInvocationTurnId } from "./store-
|
|
8
|
-
import { a as persistThreadStateById, o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-
|
|
5
|
+
import { S as getDb, y as getConversationEventStore } from "./viewer-vsM8_90o.js";
|
|
6
|
+
import { M as readMessageCardRefs, N as removedCardSchema, P as resolveMessageCards } from "./conversation-CIiJtx5q.js";
|
|
7
|
+
import { O as parseAgentInvocationResultMessageId, Q as markTurnCompleted, Z as markTurnClosed, c as getAgentInvocation, m as getAgentInvocationTurnId } from "./store-CO5vGjwD.js";
|
|
8
|
+
import { a as persistThreadStateById, o as coerceThreadConversationState, r as getPersistedThreadState } from "./thread-state-Cj_7Slru.js";
|
|
9
9
|
// src/chat/conversations/pending-cards.ts
|
|
10
10
|
/**
|
|
11
11
|
* Add the cards that tool results selected since the last visible assistant
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { y as getConversationEventStore } from "./viewer-
|
|
1
|
+
import { y as getConversationEventStore } from "./viewer-vsM8_90o.js";
|
|
2
2
|
// src/chat/conversations/turn-lifecycle.ts
|
|
3
3
|
/** Persist correlated turn lifecycle facts with retry-safe terminal exclusion. */
|
|
4
4
|
var ConversationTurnLifecycleService = class {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import { _ as runBestEffort, h as logWarn } from "./logging-
|
|
4
|
-
import {
|
|
5
|
-
import { s as juniorConversations } from "./agent-invocations-
|
|
6
|
-
import { d as juniorAutomations, l as juniorAutomationRuns, u as juniorAutomationVersions } from "./executor-
|
|
7
|
-
import { h as credentialSubjectSchema } from "./registry-
|
|
8
|
-
import { r as getStateAdapter } from "./adapter-
|
|
9
|
-
import { O as eventAutomationSchema, S as automationVersionSchema, j as scheduledAutomationSchema } from "./automation-
|
|
1
|
+
import { Ei as openSlackDirectMessage, Hr as getDashboardTaskLink, Rr as JUNIOR_THREAD_STATE_TTL_MS, Wr as ToolInputError, _i as escapeSlackMrkdwnText, ki as postSlackMessage, vi as formatSlackLink, w as fallbackShortTitle } from "./projection-DWxX7pb1.js";
|
|
2
|
+
import { n as botConfig } from "./config-C_bmRhrJ.js";
|
|
3
|
+
import { _ as runBestEffort, h as logWarn } from "./logging-CkT3_Xxp.js";
|
|
4
|
+
import { Q as agentTurnTotalTokens, S as getDb, Z as agentTurnCostUsd } from "./viewer-vsM8_90o.js";
|
|
5
|
+
import { s as juniorConversations } from "./agent-invocations-CUg_SODU.js";
|
|
6
|
+
import { d as juniorAutomations, l as juniorAutomationRuns, u as juniorAutomationVersions } from "./executor-BfYH-Wws.js";
|
|
7
|
+
import { h as credentialSubjectSchema } from "./registry-DnrdeO4s.js";
|
|
8
|
+
import { r as getStateAdapter } from "./adapter-phTTgw7H.js";
|
|
9
|
+
import { O as eventAutomationSchema, S as automationVersionSchema, j as scheduledAutomationSchema } from "./automation-BehArCcq.js";
|
|
10
10
|
import { createHash } from "node:crypto";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { and, asc, count, desc, eq, gte, inArray, isNotNull, isNull, lte, max, ne, or, sql } from "drizzle-orm";
|
|
@@ -1584,7 +1584,7 @@ function slackSourceForDestination(args) {
|
|
|
1584
1584
|
* Reads parent Conversations when this Conversation has no Destination.
|
|
1585
1585
|
*/
|
|
1586
1586
|
async function resolveConversationRouting(args) {
|
|
1587
|
-
const conversationStore = args.conversationStore ?? (await import("./viewer-
|
|
1587
|
+
const conversationStore = args.conversationStore ?? (await import("./viewer-vsM8_90o.js").then((n) => n.v)).getConversationStore();
|
|
1588
1588
|
const chain = await loadConversationChain(args.conversationId, conversationStore);
|
|
1589
1589
|
let destination;
|
|
1590
1590
|
let source;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
1
|
+
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BWVMeZhW.js";
|
|
3
3
|
import { isDeepStrictEqual } from "node:util";
|
|
4
4
|
// src/chat/plugins/validation.ts
|
|
5
5
|
var validation_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.
|
|
2
|
+
var version = "0.279.0";
|
|
3
3
|
// src/version.ts
|
|
4
4
|
/** Installed Junior package version, or `unknown` when package metadata is unavailable. */
|
|
5
5
|
const JUNIOR_VERSION = typeof version === "string" && version.trim() ? version : "unknown";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as JUNIOR_VERSION } from "./version-
|
|
1
|
+
export { t as JUNIOR_VERSION } from "./version-DtQ8WFIZ.js";
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as getChatConfig } from "./config-
|
|
3
|
-
import { U as normalizeIdentityEmail, V as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-
|
|
1
|
+
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
+
import { i as getChatConfig } from "./config-C_bmRhrJ.js";
|
|
3
|
+
import { U as normalizeIdentityEmail, V as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-CkT3_Xxp.js";
|
|
4
4
|
import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-B4DYygOB.js";
|
|
5
|
-
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-
|
|
6
|
-
import { S as juniorConversationAnnotations, b as juniorConversationEvents, g as juniorConversationBindings, h as juniorConversationParticipants, t as createJuniorSqlExecutor, v as CONVERSATION_METRICS, y as juniorConversationMetrics } from "./executor-
|
|
7
|
-
import { d as newConversationEventSchema, f as encodeHistoryPayload, l as decodeStoredConversationEvent, n as detectImageMediaType, o as conversationEventDataSchema, u as historyReplacementSchema, v as usageSchema } from "./media-
|
|
5
|
+
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-CUg_SODU.js";
|
|
6
|
+
import { S as juniorConversationAnnotations, b as juniorConversationEvents, g as juniorConversationBindings, h as juniorConversationParticipants, t as createJuniorSqlExecutor, v as CONVERSATION_METRICS, y as juniorConversationMetrics } from "./executor-BfYH-Wws.js";
|
|
7
|
+
import { d as newConversationEventSchema, f as encodeHistoryPayload, l as decodeStoredConversationEvent, n as detectImageMediaType, o as conversationEventDataSchema, u as historyReplacementSchema, v as usageSchema } from "./media-DTAA8Qs_.js";
|
|
8
8
|
import { a as withLock } from "./locks-D-0h111u.js";
|
|
9
9
|
import { createHash, randomUUID } from "node:crypto";
|
|
10
10
|
import { and, asc, desc, eq, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, or, sql } from "drizzle-orm";
|
|
11
11
|
import { destinationSchema, identitySchema, locationSchema, sourceSchema, userSchema } from "@sentry/junior-plugin-api";
|
|
12
|
+
import { alias } from "drizzle-orm/pg-core";
|
|
12
13
|
// src/chat/destination.ts
|
|
13
14
|
/** Build Junior's canonical destination from Slack workspace and channel ids. */
|
|
14
15
|
function createSlackDestination(input) {
|
|
@@ -1589,6 +1590,50 @@ var SqlConversationEventStore = class {
|
|
|
1589
1590
|
function createSqlConversationEventStore(executor) {
|
|
1590
1591
|
return new SqlConversationEventStore(executor);
|
|
1591
1592
|
}
|
|
1593
|
+
// src/chat/conversations/sql/annotation-filter.ts
|
|
1594
|
+
function annotationKeyMatches(key) {
|
|
1595
|
+
const annotation = key.toLowerCase();
|
|
1596
|
+
return sql`(
|
|
1597
|
+
lower(${juniorConversationAnnotations.key}) = ${annotation}
|
|
1598
|
+
or starts_with(
|
|
1599
|
+
lower(${juniorConversationAnnotations.key}),
|
|
1600
|
+
${`${annotation}#`}
|
|
1601
|
+
)
|
|
1602
|
+
)`;
|
|
1603
|
+
}
|
|
1604
|
+
/**
|
|
1605
|
+
* Match Conversations that have an Annotation with `key`, or a nested child
|
|
1606
|
+
* key that continues with `#`. Matching ignores case.
|
|
1607
|
+
*/
|
|
1608
|
+
function hasAnnotationKey(conversationId, key) {
|
|
1609
|
+
return sql`exists (
|
|
1610
|
+
select 1
|
|
1611
|
+
from ${juniorConversationAnnotations}
|
|
1612
|
+
where ${and(eq(juniorConversationAnnotations.conversationId, conversationId), annotationKeyMatches(key))}
|
|
1613
|
+
)`;
|
|
1614
|
+
}
|
|
1615
|
+
const ANNOTATED_ALIAS = "annotated_conversations";
|
|
1616
|
+
/**
|
|
1617
|
+
* Match root Conversations where any Conversation in the tree has an
|
|
1618
|
+
* Annotation with `key`. Tools write the Annotation on the Conversation that
|
|
1619
|
+
* ran them, which can be a child agent.
|
|
1620
|
+
*/
|
|
1621
|
+
function treeHasAnnotationKey(rootConversationId, key) {
|
|
1622
|
+
const annotated = alias(juniorConversations, ANNOTATED_ALIAS);
|
|
1623
|
+
return sql`exists (
|
|
1624
|
+
select 1
|
|
1625
|
+
from ${juniorConversationAnnotations}
|
|
1626
|
+
inner join ${juniorConversations} as ${sql.identifier(ANNOTATED_ALIAS)}
|
|
1627
|
+
on ${annotated.conversationId} = ${juniorConversationAnnotations.conversationId}
|
|
1628
|
+
where ${and(eq(annotated.rootConversationId, rootConversationId), annotationKeyMatches(key))}
|
|
1629
|
+
)`;
|
|
1630
|
+
}
|
|
1631
|
+
/** Return the IDs in `conversationIds` that have an Annotation with `key`. */
|
|
1632
|
+
async function conversationIdsWithAnnotation(db, conversationIds, key) {
|
|
1633
|
+
if (conversationIds.length === 0) return /* @__PURE__ */ new Set();
|
|
1634
|
+
const rows = await db.selectDistinct({ conversationId: juniorConversationAnnotations.conversationId }).from(juniorConversationAnnotations).where(and(inArray(juniorConversationAnnotations.conversationId, [...conversationIds]), annotationKeyMatches(key)));
|
|
1635
|
+
return new Set(rows.map((row) => row.conversationId));
|
|
1636
|
+
}
|
|
1592
1637
|
// src/chat/conversations/sql/message-search.ts
|
|
1593
1638
|
const EXCERPT_WITHOUT_QUERY_CHARS = 240;
|
|
1594
1639
|
var SqlConversationMessageSearchStore = class {
|
|
@@ -1620,21 +1665,7 @@ var SqlConversationMessageSearchStore = class {
|
|
|
1620
1665
|
if (args.filters.channelId) conditions.push(eq(juniorDestinations.providerDestinationId, args.filters.channelId));
|
|
1621
1666
|
if (args.filters.afterMs !== void 0 && Number.isFinite(args.filters.afterMs)) conditions.push(gte(juniorConversations.lastActivityAt, new Date(args.filters.afterMs)));
|
|
1622
1667
|
if (args.filters.beforeMs !== void 0 && Number.isFinite(args.filters.beforeMs)) conditions.push(lt(juniorConversations.lastActivityAt, new Date(args.filters.beforeMs)));
|
|
1623
|
-
if (args.filters.annotation)
|
|
1624
|
-
const annotation = args.filters.annotation.toLowerCase();
|
|
1625
|
-
const nestedAnnotationPrefix = `${annotation}#`;
|
|
1626
|
-
conditions.push(sql`exists (
|
|
1627
|
-
select 1
|
|
1628
|
-
from ${juniorConversationAnnotations}
|
|
1629
|
-
where ${and(eq(juniorConversationAnnotations.conversationId, juniorConversations.conversationId), sql`(
|
|
1630
|
-
lower(${juniorConversationAnnotations.key}) = ${annotation}
|
|
1631
|
-
or starts_with(
|
|
1632
|
-
lower(${juniorConversationAnnotations.key}),
|
|
1633
|
-
${nestedAnnotationPrefix}
|
|
1634
|
-
)
|
|
1635
|
-
)`)}
|
|
1636
|
-
)`);
|
|
1637
|
-
}
|
|
1668
|
+
if (args.filters.annotation) conditions.push(hasAnnotationKey(juniorConversations.conversationId, args.filters.annotation));
|
|
1638
1669
|
const bestPerConversation = db.selectDistinctOn([juniorConversations.conversationId], {
|
|
1639
1670
|
channelName: juniorDestinations.displayName,
|
|
1640
1671
|
conversationId: juniorConversations.conversationId,
|
|
@@ -2025,4 +2056,4 @@ async function readIdentityByIdFromSql(db, identityId) {
|
|
|
2025
2056
|
async function readIdentityById(identityId) {
|
|
2026
2057
|
return await readIdentityByIdFromSql(getDb(), identityId);
|
|
2027
2058
|
}
|
|
2028
|
-
export {
|
|
2059
|
+
export { agentTurnUsageSchema as $, loadConversationSlackTenantIds as A, findUserByVerifiedEmails as B, getSqlExecutor as C, createSqlConversationEventStore as D, treeHasAnnotationKey as E, SYSTEM_IDENTITY_ID as F, bindProviderConversation as G, recordGoogleSignIn as H, resolveActorIdentityId as I, nextDetailVersion as J, parseSessionSource as K, saveActorAvatar as L, withConversationMutationLock as M, locationFromRow as N, eventFromRow as O, startLocationThread as P, agentTurnTotalTokens as Q, deleteProviderIdentityForSlackUser as R, getDb as S, hasAnnotationKey as T, saveUserTimezone as U, readUserTimezone as V, upsertLinkedIdentity as W, addAgentTurnUsage as X, touchConversationDetail as Y, agentTurnCostUsd as Z, closeDb as _, readActorIdentityFromSql as a, sameDestination as at, getConversationMessageSearchStore as b, readViewerAvatarUrl as c, updateViewerDisplayName as d, hasAgentTurnUsage as et, identityAvatarUrl as f, createCache as g, readUserAvatarUrls as h, readActorIdentity as i, requireSlackDestination as it, createSqlStore as j, withConversationEventLock as k, resolveViewerUser as l, readAvatarImage as m, findUserByEmailFromSql as n, createSlackDestination as nt, readIdentityById as o, parseAvatarUrl as p, conversationDetailTouch as q, listAdminUsersFromSql as r, parseDestination as rt, readIdentityByIdFromSql as s, findUserByEmail as t, resolveRootConversationId as tt, setUserAdminFromSql as u, db_exports as v, conversationIdsWithAnnotation as w, getConversationStore as x, getConversationEventStore as y, deleteProviderIdentityForUser as z };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
3
|
-
import {
|
|
4
|
-
import { _ as sameActorIdentity, p as agentInstructionProvenance } from "./media-
|
|
5
|
-
import { At as withoutSavedSteeringMessages, It as readBlockedReport, St as recordSubagentStarted, kt as buildSteeringPiMessage, xt as recordSubagentEnded, yt as stopChildAgentsOf } from "./agent-runner-
|
|
6
|
-
import { B as agentTypeInstructions, C as markAgentInvocationMailboxAppended, D as markAgentInvocationSteered, E as markAgentInvocationRunning, G as TurnInputCommitLostError, T as markAgentInvocationPaused, V as agentTypeStartsWithParentHistory, Y as isTurnInputCommitLostError, _ as getLatestAgentInvocationForConversation, b as listAgentInvocationsForConversation, c as getAgentInvocation, f as getAgentInvocationMessageId, i as createAgentInvocation, k as reportReplacedAgentInvocation, m as getAgentInvocationTurnId, n as NON_TERMINAL_AGENT_INVOCATION_STATUSES, q as getConversationTurnBoundaryError, r as completeAgentInvocation, s as getActiveAgentInvocationForConversation, t as ACTIVE_AGENT_INVOCATION_STATUSES, y as isTerminalAgentInvocation } from "./store-
|
|
7
|
-
import { n as getAssistantReplyText } from "./assistant-reply-
|
|
8
|
-
import { E as maybePostAutomatedTurnLimitNotice, M as recordFinishedTurnForAutomatedLimit, N as resetAutomatedTurnLimit } from "./session-stop-
|
|
9
|
-
import { r as appendAndEnqueueInboundMessage } from "./store-
|
|
10
|
-
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-
|
|
11
|
-
import { a as persistThreadStateById, n as getPersistedSandboxState, r as getPersistedThreadState } from "./thread-state-
|
|
1
|
+
import { H as AuthorizationFlowDisabledError, Kt as getTerminalAssistantMessages, Q as abandonTurnRecord, R as PluginCredentialFailureError, Vt as isTurnExecutionLimitExceededError, Z as saveTurnCheckpoint, Za as loadForkHistory, et as failTurnRecord, s as openConversationProjection, tt as getTurnRecord } from "./projection-DWxX7pb1.js";
|
|
2
|
+
import { n as botConfig } from "./config-C_bmRhrJ.js";
|
|
3
|
+
import { F as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-vsM8_90o.js";
|
|
4
|
+
import { _ as sameActorIdentity, p as agentInstructionProvenance } from "./media-DTAA8Qs_.js";
|
|
5
|
+
import { At as withoutSavedSteeringMessages, It as readBlockedReport, St as recordSubagentStarted, kt as buildSteeringPiMessage, xt as recordSubagentEnded, yt as stopChildAgentsOf } from "./agent-runner-DwvT1BY0.js";
|
|
6
|
+
import { B as agentTypeInstructions, C as markAgentInvocationMailboxAppended, D as markAgentInvocationSteered, E as markAgentInvocationRunning, G as TurnInputCommitLostError, T as markAgentInvocationPaused, V as agentTypeStartsWithParentHistory, Y as isTurnInputCommitLostError, _ as getLatestAgentInvocationForConversation, b as listAgentInvocationsForConversation, c as getAgentInvocation, f as getAgentInvocationMessageId, i as createAgentInvocation, k as reportReplacedAgentInvocation, m as getAgentInvocationTurnId, n as NON_TERMINAL_AGENT_INVOCATION_STATUSES, q as getConversationTurnBoundaryError, r as completeAgentInvocation, s as getActiveAgentInvocationForConversation, t as ACTIVE_AGENT_INVOCATION_STATUSES, y as isTerminalAgentInvocation } from "./store-CO5vGjwD.js";
|
|
7
|
+
import { n as getAssistantReplyText } from "./assistant-reply-BXfxczd7.js";
|
|
8
|
+
import { E as maybePostAutomatedTurnLimitNotice, M as recordFinishedTurnForAutomatedLimit, N as resetAutomatedTurnLimit } from "./session-stop-6Tf--T7G.js";
|
|
9
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-G3h2djJU.js";
|
|
10
|
+
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-7sXwXLJ6.js";
|
|
11
|
+
import { a as persistThreadStateById, n as getPersistedSandboxState, r as getPersistedThreadState } from "./thread-state-Cj_7Slru.js";
|
|
12
12
|
import { isDeepStrictEqual } from "node:util";
|
|
13
13
|
import { z } from "zod";
|
|
14
14
|
// src/chat/runtime/turn-execution.ts
|
|
@@ -64,12 +64,7 @@ const agentInvocationMailboxMetadataSchema = z.object({
|
|
|
64
64
|
/** Map a durable invocation's model settings and depth to the child Run policy. */
|
|
65
65
|
function agentInvocationRunPolicy(invocation, canSpawn) {
|
|
66
66
|
return {
|
|
67
|
-
disabledFeatures: canSpawn ? ["
|
|
68
|
-
"handoff",
|
|
69
|
-
"interactive-auth",
|
|
70
|
-
"subagents"
|
|
71
|
-
],
|
|
72
|
-
...invocation.modelProfile ? { modelProfile: invocation.modelProfile } : void 0,
|
|
67
|
+
disabledFeatures: canSpawn ? ["interactive-auth"] : ["interactive-auth", "subagents"],
|
|
73
68
|
...invocation.reasoningLevel ? { reasoning: invocation.reasoningLevel } : void 0
|
|
74
69
|
};
|
|
75
70
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Ct as
|
|
3
|
-
import {
|
|
4
|
-
import { i as getChatConfig } from "./config-
|
|
5
|
-
import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-
|
|
6
|
-
import { g as getTurnRequestDeadline, v as ConversationQueueMessageRejectedError } from "./background-compaction-queue-
|
|
7
|
-
import { C as requestAnotherSlice, T as startConversationWork, b as recordConversationRetry, d as countPendingConversationMessages, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, l as completeConversationStop, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, s as clearConsumedConversationWake, t as ackMessages, u as completeConversationWork, x as releaseConversationWork, y as recordAttemptFailure } from "./store-
|
|
1
|
+
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
+
import { Ct as isInvalidConversationRecordError, St as isFinalAttempt, bt as hasConversationStop } from "./projection-DWxX7pb1.js";
|
|
3
|
+
import { x as isProviderRetryError } from "./client-Bpxe4vKa.js";
|
|
4
|
+
import { i as getChatConfig } from "./config-C_bmRhrJ.js";
|
|
5
|
+
import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-CkT3_Xxp.js";
|
|
6
|
+
import { g as getTurnRequestDeadline, v as ConversationQueueMessageRejectedError } from "./background-compaction-queue-CcbuLJrZ.js";
|
|
7
|
+
import { C as requestAnotherSlice, T as startConversationWork, b as recordConversationRetry, d as countPendingConversationMessages, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, l as completeConversationStop, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, s as clearConsumedConversationWake, t as ackMessages, u as completeConversationWork, x as releaseConversationWork, y as recordAttemptFailure } from "./store-G3h2djJU.js";
|
|
8
8
|
// src/chat/task-execution/attempt-selection.ts
|
|
9
9
|
function selectContiguousTurnBatch(messages) {
|
|
10
10
|
const first = messages[0];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "junior_agent_invocations" DROP COLUMN "model_profile";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- For a busy database, first run the index definition below with CONCURRENTLY,
|
|
2
|
+
-- as one statement outside a transaction. Before junior upgrade, check its
|
|
3
|
+
-- pg_get_indexdef, pg_index.indisvalid, and pg_index.indisready.
|
|
4
|
+
DO $$
|
|
5
|
+
BEGIN
|
|
6
|
+
-- Even CREATE INDEX IF NOT EXISTS takes a write-blocking table lock.
|
|
7
|
+
IF to_regclass('junior_conversation_events_plugin_conversation_idx') IS NULL THEN
|
|
8
|
+
CREATE INDEX "junior_conversation_events_plugin_conversation_idx" ON "junior_conversation_events" USING btree ("conversation_id",("payload"->>'namespace'),("payload"->>'name'),"seq") WHERE "junior_conversation_events"."type" = 'structured_event';
|
|
9
|
+
END IF;
|
|
10
|
+
|
|
11
|
+
-- A failed concurrent build can leave an index that exists but cannot be used.
|
|
12
|
+
IF NOT EXISTS (
|
|
13
|
+
SELECT 1 FROM pg_index
|
|
14
|
+
WHERE indexrelid = 'junior_conversation_events_plugin_conversation_idx'::regclass
|
|
15
|
+
AND indrelid = 'junior_conversation_events'::regclass
|
|
16
|
+
AND indisvalid AND indisready
|
|
17
|
+
) THEN
|
|
18
|
+
RAISE EXCEPTION 'The plugin conversation index is not valid and ready. Repair the concurrent build before running junior upgrade.';
|
|
19
|
+
END IF;
|
|
20
|
+
END $$;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- For a busy database, first run the index definition below with CONCURRENTLY,
|
|
2
|
+
-- as one statement outside a transaction. Before junior upgrade, check its
|
|
3
|
+
-- pg_get_indexdef, pg_index.indisvalid, and pg_index.indisready.
|
|
4
|
+
DO $$
|
|
5
|
+
BEGIN
|
|
6
|
+
-- Even CREATE INDEX IF NOT EXISTS takes a write-blocking table lock.
|
|
7
|
+
IF to_regclass('junior_conversation_events_author_idx') IS NULL THEN
|
|
8
|
+
CREATE INDEX "junior_conversation_events_author_idx" ON "junior_conversation_events" USING btree ("conversation_id","actor_identity_id","seq") WHERE "junior_conversation_events"."actor_identity_id" is not null;
|
|
9
|
+
END IF;
|
|
10
|
+
|
|
11
|
+
-- A failed concurrent build can leave an index that exists but cannot be used.
|
|
12
|
+
IF NOT EXISTS (
|
|
13
|
+
SELECT 1 FROM pg_index
|
|
14
|
+
WHERE indexrelid = 'junior_conversation_events_author_idx'::regclass
|
|
15
|
+
AND indrelid = 'junior_conversation_events'::regclass
|
|
16
|
+
AND indisvalid AND indisready
|
|
17
|
+
) THEN
|
|
18
|
+
RAISE EXCEPTION 'The conversation event author index is not valid and ready. Repair the concurrent build before running junior upgrade.';
|
|
19
|
+
END IF;
|
|
20
|
+
END $$;
|