@sentry/junior 0.109.0 → 0.110.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-FHHVLNPA.js → agent-hooks-ELT4ODFF.js} +12 -13
- package/dist/api/conversations/access.d.ts +9 -0
- package/dist/api/conversations/aggregate.d.ts +12 -1
- package/dist/api/conversations/archive.d.ts +3 -5
- package/dist/api/conversations/detail.d.ts +156 -7
- package/dist/api/conversations/events.d.ts +1 -1
- package/dist/api/conversations/list.d.ts +57 -6
- package/dist/api/conversations/projection.d.ts +6 -7
- package/dist/api/conversations/reporting.d.ts +10 -4
- package/dist/api/conversations/routes.d.ts +2 -1
- package/dist/api/conversations/shared.d.ts +1 -1
- package/dist/api/conversations/stats.d.ts +37 -6
- package/dist/api/conversations/stats.query.d.ts +1 -1
- package/dist/api/conversations/usage.d.ts +9 -0
- package/dist/api/http.d.ts +7 -0
- package/dist/api/locations/detail.d.ts +102 -6
- package/dist/api/locations/list.d.ts +43 -5
- package/dist/api/locations/query.d.ts +4 -2
- package/dist/api/locations/routes.d.ts +2 -1
- package/dist/api/people/list.d.ts +28 -6
- package/dist/api/people/list.query.d.ts +1 -1
- package/dist/api/people/profile.d.ts +96 -7
- package/dist/api/people/profile.query.d.ts +4 -2
- package/dist/api/people/routes.d.ts +2 -1
- package/dist/api/people/shared.d.ts +1219 -2
- package/dist/api/route.d.ts +18 -4
- package/dist/api/schema/common.d.ts +6 -0
- package/dist/api/{conversations/schema.d.ts → schema/conversation.d.ts} +31 -3
- package/dist/api/{locations/schema.d.ts → schema/location.d.ts} +5 -0
- package/dist/api/{people/schema.d.ts → schema/person.d.ts} +37 -45
- package/dist/api/schema.d.ts +8 -22
- package/dist/api/schema.js +10 -2
- package/dist/api.d.ts +5 -1
- package/dist/api.js +767 -384
- package/dist/app.js +87 -70
- package/dist/catalog-runtime-4GI22PXK.js +16 -0
- package/dist/chat/agent/resume.d.ts +11 -12
- package/dist/chat/conversations/history.d.ts +3 -0
- package/dist/chat/conversations/sql/privacy.d.ts +3 -15
- package/dist/chat/pi/messages.d.ts +2 -2
- package/dist/chat/pi/sql-model-usage.d.ts +4 -1
- package/dist/chat/services/auth-pause.d.ts +4 -0
- package/dist/chat/services/context-compaction.d.ts +1 -0
- package/dist/chat/task-execution/queue-signing.d.ts +10 -8
- package/dist/chat/task-execution/queue.d.ts +9 -7
- package/dist/chat/task-execution/slack-work.d.ts +6 -6
- package/dist/{chunk-QY636HZU.js → chunk-2T7TIEXI.js} +90 -7
- package/dist/{chunk-CEA3A3UA.js → chunk-2ZTTXTSZ.js} +24 -1
- package/dist/{chunk-FWJRXN4F.js → chunk-3S7YYHBI.js} +3 -139
- package/dist/{chunk-3SXUV423.js → chunk-3TV7OEHL.js} +1 -1
- package/dist/{chunk-MXW4GL53.js → chunk-3UBQI73J.js} +7 -7
- package/dist/{chunk-IVVGFRQQ.js → chunk-42WRQLJ6.js} +10 -38
- package/dist/{chunk-FENLIFJD.js → chunk-4QU44P7Q.js} +69 -10
- package/dist/{chunk-O3JMSZLI.js → chunk-6Y5L4BOM.js} +3 -5
- package/dist/{chunk-PLB7MRCQ.js → chunk-C4MZ3GP5.js} +1 -1
- package/dist/{chunk-72OMGPDS.js → chunk-C5XAFTHY.js} +7 -9
- package/dist/{chunk-HHVY4SMP.js → chunk-FPK7XY3F.js} +98 -92
- package/dist/{chunk-OUHNWH46.js → chunk-GK47NBDE.js} +1 -1
- package/dist/{chunk-ISMWX44P.js → chunk-IYKPU7H6.js} +2 -2
- package/dist/{chunk-TMBRFULF.js → chunk-JQFJO5WH.js} +7 -1
- package/dist/{chunk-RGX4V75M.js → chunk-L5XQPJ7T.js} +3 -3
- package/dist/{chunk-7Q6WCISF.js → chunk-MIAKQNYX.js} +43 -31
- package/dist/{chunk-IXKSQGIO.js → chunk-RHHRKSPI.js} +178 -142
- package/dist/{chunk-WHMOBKT7.js → chunk-SBOBTS27.js} +2 -2
- package/dist/{chunk-HO5NT6OE.js → chunk-W6RJZG7F.js} +4 -4
- package/dist/chunk-W75ZPAGG.js +44 -0
- package/dist/{chunk-JNAVF45E.js → chunk-WNOVRQ67.js} +2 -2
- package/dist/{chunk-TT6GMXNA.js → chunk-Y3H2DN6F.js} +2 -2
- package/dist/{chunk-MGUMR35T.js → chunk-Y5FK3CNG.js} +1 -1
- package/dist/{chunk-OCD3OZRK.js → chunk-ZKIOWEFL.js} +1 -1
- package/dist/cli/chat.js +23 -24
- package/dist/cli/check.js +8 -8
- package/dist/cli/plugins.js +15 -16
- package/dist/cli/snapshot-warmup.js +11 -11
- package/dist/cli/upgrade.js +9 -9
- package/dist/db/schema/conversations.d.ts +17 -0
- package/dist/db/schema.d.ts +17 -0
- package/dist/{db-V3NU72O2.js → db-Y6W6CWWW.js} +8 -9
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +3 -4
- package/dist/reporting-schema.d.ts +46 -0
- package/dist/{runner-JYBCQBLK.js → runner-BBFV5GLR.js} +14 -15
- package/dist/{skills-U6MDAST7.js → skills-AR4AF32L.js} +8 -8
- package/dist/{validation-72N3JVRU.js → validation-FBIEPTC2.js} +8 -8
- package/dist/version.js +1 -1
- package/migrations/0007_thick_sugar_man.sql +23 -0
- package/migrations/meta/0007_snapshot.json +1013 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +5 -5
- package/dist/catalog-runtime-DMGJSLV2.js +0 -16
- package/dist/chunk-OB42YVAE.js +0 -16
- package/dist/chunk-SYAQIR5Z.js +0 -53
package/dist/app.js
CHANGED
|
@@ -6,21 +6,23 @@ import {
|
|
|
6
6
|
processPluginTask,
|
|
7
7
|
requireTurnFailureEventId,
|
|
8
8
|
scheduleSessionCompletedPluginTasks
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3UBQI73J.js";
|
|
10
10
|
import {
|
|
11
11
|
GET,
|
|
12
12
|
buildSentryConversationUrl,
|
|
13
13
|
conversationVisibilityFromSlackChannelType,
|
|
14
|
-
resolveRootVisibility,
|
|
15
14
|
resolveSlackChannelTypeFromMessage,
|
|
16
15
|
resolveSlackConversationContext
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-3S7YYHBI.js";
|
|
17
|
+
import "./chunk-2ZTTXTSZ.js";
|
|
19
18
|
import {
|
|
19
|
+
ConversationQueueMessageRejectedError,
|
|
20
|
+
conversationQueueMessageSchema,
|
|
20
21
|
getVercelConversationWorkQueue,
|
|
22
|
+
isConversationQueueMessageRejectedError,
|
|
21
23
|
resolveConversationWorkQueueTopic,
|
|
22
24
|
verifyConversationQueueMessage
|
|
23
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-MIAKQNYX.js";
|
|
24
26
|
import {
|
|
25
27
|
PLUGIN_TASK_QUEUE_TOPIC,
|
|
26
28
|
createVercelQueueClient,
|
|
@@ -29,7 +31,7 @@ import {
|
|
|
29
31
|
import {
|
|
30
32
|
validatePluginEgressCredentialHooks,
|
|
31
33
|
validatePluginRegistrations
|
|
32
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-Y5FK3CNG.js";
|
|
33
35
|
import {
|
|
34
36
|
defineJuniorPlugins,
|
|
35
37
|
pluginCatalogConfigFromEnv,
|
|
@@ -82,7 +84,7 @@ import {
|
|
|
82
84
|
splitSlackReplyText,
|
|
83
85
|
startOAuthFlow,
|
|
84
86
|
truncateStatusText
|
|
85
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-RHHRKSPI.js";
|
|
86
88
|
import {
|
|
87
89
|
ConversationTurnBoundaryError,
|
|
88
90
|
CooperativeTurnYieldError,
|
|
@@ -141,8 +143,8 @@ import {
|
|
|
141
143
|
turnHasReply,
|
|
142
144
|
updateConversationStats,
|
|
143
145
|
upsertConversationMessage
|
|
144
|
-
} from "./chunk-
|
|
145
|
-
import "./chunk-
|
|
146
|
+
} from "./chunk-C5XAFTHY.js";
|
|
147
|
+
import "./chunk-W6RJZG7F.js";
|
|
146
148
|
import "./chunk-MU6HHZEN.js";
|
|
147
149
|
import "./chunk-PDO5BLNM.js";
|
|
148
150
|
import "./chunk-UIE3R5XU.js";
|
|
@@ -161,12 +163,12 @@ import {
|
|
|
161
163
|
validatePlugins,
|
|
162
164
|
verifyScheduledTaskCredentialSubject,
|
|
163
165
|
verifySlackDirectCredentialSubject
|
|
164
|
-
} from "./chunk-
|
|
166
|
+
} from "./chunk-2T7TIEXI.js";
|
|
165
167
|
import {
|
|
166
168
|
acquireActiveLock,
|
|
167
169
|
getDefaultRedisStateAdapterFor,
|
|
168
170
|
getStateAdapter
|
|
169
|
-
} from "./chunk-
|
|
171
|
+
} from "./chunk-GK47NBDE.js";
|
|
170
172
|
import {
|
|
171
173
|
SlackActionError,
|
|
172
174
|
downloadPrivateSlackFile,
|
|
@@ -177,20 +179,25 @@ import {
|
|
|
177
179
|
normalizeSlackConversationId,
|
|
178
180
|
runWithSlackInstallationToken,
|
|
179
181
|
runWithWorkspaceTeamId
|
|
180
|
-
} from "./chunk-
|
|
182
|
+
} from "./chunk-L5XQPJ7T.js";
|
|
181
183
|
import {
|
|
182
184
|
contextProvenance,
|
|
185
|
+
createSlackDestination,
|
|
186
|
+
destinationKey,
|
|
183
187
|
getConversationEventStore,
|
|
184
188
|
getConversationStore,
|
|
185
189
|
getDb,
|
|
186
190
|
getSqlExecutor,
|
|
187
191
|
instructionProvenanceFor,
|
|
192
|
+
parseDestination,
|
|
193
|
+
requireSlackDestination,
|
|
194
|
+
sameDestination,
|
|
188
195
|
withConversationEventLock
|
|
189
|
-
} from "./chunk-
|
|
196
|
+
} from "./chunk-4QU44P7Q.js";
|
|
190
197
|
import {
|
|
191
198
|
juniorConversationEvents,
|
|
192
199
|
juniorConversations
|
|
193
|
-
} from "./chunk-
|
|
200
|
+
} from "./chunk-JQFJO5WH.js";
|
|
194
201
|
import {
|
|
195
202
|
sleep
|
|
196
203
|
} from "./chunk-4ZNGQH7C.js";
|
|
@@ -214,7 +221,7 @@ import {
|
|
|
214
221
|
standardModelId,
|
|
215
222
|
stripRuntimeTurnContext,
|
|
216
223
|
trimTrailingAssistantMessages
|
|
217
|
-
} from "./chunk-
|
|
224
|
+
} from "./chunk-WNOVRQ67.js";
|
|
218
225
|
import {
|
|
219
226
|
juniorDestinations
|
|
220
227
|
} from "./chunk-VFUK3X5B.js";
|
|
@@ -223,26 +230,19 @@ import {
|
|
|
223
230
|
readSlackRawMessageContext,
|
|
224
231
|
resolveSlackChannelIdFromMessage,
|
|
225
232
|
resolveSlackChannelIdFromThreadId
|
|
226
|
-
} from "./chunk-
|
|
227
|
-
import {
|
|
228
|
-
createSlackDestination,
|
|
229
|
-
destinationKey,
|
|
230
|
-
parseDestination,
|
|
231
|
-
requireSlackDestination,
|
|
232
|
-
sameDestination
|
|
233
|
-
} from "./chunk-SYAQIR5Z.js";
|
|
233
|
+
} from "./chunk-6Y5L4BOM.js";
|
|
234
234
|
import {
|
|
235
235
|
discoverSkills
|
|
236
|
-
} from "./chunk-
|
|
236
|
+
} from "./chunk-SBOBTS27.js";
|
|
237
237
|
import {
|
|
238
238
|
pluginCatalogRuntime
|
|
239
|
-
} from "./chunk-
|
|
239
|
+
} from "./chunk-3TV7OEHL.js";
|
|
240
240
|
import {
|
|
241
241
|
buildOAuthTokenRequest,
|
|
242
242
|
credentialSubjectSchema,
|
|
243
243
|
hasRequiredOAuthScope,
|
|
244
244
|
parseOAuthTokenResponse
|
|
245
|
-
} from "./chunk-
|
|
245
|
+
} from "./chunk-Y3H2DN6F.js";
|
|
246
246
|
import {
|
|
247
247
|
createActor,
|
|
248
248
|
createSlackActor,
|
|
@@ -251,7 +251,7 @@ import {
|
|
|
251
251
|
isUserActor,
|
|
252
252
|
parseActorUserId,
|
|
253
253
|
parseStoredSlackActor
|
|
254
|
-
} from "./chunk-
|
|
254
|
+
} from "./chunk-C4MZ3GP5.js";
|
|
255
255
|
import {
|
|
256
256
|
buildTurnFailureResponse,
|
|
257
257
|
createChatSdkLogger,
|
|
@@ -267,12 +267,14 @@ import {
|
|
|
267
267
|
setTags,
|
|
268
268
|
withContext,
|
|
269
269
|
withSpan
|
|
270
|
-
} from "./chunk-
|
|
270
|
+
} from "./chunk-IYKPU7H6.js";
|
|
271
271
|
import {
|
|
272
272
|
isRecord,
|
|
273
|
+
parseSlackChannelId,
|
|
274
|
+
parseSlackMessageTs,
|
|
273
275
|
toOptionalNumber,
|
|
274
276
|
toOptionalString
|
|
275
|
-
} from "./chunk-
|
|
277
|
+
} from "./chunk-42WRQLJ6.js";
|
|
276
278
|
import {
|
|
277
279
|
continueTrace
|
|
278
280
|
} from "./chunk-6GWA276C.js";
|
|
@@ -281,13 +283,11 @@ import {
|
|
|
281
283
|
homeDir
|
|
282
284
|
} from "./chunk-3V7OFJZC.js";
|
|
283
285
|
import {
|
|
284
|
-
JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE
|
|
285
|
-
|
|
286
|
-
parseSlackMessageTs
|
|
287
|
-
} from "./chunk-IVVGFRQQ.js";
|
|
286
|
+
JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE
|
|
287
|
+
} from "./chunk-W75ZPAGG.js";
|
|
288
288
|
import {
|
|
289
289
|
JUNIOR_VERSION
|
|
290
|
-
} from "./chunk-
|
|
290
|
+
} from "./chunk-ZKIOWEFL.js";
|
|
291
291
|
import "./chunk-MLKGABMK.js";
|
|
292
292
|
|
|
293
293
|
// src/app.ts
|
|
@@ -2506,8 +2506,7 @@ async function ensureConversationWake(args) {
|
|
|
2506
2506
|
}
|
|
2507
2507
|
const queueResult = await args.queue.send(
|
|
2508
2508
|
{
|
|
2509
|
-
conversationId: args.conversationId
|
|
2510
|
-
destination: conversation.destination
|
|
2509
|
+
conversationId: args.conversationId
|
|
2511
2510
|
},
|
|
2512
2511
|
{
|
|
2513
2512
|
delayMs: args.delayMs,
|
|
@@ -3184,7 +3183,47 @@ async function GET2(request, waitUntil, options = {}) {
|
|
|
3184
3183
|
import { timingSafeEqual as timingSafeEqual3 } from "crypto";
|
|
3185
3184
|
|
|
3186
3185
|
// src/chat/conversations/sql/purge.ts
|
|
3187
|
-
import { and, asc, eq, inArray, isNull, sql } from "drizzle-orm";
|
|
3186
|
+
import { and, asc, eq as eq2, inArray, isNull, sql } from "drizzle-orm";
|
|
3187
|
+
|
|
3188
|
+
// src/chat/conversations/sql/privacy.ts
|
|
3189
|
+
import { eq } from "drizzle-orm";
|
|
3190
|
+
import { alias } from "drizzle-orm/pg-core";
|
|
3191
|
+
var privacyRoot = alias(juniorConversations, "privacy_root");
|
|
3192
|
+
async function readRootCandidate(executor, conversationId) {
|
|
3193
|
+
const rows = await executor.db().select({
|
|
3194
|
+
requestedConversationId: juniorConversations.conversationId,
|
|
3195
|
+
requestedParentConversationId: juniorConversations.parentConversationId,
|
|
3196
|
+
requestedRootConversationId: juniorConversations.rootConversationId,
|
|
3197
|
+
rootConversationId: privacyRoot.conversationId,
|
|
3198
|
+
rootDestinationId: privacyRoot.destinationId,
|
|
3199
|
+
rootParentConversationId: privacyRoot.parentConversationId,
|
|
3200
|
+
rootRootConversationId: privacyRoot.rootConversationId
|
|
3201
|
+
}).from(juniorConversations).leftJoin(
|
|
3202
|
+
privacyRoot,
|
|
3203
|
+
eq(privacyRoot.conversationId, juniorConversations.rootConversationId)
|
|
3204
|
+
).where(eq(juniorConversations.conversationId, conversationId));
|
|
3205
|
+
const row = rows[0];
|
|
3206
|
+
return row?.requestedRootConversationId !== null && (row?.requestedParentConversationId !== null || row?.requestedRootConversationId === row?.requestedConversationId) && row?.rootConversationId === row.requestedRootConversationId && row.rootRootConversationId === row.rootConversationId && row.rootParentConversationId === null && row.rootDestinationId !== null ? {
|
|
3207
|
+
destinationId: row.rootDestinationId,
|
|
3208
|
+
rootConversationId: row.rootConversationId
|
|
3209
|
+
} : void 0;
|
|
3210
|
+
}
|
|
3211
|
+
async function readCandidateVisibility(executor, candidate) {
|
|
3212
|
+
const destinations = await executor.db().select({ visibility: juniorDestinations.visibility }).from(juniorDestinations).where(eq(juniorDestinations.id, candidate.destinationId)).for("share");
|
|
3213
|
+
return {
|
|
3214
|
+
rootConversationId: candidate.rootConversationId,
|
|
3215
|
+
visibility: destinations[0]?.visibility ?? null
|
|
3216
|
+
};
|
|
3217
|
+
}
|
|
3218
|
+
async function resolveRootVisibility(executor, conversationId) {
|
|
3219
|
+
const candidate = await readRootCandidate(executor, conversationId);
|
|
3220
|
+
if (!candidate) {
|
|
3221
|
+
return { rootConversationId: conversationId, visibility: null };
|
|
3222
|
+
}
|
|
3223
|
+
return readCandidateVisibility(executor, candidate);
|
|
3224
|
+
}
|
|
3225
|
+
|
|
3226
|
+
// src/chat/conversations/sql/purge.ts
|
|
3188
3227
|
async function discoverConversationTree(executor, root) {
|
|
3189
3228
|
const all = /* @__PURE__ */ new Map([
|
|
3190
3229
|
[root.conversationId, root]
|
|
@@ -3253,7 +3292,7 @@ async function selectExpiredRoots(executor, args) {
|
|
|
3253
3292
|
visibility: juniorDestinations.visibility
|
|
3254
3293
|
}).from(juniorConversations).leftJoin(
|
|
3255
3294
|
juniorDestinations,
|
|
3256
|
-
|
|
3295
|
+
eq2(juniorDestinations.id, juniorConversations.destinationId)
|
|
3257
3296
|
).where(
|
|
3258
3297
|
and(
|
|
3259
3298
|
isNull(juniorConversations.parentConversationId),
|
|
@@ -3274,7 +3313,7 @@ async function purgeConversationTree(executor, args) {
|
|
|
3274
3313
|
const initialRoots = await executor.db().select({
|
|
3275
3314
|
conversationId: juniorConversations.conversationId,
|
|
3276
3315
|
parentConversationId: juniorConversations.parentConversationId
|
|
3277
|
-
}).from(juniorConversations).where(
|
|
3316
|
+
}).from(juniorConversations).where(eq2(juniorConversations.conversationId, args.rootConversationId));
|
|
3278
3317
|
const initialRoot = initialRoots[0];
|
|
3279
3318
|
if (!initialRoot || args.retention && initialRoot.parentConversationId !== null) {
|
|
3280
3319
|
return { purged: false, conversations: 0 };
|
|
@@ -3296,14 +3335,14 @@ async function purgeConversationTree(executor, args) {
|
|
|
3296
3335
|
destinationId: juniorConversations.destinationId,
|
|
3297
3336
|
parentConversationId: juniorConversations.parentConversationId
|
|
3298
3337
|
}).from(juniorConversations).where(
|
|
3299
|
-
|
|
3338
|
+
eq2(juniorConversations.conversationId, args.rootConversationId)
|
|
3300
3339
|
).for("update");
|
|
3301
3340
|
const root = roots[0];
|
|
3302
3341
|
if (!root || args.retention && root.parentConversationId !== null) {
|
|
3303
3342
|
return { purged: false, conversations: 0 };
|
|
3304
3343
|
}
|
|
3305
3344
|
const resolvedScrubMetadata = args.scrubMetadataFromRootVisibility ? (await resolveRootVisibility(executor, args.rootConversationId)).visibility !== "public" : args.scrubMetadata;
|
|
3306
|
-
const destinations = root.destinationId ? await executor.db().select({ visibility: juniorDestinations.visibility }).from(juniorDestinations).where(
|
|
3345
|
+
const destinations = root.destinationId ? await executor.db().select({ visibility: juniorDestinations.visibility }).from(juniorDestinations).where(eq2(juniorDestinations.id, root.destinationId)).for("share") : [];
|
|
3307
3346
|
const isPublic = destinations[0]?.visibility === "public";
|
|
3308
3347
|
const ids = tree.map((conversation) => conversation.conversationId);
|
|
3309
3348
|
if (args.retention) {
|
|
@@ -7894,21 +7933,6 @@ import {
|
|
|
7894
7933
|
registerDevConsumer
|
|
7895
7934
|
} from "@vercel/queue";
|
|
7896
7935
|
|
|
7897
|
-
// src/chat/task-execution/queue.ts
|
|
7898
|
-
var ConversationQueueMessageRejectedError = class extends Error {
|
|
7899
|
-
conversationId;
|
|
7900
|
-
reason;
|
|
7901
|
-
constructor(reason, message, options = {}) {
|
|
7902
|
-
super(message);
|
|
7903
|
-
this.name = "ConversationQueueMessageRejectedError";
|
|
7904
|
-
this.reason = reason;
|
|
7905
|
-
this.conversationId = options.conversationId;
|
|
7906
|
-
}
|
|
7907
|
-
};
|
|
7908
|
-
function isConversationQueueMessageRejectedError(error) {
|
|
7909
|
-
return error instanceof ConversationQueueMessageRejectedError;
|
|
7910
|
-
}
|
|
7911
|
-
|
|
7912
7936
|
// src/chat/task-execution/worker.ts
|
|
7913
7937
|
var CONVERSATION_WORK_DEFER_DELAY_MS = 15e3;
|
|
7914
7938
|
var CONVERSATION_WORK_SOFT_YIELD_AFTER_MS = 24e4;
|
|
@@ -8045,10 +8069,10 @@ async function processConversationWork(message, options) {
|
|
|
8045
8069
|
}
|
|
8046
8070
|
return { status: "no_work" };
|
|
8047
8071
|
}
|
|
8048
|
-
if (!initial.destination
|
|
8072
|
+
if (!initial.destination) {
|
|
8049
8073
|
throw new ConversationQueueMessageRejectedError(
|
|
8050
|
-
"
|
|
8051
|
-
`Conversation work
|
|
8074
|
+
"invalid_record",
|
|
8075
|
+
`Conversation work is missing destination context for ${conversationId}`,
|
|
8052
8076
|
{ conversationId }
|
|
8053
8077
|
);
|
|
8054
8078
|
}
|
|
@@ -8400,18 +8424,11 @@ async function processConversationWork(message, options) {
|
|
|
8400
8424
|
var CONVERSATION_WORK_VISIBILITY_TIMEOUT_BUFFER_SECONDS = 30;
|
|
8401
8425
|
var CONVERSATION_WORK_DEV_CONSUMER_GROUP = "junior_conversation_work_dev";
|
|
8402
8426
|
function parseConversationQueueMessage(message) {
|
|
8403
|
-
const
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
if (!message || typeof message !== "object" || typeof message.conversationId !== "string" || !message.conversationId.trim() || !destination) {
|
|
8407
|
-
throw new Error(
|
|
8408
|
-
"Conversation queue message is missing destination context"
|
|
8409
|
-
);
|
|
8427
|
+
const parsed = conversationQueueMessageSchema.safeParse(message);
|
|
8428
|
+
if (!parsed.success) {
|
|
8429
|
+
throw new Error("Conversation queue message is malformed");
|
|
8410
8430
|
}
|
|
8411
|
-
return
|
|
8412
|
-
conversationId: message.conversationId,
|
|
8413
|
-
destination
|
|
8414
|
-
};
|
|
8431
|
+
return parsed.data;
|
|
8415
8432
|
}
|
|
8416
8433
|
function resolveConversationWorkVisibilityTimeoutSeconds(functionMaxDurationSeconds = getChatConfig().functionMaxDurationSeconds) {
|
|
8417
8434
|
return functionMaxDurationSeconds + CONVERSATION_WORK_VISIBILITY_TIMEOUT_BUFFER_SECONDS;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
pluginCatalogRuntime
|
|
3
|
+
} from "./chunk-3TV7OEHL.js";
|
|
4
|
+
import "./chunk-Y3H2DN6F.js";
|
|
5
|
+
import "./chunk-C4MZ3GP5.js";
|
|
6
|
+
import "./chunk-IYKPU7H6.js";
|
|
7
|
+
import "./chunk-42WRQLJ6.js";
|
|
8
|
+
import "./chunk-6GWA276C.js";
|
|
9
|
+
import "./chunk-B3IT5END.js";
|
|
10
|
+
import "./chunk-3V7OFJZC.js";
|
|
11
|
+
import "./chunk-W75ZPAGG.js";
|
|
12
|
+
import "./chunk-ZKIOWEFL.js";
|
|
13
|
+
import "./chunk-MLKGABMK.js";
|
|
14
|
+
export {
|
|
15
|
+
pluginCatalogRuntime
|
|
16
|
+
};
|
|
@@ -15,6 +15,7 @@ import type { AgentRunOutcome } from "@/chat/runtime/agent-run-outcome";
|
|
|
15
15
|
import type { AgentTurnSurface } from "@/chat/state/turn-session";
|
|
16
16
|
import type { Actor } from "@/chat/actor";
|
|
17
17
|
import { loadTurnSessionRecord, persistRunningSessionRecord } from "@/chat/services/turn-session-record";
|
|
18
|
+
import { type AuthorizationPauseError } from "@/chat/services/auth-pause";
|
|
18
19
|
import { type AgentTurnUsage } from "@/chat/usage";
|
|
19
20
|
import { type AgentRunDurability } from "@/chat/agent/request";
|
|
20
21
|
type LoadedSessionRecordState = Awaited<ReturnType<typeof loadTurnSessionRecord>>;
|
|
@@ -36,15 +37,14 @@ interface ResumeStateArgs {
|
|
|
36
37
|
startedAtMs: number;
|
|
37
38
|
surface: AgentTurnSurface;
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
40
|
+
type AuthPauseOutcome = Extract<AgentRunOutcome, {
|
|
41
|
+
status: "awaiting_auth";
|
|
42
|
+
}>;
|
|
42
43
|
/** Create the run's resume state: checkpoints, snapshots, and ending translation. */
|
|
43
44
|
export declare function createResumeState(args: ResumeStateArgs): {
|
|
44
45
|
readonly inputCommitted: boolean;
|
|
45
46
|
readonly beforeMessageCount: number;
|
|
46
47
|
readonly timedOut: boolean;
|
|
47
|
-
readonly cooperativeYieldError: CooperativeTurnYieldError | undefined;
|
|
48
48
|
setTurnStartMessageIndex(index: number | undefined): void;
|
|
49
49
|
setBeforeMessageCount(count: number): void;
|
|
50
50
|
/** Adopt an already committed epoch replacement as every resume baseline. */
|
|
@@ -55,16 +55,15 @@ export declare function createResumeState(args: ResumeStateArgs): {
|
|
|
55
55
|
commitInput(): Promise<void>;
|
|
56
56
|
persistSafeBoundary(messages: PiMessage[], trailingMessageProvenance?: ConversationMessageProvenance[]): Promise<boolean>;
|
|
57
57
|
requireDurableInputCheckpoint(messages: PiMessage[], trailingMessageProvenance?: ConversationMessageProvenance[]): Promise<boolean>;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
translateExpectedEnding(args2: {
|
|
58
|
+
/** Prepare a cooperative yield at the current durable boundary. */
|
|
59
|
+
prepareYieldIfDue(currentMessages: PiMessage[]): CooperativeTurnYieldError | undefined;
|
|
60
|
+
/** Persist an auth pause; only a durable pause may return `awaiting_auth`. */
|
|
61
|
+
parkForAuth(pause: AuthorizationPauseError, currentUsage?: AgentTurnUsage): Promise<AuthPauseOutcome>;
|
|
62
|
+
/** Persist a yield, retry, or timeout as a suspended run. */
|
|
63
|
+
translateSuspension(ending: {
|
|
65
64
|
currentUsage?: AgentTurnUsage;
|
|
66
65
|
error: unknown;
|
|
67
|
-
}): Promise<
|
|
66
|
+
}): Promise<AgentRunOutcome | undefined>;
|
|
68
67
|
};
|
|
69
68
|
export type ResumeState = ReturnType<typeof createResumeState>;
|
|
70
69
|
export {};
|
|
@@ -25,6 +25,7 @@ export declare const historyReplacementSchema: z.ZodObject<{
|
|
|
25
25
|
type: z.ZodLiteral<"handoff">;
|
|
26
26
|
modelProfile: z.ZodString;
|
|
27
27
|
modelId: z.ZodString;
|
|
28
|
+
reasoningLevel: z.ZodOptional<z.ZodString>;
|
|
28
29
|
triggeringToolCallId: z.ZodOptional<z.ZodString>;
|
|
29
30
|
replacementHistory: z.ZodArray<z.ZodObject<{
|
|
30
31
|
message: z.ZodPipe<z.ZodObject<{
|
|
@@ -237,6 +238,7 @@ export declare const conversationEventDataSchema: z.ZodUnion<readonly [z.ZodUnio
|
|
|
237
238
|
type: z.ZodLiteral<"handoff">;
|
|
238
239
|
modelProfile: z.ZodString;
|
|
239
240
|
modelId: z.ZodString;
|
|
241
|
+
reasoningLevel: z.ZodOptional<z.ZodString>;
|
|
240
242
|
triggeringToolCallId: z.ZodOptional<z.ZodString>;
|
|
241
243
|
replacementHistory: z.ZodArray<z.ZodObject<{
|
|
242
244
|
message: z.ZodPipe<z.ZodObject<{
|
|
@@ -479,6 +481,7 @@ export declare const conversationEventSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
479
481
|
type: z.ZodLiteral<"handoff">;
|
|
480
482
|
modelProfile: z.ZodString;
|
|
481
483
|
modelId: z.ZodString;
|
|
484
|
+
reasoningLevel: z.ZodOptional<z.ZodString>;
|
|
482
485
|
triggeringToolCallId: z.ZodOptional<z.ZodString>;
|
|
483
486
|
replacementHistory: z.ZodArray<z.ZodObject<{
|
|
484
487
|
message: z.ZodPipe<z.ZodObject<{
|
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
import type { JuniorSqlDatabase } from "@/db/db";
|
|
2
|
-
import { juniorConversationEvents } from "@/db/schema";
|
|
3
2
|
import type { JuniorDestinationVisibility } from "@/db/schema/destinations";
|
|
4
3
|
/** Root conversation identity and its normalized destination visibility. */
|
|
5
4
|
export interface RootConversationVisibility {
|
|
6
5
|
rootConversationId: string;
|
|
7
6
|
visibility: JuniorDestinationVisibility | null;
|
|
8
7
|
}
|
|
9
|
-
type ConversationEventPrivacySnapshot = RootConversationVisibility & {
|
|
10
|
-
events: Array<typeof juniorConversationEvents.$inferSelect>;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Read selected event rows and their root privacy authority in one SQL snapshot.
|
|
14
|
-
*/
|
|
15
|
-
export declare function readConversationEventPrivacySnapshot(executor: JuniorSqlDatabase, args: {
|
|
16
|
-
conversationId: string;
|
|
17
|
-
eventTypes: readonly string[];
|
|
18
|
-
}): Promise<ConversationEventPrivacySnapshot | undefined>;
|
|
19
8
|
/**
|
|
20
9
|
* Resolve a conversation's privacy authority from its persisted root.
|
|
21
10
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
11
|
+
* Missing or structurally invalid root metadata fails closed. The root
|
|
12
|
+
* destination is locked so callers that keep the transaction open receive a
|
|
13
|
+
* stable visibility decision.
|
|
25
14
|
*/
|
|
26
15
|
export declare function resolveRootVisibility(executor: JuniorSqlDatabase, conversationId: string): Promise<RootConversationVisibility>;
|
|
27
|
-
export {};
|
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
/** Permissive schema for durable Pi SDK messages whose content shape may evolve. */
|
|
3
3
|
export declare const piMessageSchema: z.ZodPipe<z.ZodObject<{
|
|
4
4
|
role: z.ZodString;
|
|
5
|
-
}, z.core.$loose>, z.ZodTransform<import("@earendil-works/pi-ai").AssistantMessage | import("@earendil-works/pi-ai").UserMessage | import("@earendil-works/pi-ai").ToolResultMessage<any> | import("@earendil-works/pi-agent-core").
|
|
5
|
+
}, z.core.$loose>, z.ZodTransform<import("@earendil-works/pi-ai").AssistantMessage | import("@earendil-works/pi-ai").UserMessage | import("@earendil-works/pi-ai").ToolResultMessage<any> | import("@earendil-works/pi-agent-core").CustomMessage<unknown> | import("@earendil-works/pi-agent-core").BashExecutionMessage | import("@earendil-works/pi-agent-core").BranchSummaryMessage | import("@earendil-works/pi-agent-core").CompactionSummaryMessage, {
|
|
6
6
|
[x: string]: unknown;
|
|
7
7
|
role: string;
|
|
8
8
|
}>>;
|
|
@@ -12,7 +12,7 @@ export type PiMessage = z.output<typeof piMessageSchema>;
|
|
|
12
12
|
export declare const piContentMessageSchema: z.ZodPipe<z.ZodObject<{
|
|
13
13
|
content: z.ZodArray<z.ZodUnknown>;
|
|
14
14
|
role: z.ZodString;
|
|
15
|
-
}, z.core.$loose>, z.ZodTransform<import("@earendil-works/pi-ai").AssistantMessage | import("@earendil-works/pi-ai").UserMessage | import("@earendil-works/pi-ai").ToolResultMessage<any> | import("@earendil-works/pi-agent-core").
|
|
15
|
+
}, z.core.$loose>, z.ZodTransform<import("@earendil-works/pi-ai").AssistantMessage | import("@earendil-works/pi-ai").UserMessage | import("@earendil-works/pi-ai").ToolResultMessage<any> | import("@earendil-works/pi-agent-core").CustomMessage<unknown> | import("@earendil-works/pi-agent-core").BashExecutionMessage | import("@earendil-works/pi-agent-core").BranchSummaryMessage | import("@earendil-works/pi-agent-core").CompactionSummaryMessage, {
|
|
16
16
|
[x: string]: unknown;
|
|
17
17
|
content: unknown[];
|
|
18
18
|
role: string;
|
|
@@ -4,7 +4,10 @@ import { type AgentTurnUsage } from "@/chat/usage";
|
|
|
4
4
|
* Aggregate real assistant calls by provider/model in SQL. Replayed history is
|
|
5
5
|
* not another call; its tokens appear in the next call's input usage.
|
|
6
6
|
*/
|
|
7
|
-
export declare function readConversationModelUsageFromSql(executor: JuniorSqlDatabase,
|
|
7
|
+
export declare function readConversationModelUsageFromSql(executor: JuniorSqlDatabase, options: {
|
|
8
|
+
conversationId: string;
|
|
9
|
+
includeDescendants?: boolean;
|
|
10
|
+
}): Promise<Array<{
|
|
8
11
|
modelId: string;
|
|
9
12
|
usage: AgentTurnUsage;
|
|
10
13
|
}>>;
|
|
@@ -12,6 +12,10 @@ export declare class AuthorizationPauseError extends Error {
|
|
|
12
12
|
readonly providerDisplayName: string;
|
|
13
13
|
constructor(kind: AuthorizationPauseKind, provider: string, providerDisplayName: string, disposition: AuthorizationPauseDisposition);
|
|
14
14
|
}
|
|
15
|
+
/** Error indicating an authorization pause could not be made durable. */
|
|
16
|
+
export declare class AuthPausePersistenceError extends Error {
|
|
17
|
+
constructor(conversationId: string, turnId: string, cause?: unknown);
|
|
18
|
+
}
|
|
15
19
|
/** Error indicating this turn cannot start an external authorization flow. */
|
|
16
20
|
export declare class AuthorizationFlowDisabledError extends Error {
|
|
17
21
|
readonly kind: AuthorizationPauseKind;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type ConversationQueueMessage } from "./queue";
|
|
3
3
|
export declare const CONVERSATION_WORK_QUEUE_SIGNATURE_MAX_SKEW_MS: number;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
declare const signedConversationQueueMessageSchema: z.ZodObject<{
|
|
5
|
+
conversationId: z.ZodString;
|
|
6
|
+
signature: z.ZodString;
|
|
7
|
+
signatureVersion: z.ZodLiteral<"v2">;
|
|
8
|
+
signedAtMs: z.ZodNumber;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
type SignedConversationQueueMessage = z.output<typeof signedConversationQueueMessageSchema>;
|
|
9
11
|
export type ConversationQueueMessageVerificationResult = {
|
|
10
12
|
message: ConversationQueueMessage;
|
|
11
13
|
status: "verified";
|
|
@@ -18,7 +20,7 @@ export type ConversationQueueMessageVerificationResult = {
|
|
|
18
20
|
};
|
|
19
21
|
/** Sign a conversation queue payload before it crosses the public callback route. */
|
|
20
22
|
export declare function signConversationQueueMessage(message: ConversationQueueMessage, nowMs?: number): SignedConversationQueueMessage;
|
|
21
|
-
/** Explain whether a queue payload is verified, rejected, or
|
|
23
|
+
/** Explain whether a queue payload is verified, rejected, or unavailable. */
|
|
22
24
|
export declare function verifyConversationQueueMessage(value: unknown, nowMs?: number): ConversationQueueMessageVerificationResult;
|
|
23
25
|
/** Verify a signed conversation queue payload from the Vercel Queue callback. */
|
|
24
26
|
export declare function verifySignedConversationQueueMessage(value: unknown, nowMs?: number): ConversationQueueMessage | undefined;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Validate the conversation work hint sent through Vercel Queue. */
|
|
3
|
+
export declare const conversationQueueMessageSchema: z.ZodObject<{
|
|
4
|
+
conversationId: z.ZodString;
|
|
5
|
+
}, z.core.$strict>;
|
|
6
|
+
/** Conversation work hint accepted by the queue callback and worker. */
|
|
7
|
+
export type ConversationQueueMessage = z.output<typeof conversationQueueMessageSchema>;
|
|
8
|
+
export type ConversationQueueMessageRejectReason = "expired" | "invalid_record" | "malformed" | "signature_mismatch";
|
|
7
9
|
export declare class ConversationQueueMessageRejectedError extends Error {
|
|
8
10
|
conversationId?: string;
|
|
9
11
|
reason: ConversationQueueMessageRejectReason;
|
|
@@ -11,7 +13,7 @@ export declare class ConversationQueueMessageRejectedError extends Error {
|
|
|
11
13
|
conversationId?: string;
|
|
12
14
|
});
|
|
13
15
|
}
|
|
14
|
-
/** Return whether
|
|
16
|
+
/** Return whether an error means the queue message was permanently rejected. */
|
|
15
17
|
export declare function isConversationQueueMessageRejectedError(error: unknown): error is ConversationQueueMessageRejectedError;
|
|
16
18
|
export interface ConversationQueueSendOptions {
|
|
17
19
|
delayMs?: number;
|
|
@@ -22,8 +22,8 @@ declare const slackConversationMessageMetadataSchema: z.ZodUnion<readonly [z.Zod
|
|
|
22
22
|
_type: z.ZodLiteral<"chat:Message">;
|
|
23
23
|
attachments: z.ZodArray<z.ZodObject<{
|
|
24
24
|
type: z.ZodEnum<{
|
|
25
|
-
image: "image";
|
|
26
25
|
file: "file";
|
|
26
|
+
image: "image";
|
|
27
27
|
audio: "audio";
|
|
28
28
|
video: "video";
|
|
29
29
|
}>;
|
|
@@ -72,16 +72,16 @@ declare const slackConversationMessageMetadataSchema: z.ZodUnion<readonly [z.Zod
|
|
|
72
72
|
channelId: z.ZodString;
|
|
73
73
|
channelVisibility: z.ZodOptional<z.ZodEnum<{
|
|
74
74
|
unknown: "unknown";
|
|
75
|
-
private: "private";
|
|
76
75
|
external: "external";
|
|
76
|
+
private: "private";
|
|
77
77
|
workspace: "workspace";
|
|
78
78
|
}>>;
|
|
79
79
|
currentMessage: z.ZodOptional<z.ZodObject<{
|
|
80
80
|
_type: z.ZodLiteral<"chat:Message">;
|
|
81
81
|
attachments: z.ZodArray<z.ZodObject<{
|
|
82
82
|
type: z.ZodEnum<{
|
|
83
|
-
image: "image";
|
|
84
83
|
file: "file";
|
|
84
|
+
image: "image";
|
|
85
85
|
audio: "audio";
|
|
86
86
|
video: "video";
|
|
87
87
|
}>;
|
|
@@ -132,8 +132,8 @@ declare const slackConversationMessageMetadataSchema: z.ZodUnion<readonly [z.Zod
|
|
|
132
132
|
_type: z.ZodLiteral<"chat:Message">;
|
|
133
133
|
attachments: z.ZodArray<z.ZodObject<{
|
|
134
134
|
type: z.ZodEnum<{
|
|
135
|
-
image: "image";
|
|
136
135
|
file: "file";
|
|
136
|
+
image: "image";
|
|
137
137
|
audio: "audio";
|
|
138
138
|
video: "video";
|
|
139
139
|
}>;
|
|
@@ -182,16 +182,16 @@ declare const slackConversationMessageMetadataSchema: z.ZodUnion<readonly [z.Zod
|
|
|
182
182
|
channelId: z.ZodString;
|
|
183
183
|
channelVisibility: z.ZodOptional<z.ZodEnum<{
|
|
184
184
|
unknown: "unknown";
|
|
185
|
-
private: "private";
|
|
186
185
|
external: "external";
|
|
186
|
+
private: "private";
|
|
187
187
|
workspace: "workspace";
|
|
188
188
|
}>>;
|
|
189
189
|
currentMessage: z.ZodOptional<z.ZodObject<{
|
|
190
190
|
_type: z.ZodLiteral<"chat:Message">;
|
|
191
191
|
attachments: z.ZodArray<z.ZodObject<{
|
|
192
192
|
type: z.ZodEnum<{
|
|
193
|
-
image: "image";
|
|
194
193
|
file: "file";
|
|
194
|
+
image: "image";
|
|
195
195
|
audio: "audio";
|
|
196
196
|
video: "video";
|
|
197
197
|
}>;
|