@sentry/junior 0.256.0 → 0.258.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/{actor-BTtLaeWy.js → actor-tlxzqaRe.js} +3 -6
- package/dist/{admin-BhucwVfy.js → admin-My1SLGVO.js} +2 -3
- package/dist/{agent-hooks-DlSK8PQQ.js → agent-hooks-BJ_5mlRH.js} +71 -111
- package/dist/{agent-invocations-BY60iNw-.js → agent-invocations-Qfz7dWgU.js} +8 -13
- package/dist/{agent-runner-C6_cd61V.js → agent-runner-DGsFQw72.js} +278 -467
- package/dist/api/schema.d.ts +454 -448
- package/dist/api/schema.js +5 -5
- package/dist/api.d.ts +2 -12
- package/dist/api.js +189 -165
- package/dist/{app-B0gT1Slp.d.ts → app-PX2H1PxU.d.ts} +20 -37
- package/dist/app.d.ts +3 -3
- package/dist/app.js +565 -305
- package/dist/{assistant-reply-yn5G-YEG.js → assistant-reply-H1M-91oF.js} +3 -5
- package/dist/{automation-CHdlHVZP.js → automation-DWBFBenG.js} +6 -11
- package/dist/{briefs-U6Bi3IYw.js → briefs-vYoK85rJ.js} +8 -11
- package/dist/{cadence-D00SCzT1.js → cadence-R7Em4RjE.js} +1 -2
- package/dist/{catalog-runtime-DF5OWqCc.js → catalog-runtime-BN4DVxco.js} +3 -4
- package/dist/cli/chat.d.ts +2 -4
- package/dist/cli/chat.js +22 -24
- package/dist/cli/check.d.ts +1 -3
- package/dist/cli/check.js +4 -5
- package/dist/cli/env.d.ts +1 -3
- package/dist/cli/env.js +1 -2
- package/dist/cli/init.d.ts +1 -3
- package/dist/cli/init.js +3 -3
- package/dist/cli/main.d.ts +1 -3
- package/dist/cli/main.js +4 -5
- package/dist/cli/plugins.d.ts +2 -4
- package/dist/cli/plugins.js +7 -8
- package/dist/cli/run.d.ts +1 -2
- package/dist/cli/run.js +1 -2
- package/dist/cli/snapshot-create.d.ts +1 -3
- package/dist/cli/snapshot-create.js +4 -5
- package/dist/cli/upgrade.d.ts +3 -6
- package/dist/cli/upgrade.js +11 -17
- package/dist/{client-BVrAp-pq.js → client-DbyHuMFU.js} +9 -16
- package/dist/{config-DdBiDanf.js → config-_WO_AjCB.js} +18 -15
- package/dist/{connections-CG04HdpC.js → connections-ag_1JOhB.js} +21 -21
- package/dist/{conversation-T18Xlkx9.js → conversation-DjN3mlog.js} +11 -17
- package/dist/{conversation-privacy-CpSYOWnP.js → conversation-privacy-DHP_xnVj.js} +2 -3
- package/dist/{conversation-work-C6y3T5Hx.js → conversation-work-BaT_T6EB.js} +1 -2
- package/dist/{credential-sync-DKWNdcgm.js → credential-sync-B-CPX_ag.js} +89 -52
- package/dist/{db-Ca9Nt5ci.d.ts → db-BnRqQ7G5.d.ts} +1 -1
- package/dist/{executor-BroK9oKy.js → executor-RvG6kVe1.js} +58 -70
- package/dist/{experimental-Qn9rKLgx.js → experimental-BNK1l1jv.js} +2 -3
- package/dist/{history-9pO1Zd4Y.js → history-AY8rs-FR.js} +5 -9
- package/dist/{history-DvqWZlYX.d.ts → history-BgI33Kie.d.ts} +12 -20
- package/dist/{images-D0VZ5nv0.js → images-C2J_bj2g.js} +5 -6
- package/dist/instrumentation.d.ts +1 -3
- package/dist/instrumentation.js +6 -8
- package/dist/{job-queue-BbGg3gvu.js → job-queue-DVe37it2.js} +6 -12
- package/dist/{logging-tPQeUe2i.js → logging-DsHONhVm.js} +54 -24
- package/dist/{message-DdPGRYQP.js → message-DyitL8no.js} +5 -6
- package/dist/{model-profile-BwU8mqwD.js → model-profile-Bg8EoCKD.js} +2 -4
- package/dist/nitro.d.ts +3 -5
- package/dist/nitro.js +12 -17
- package/dist/{oauth-authorization-BA4Dt6a7.js → oauth-authorization-djQn5Nhy.js} +2 -4
- package/dist/{oauth-callback-server-B-2errCX.js → oauth-callback-server-CDby-pCn.js} +3 -4
- package/dist/{oauth-relay-CdCnu80W.js → oauth-relay-CTygMkNx.js} +2 -3
- package/dist/{package-discovery-BVvSnQBB.js → package-discovery-DJBompdd.js} +17 -21
- package/dist/{pending-auth-DT3MRVW8.js → pending-auth-D8J1uJUS.js} +37 -28
- package/dist/{plugin-module-CVvEUSMH.js → plugin-module-Cf5gVPWP.js} +1 -2
- package/dist/{plugins-CjfUP5gJ.d.ts → plugins-B11Mfkmv.d.ts} +0 -4
- package/dist/{plugins-egKWjgue.js → plugins-DOm9Y6qI.js} +2 -3
- package/dist/{private-trace-result-BLvBjy_e.js → private-trace-result-CE7_lEdq.js} +1 -2
- package/dist/{profile-Bb1zCVGP.js → profile-DpYjfKke.js} +16 -28
- package/dist/{prompt-C04mP1hu.js → prompt-xgpyMtg7.js} +5 -9
- package/dist/{queue-B5SnqRln.d.ts → queue-C37RbDVc.d.ts} +0 -2
- package/dist/{registry-CsNavQ_Z.js → registry-Du566MtJ.js} +57 -30
- package/dist/{resolve-B6ZZ9duG.js → resolve-ClCIgh8E.js} +7 -12
- package/dist/{result-j9nS0se-.js → result-BBbKA61B.js} +13 -17
- package/dist/{rolldown-runtime-B4FMCO8f.js → rolldown-runtime-nwUcYXjP.js} +1 -2
- package/dist/{runner-Y331DoZ5.js → runner-CCuqFSqx.js} +12 -13
- package/dist/{sandbox-egress-signals-BUfjEdHY.js → sandbox-egress-signals-DY1mbKF4.js} +2 -3
- package/dist/{schema-BBgv0MNf.js → schema-DrMh3NtR.js} +17 -27
- package/dist/{sentry-CgWZM_kV.js → sentry-BBUlHih9.js} +2 -3
- package/dist/{session-stop-q-6GNHx6.js → session-stop-CIoFiwwe.js} +57 -41
- package/dist/{skills-CyvTsR9M.js → skills-DyQBLIrK.js} +9 -9
- package/dist/{spawn-Do5mX3d_.js → spawn-Dqfeo7XP.js} +4 -5
- package/dist/{store-DoewL5mG.d.ts → store-CG0VJyye.d.ts} +0 -14
- package/dist/{store-D2It0ozF.js → store-DJLwq4x8.js} +13 -15
- package/dist/{task-queue-ZMk9bLRT.js → task-queue-BzW4MaWU.js} +5 -7
- package/dist/{task-runner-cIGU5VwJ.js → task-runner-D3qJh4fK.js} +22 -26
- package/dist/{tasks-CODtRzvX.js → tasks-CEXKTASS.js} +78 -79
- package/dist/{thread-state-BPkwVmvK.js → thread-state-W3f6kAtz.js} +13 -19
- package/dist/{turn-failure-response-ChmMeKar.js → turn-failure-response-CWx7aNIh.js} +16 -22
- package/dist/{turn-lifecycle-BUP7ZOVa.js → turn-lifecycle-C9JFst7-.js} +2 -3
- package/dist/{turn-session-routing-BcWM3PLm.js → turn-session-routing-CUxtfpr7.js} +2 -3
- package/dist/{validation-DCd69-cP.js → validation-BHRxa5G4.js} +3 -4
- package/dist/vercel.d.ts +1 -3
- package/dist/vercel.js +1 -2
- package/dist/{version-DBc4Qt_P.js → version-C0U6rHg0.js} +3 -5
- package/dist/{version-CnXZ614E.d.ts → version-Cc2OFd9G.d.ts} +0 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -2
- package/dist/{viewer-C-9nFKYr.js → viewer-CGvvRqKp.js} +61 -44
- package/dist/{web-input-Cv42P3ni.js → web-input-Keb5GRWj.js} +139 -198
- package/dist/{web-message-id-xPI_EFSC.js → web-message-id-CJSUiksE.js} +3 -6
- package/dist/{work-6UmVQq1V.js → work-DRcsJ3hV.js} +14 -16
- package/dist/{worker-DAoBZuZn.js → worker-Cjo-QqPq.js} +7 -8
- package/migrations/0059_automation_run_version.sql +2 -0
- package/migrations/0060_identity_signed_in_at.sql +1 -0
- package/migrations/meta/0059_snapshot.json +3619 -0
- package/migrations/meta/0060_snapshot.json +3465 -0
- package/migrations/meta/_journal.json +15 -1
- package/package.json +8 -6
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { r as AGENT_INVOCATION_STATUSES, u as juniorDestinationKindSchema } from "./agent-invocations-
|
|
2
|
-
import { D as conversationUsageSchema, E as conversationSummaryReportSchema, M as conversationChildAgentTotalsSchema, l as conversationAuxiliaryCostsSchema, n as actorIdentitySchema, w as conversationStatsItemSchema } from "./conversation-
|
|
3
|
-
import "./automation-
|
|
4
|
-
import { a as fillUtcHours, c as sumUtcHoursIntoSixHours, i as fillUtcDays } from "./web-message-id-
|
|
1
|
+
import { r as AGENT_INVOCATION_STATUSES, u as juniorDestinationKindSchema } from "./agent-invocations-Qfz7dWgU.js";
|
|
2
|
+
import { D as conversationUsageSchema, E as conversationSummaryReportSchema, M as conversationChildAgentTotalsSchema, l as conversationAuxiliaryCostsSchema, n as actorIdentitySchema, w as conversationStatsItemSchema } from "./conversation-DjN3mlog.js";
|
|
3
|
+
import "./automation-DWBFBenG.js";
|
|
4
|
+
import { a as fillUtcHours, c as sumUtcHoursIntoSixHours, i as fillUtcDays } from "./web-message-id-CJSUiksE.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { codeChangeStateSchema } from "@sentry/junior-plugin-api";
|
|
7
|
-
|
|
7
|
+
// src/api/schema/common.ts
|
|
8
8
|
/** Stable error body returned by Junior-owned REST endpoints. */
|
|
9
9
|
const apiErrorSchema = z.object({ error: z.string().min(1) }).strict();
|
|
10
|
-
|
|
11
|
-
//#region src/api/schema/conversation-stop.ts
|
|
10
|
+
// src/api/schema/conversation-stop.ts
|
|
12
11
|
/** One queued web message from the viewer that a stop removed. */
|
|
13
12
|
const stoppedConversationMessageSchema = z.object({
|
|
14
13
|
inboundMessageId: z.string().min(1),
|
|
@@ -27,8 +26,7 @@ const stopConversationTurnResponseSchema = z.object({
|
|
|
27
26
|
stoppedInboundMessageIds: z.array(z.string().min(1)),
|
|
28
27
|
stoppedMessages: z.array(stoppedConversationMessageSchema)
|
|
29
28
|
}).strict();
|
|
30
|
-
|
|
31
|
-
//#region src/api/schema/child-agent.ts
|
|
29
|
+
// src/api/schema/child-agent.ts
|
|
32
30
|
/**
|
|
33
31
|
* One direct child agent of a Conversation, from agent invocation records.
|
|
34
32
|
*
|
|
@@ -64,8 +62,7 @@ const conversationChildAgentsReportSchema = z.object({
|
|
|
64
62
|
agents: z.array(conversationChildAgentSchema),
|
|
65
63
|
conversationId: z.string().min(1)
|
|
66
64
|
}).strict();
|
|
67
|
-
|
|
68
|
-
//#region src/api/schema/code.ts
|
|
65
|
+
// src/api/schema/code.ts
|
|
69
66
|
const codeChangeSummarySchema = z.object({
|
|
70
67
|
closed: z.number().int().nonnegative(),
|
|
71
68
|
costUsd: z.number().nonnegative().optional(),
|
|
@@ -141,18 +138,18 @@ const codeRepositoryReportSchema = z.object({
|
|
|
141
138
|
name: z.string().min(1)
|
|
142
139
|
}).strict())
|
|
143
140
|
}).strict();
|
|
144
|
-
/** Person-scoped code activity for one People profile. */
|
|
141
|
+
/** Person-scoped code activity and recent code changes for one People profile. */
|
|
145
142
|
const codePersonReportSchema = z.object({
|
|
146
143
|
activityDays: z.array(codeActivityDaySchema),
|
|
147
144
|
activityHours: z.array(codeActivityDaySchema).optional(),
|
|
148
145
|
activitySixHours: z.array(codeActivityDaySchema).optional(),
|
|
146
|
+
changes: z.array(codeChangeSummaryReportSchema),
|
|
149
147
|
generatedAt: z.string(),
|
|
150
148
|
summary: codeChangeSummarySchema,
|
|
151
149
|
windowEnd: z.string(),
|
|
152
150
|
windowStart: z.string()
|
|
153
151
|
}).strict();
|
|
154
|
-
|
|
155
|
-
//#region src/api/schema/connection.ts
|
|
152
|
+
// src/api/schema/connection.ts
|
|
156
153
|
const connectionSchema = z.object({
|
|
157
154
|
provider: z.string(),
|
|
158
155
|
displayName: z.string(),
|
|
@@ -167,8 +164,7 @@ const connectionListSchema = z.object({ connections: z.array(connectionSchema) }
|
|
|
167
164
|
const connectionParamsSchema = z.object({ provider: z.string().regex(/^[a-z][a-z0-9-]*$/).max(64) }).strict();
|
|
168
165
|
const startConnectionResponseSchema = z.object({ authorizationUrl: z.string().url() }).strict();
|
|
169
166
|
const disconnectConnectionResponseSchema = z.object({ disconnected: z.literal(true) }).strict();
|
|
170
|
-
|
|
171
|
-
//#region src/api/activity.ts
|
|
167
|
+
// src/api/activity.ts
|
|
172
168
|
const dailyConversationActivitySchema = z.object({
|
|
173
169
|
active: z.number(),
|
|
174
170
|
conversations: z.number(),
|
|
@@ -220,8 +216,7 @@ function activitySixHours(hours, nowMs) {
|
|
|
220
216
|
nowMs
|
|
221
217
|
});
|
|
222
218
|
}
|
|
223
|
-
|
|
224
|
-
//#region src/api/schema/location.ts
|
|
219
|
+
// src/api/schema/location.ts
|
|
225
220
|
const locationParamsSchema = z.object({ locationId: z.string().min(1) }).strict();
|
|
226
221
|
const locationSummaryReportSchema = conversationStatsItemSchema.extend({
|
|
227
222
|
id: z.string(),
|
|
@@ -262,8 +257,7 @@ const locationDetailReportSchema = locationSummaryReportSchema.extend({
|
|
|
262
257
|
windowEnd: z.string(),
|
|
263
258
|
windowStart: z.string()
|
|
264
259
|
}).strict();
|
|
265
|
-
|
|
266
|
-
//#region src/api/schema/person.ts
|
|
260
|
+
// src/api/schema/person.ts
|
|
267
261
|
const personParamsSchema = z.object({ email: z.string().trim().min(1) }).strict();
|
|
268
262
|
const peopleConversationStatsItemSchema = conversationStatsItemSchema.omit({ costUsd: true });
|
|
269
263
|
/** UTC day (`YYYY-MM-DD`) or hour (`YYYY-MM-DDTHH`) activity bucket key. */
|
|
@@ -343,8 +337,7 @@ const personalSpendReportSchema = z.object({
|
|
|
343
337
|
windowEnd: z.string(),
|
|
344
338
|
windowStart: z.string()
|
|
345
339
|
}).strict();
|
|
346
|
-
|
|
347
|
-
//#region src/api/schema/personal-token.ts
|
|
340
|
+
// src/api/schema/personal-token.ts
|
|
348
341
|
const personalTokenMetadataSchema = z.object({
|
|
349
342
|
id: z.string().uuid(),
|
|
350
343
|
name: z.string(),
|
|
@@ -358,8 +351,7 @@ const createPersonalTokenBodySchema = z.object({ name: z.string().trim().min(1).
|
|
|
358
351
|
const createdPersonalTokenSchema = personalTokenMetadataSchema.extend({ token: z.string().startsWith("jr_pat_") }).strict();
|
|
359
352
|
const personalTokenParamsSchema = z.object({ id: z.string().uuid() }).strict();
|
|
360
353
|
const revokePersonalTokenResponseSchema = z.object({ revoked: z.literal(true) }).strict();
|
|
361
|
-
|
|
362
|
-
//#region src/api/schema/workspace.ts
|
|
354
|
+
// src/api/schema/workspace.ts
|
|
363
355
|
const workspaceRepoInputSchema = z.object({
|
|
364
356
|
provider: z.string(),
|
|
365
357
|
repo: z.string()
|
|
@@ -400,8 +392,7 @@ const workspaceBodySchema = z.object({
|
|
|
400
392
|
}).strict();
|
|
401
393
|
const workspaceParamsSchema = z.object({ id: z.string().uuid() }).strict();
|
|
402
394
|
const deleteWorkspaceResponseSchema = z.object({ deleted: z.literal(true) }).strict();
|
|
403
|
-
|
|
404
|
-
//#region src/api/schema/stats.ts
|
|
395
|
+
// src/api/schema/stats.ts
|
|
405
396
|
const statSchema = z.object({
|
|
406
397
|
count: z.number().int().nonnegative(),
|
|
407
398
|
date: z.string(),
|
|
@@ -415,5 +406,4 @@ const statsReportSchema = z.object({
|
|
|
415
406
|
windowEnd: z.string(),
|
|
416
407
|
windowStart: z.string()
|
|
417
408
|
}).strict();
|
|
418
|
-
//#endregion
|
|
419
409
|
export { connectionSchema as A, codeRepositorySummarySchema as B, locationParamsSchema as C, dailyConversationActivitySchema as D, activitySixHours as E, codeChangeSummarySchema as F, conversationChildAgentsReportSchema as H, codeOverviewReportSchema as I, codePersonReportSchema as L, startConnectionResponseSchema as M, codeActivityDaySchema as N, connectionListSchema as O, codeChangeSummaryReportSchema as P, codeRepositoryParamsSchema as R, locationDirectoryReportSchema as S, activityHours as T, stopConversationTurnResponseSchema as U, conversationChildAgentSchema as V, apiErrorSchema as W, actorProfileReportSchema as _, workspaceBodySchema as a, locationActivityDayReportSchema as b, workspaceRepoSchema as c, createdPersonalTokenSchema as d, personalTokenListSchema as f, actorDirectoryReportSchema as g, revokePersonalTokenResponseSchema as h, deleteWorkspaceResponseSchema as i, disconnectConnectionResponseSchema as j, connectionParamsSchema as k, workspaceSchema as l, personalTokenParamsSchema as m, statsReportSchema as n, workspaceListSchema as o, personalTokenMetadataSchema as p, baselineSnapshotSchema as r, workspaceParamsSchema as s, statSchema as t, createPersonalTokenBodySchema as u, personParamsSchema as v, activityDays as w, locationDetailReportSchema as x, personalSpendReportSchema as y, codeRepositoryReportSchema as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
2
|
import { captureException, captureMessage, continueTrace, flush, getActiveSpan, getClient, getGlobalScope, getTraceData, init, logger, setTag, setUser, spanToJSON, startInactiveSpan, startSpan, startSpanManual, vercelAIIntegration, withActiveSpan, withScope, withStreamedSpan } from "@sentry/node";
|
|
3
|
-
|
|
3
|
+
// src/chat/sentry.ts
|
|
4
4
|
var sentry_exports = /* @__PURE__ */ __exportAll({
|
|
5
5
|
captureException: () => captureException,
|
|
6
6
|
captureMessage: () => captureMessage,
|
|
@@ -23,5 +23,4 @@ var sentry_exports = /* @__PURE__ */ __exportAll({
|
|
|
23
23
|
withScope: () => withScope,
|
|
24
24
|
withStreamedSpan: () => withStreamedSpan
|
|
25
25
|
});
|
|
26
|
-
//#endregion
|
|
27
26
|
export { vercelAIIntegration as _, getClient as a, withStreamedSpan as b, init as c, setTag as d, setUser as f, startSpanManual as g, startSpan as h, getActiveSpan as i, logger as l, startInactiveSpan as m, captureMessage as n, getGlobalScope as o, spanToJSON as p, continueTrace as r, getTraceData as s, captureException as t, sentry_exports as u, withActiveSpan as v, withScope as y };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import {
|
|
3
|
-
import { n as botConfig } from "./config-
|
|
4
|
-
import { f as getSqlExecutor, u as getConversationStore } from "./viewer-
|
|
5
|
-
import { s as juniorConversations } from "./agent-invocations-
|
|
6
|
-
import "./executor-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { it as JUNIOR_THREAD_STATE_TTL_MS, rt as verifyTimerWatchCredentialSubject, u as getPlugins } from "./agent-hooks-
|
|
10
|
-
import { w as getStateAdapter } from "./profile-
|
|
11
|
-
import { r as sanitizeAssistantText } from "./assistant-reply-
|
|
12
|
-
import { r as EVENT_AUTHOR_ID } from "./prompt-
|
|
13
|
-
import { r as appendAndEnqueueInboundMessage } from "./store-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
+
import { f as logException, m as logWarn, p as logInfo } from "./logging-DsHONhVm.js";
|
|
3
|
+
import { n as botConfig } from "./config-_WO_AjCB.js";
|
|
4
|
+
import { f as getSqlExecutor, u as getConversationStore } from "./viewer-CGvvRqKp.js";
|
|
5
|
+
import { s as juniorConversations } from "./agent-invocations-Qfz7dWgU.js";
|
|
6
|
+
import "./executor-RvG6kVe1.js";
|
|
7
|
+
import { h as credentialSubjectSchema } from "./registry-Du566MtJ.js";
|
|
8
|
+
import { B as postSlackMessage, Ct as ToolInputError, _t as isToolResultMessage, gt as isToolResultError, mt as isAssistantMessage, vt as normalizeToolNameFromResult } from "./tasks-CEXKTASS.js";
|
|
9
|
+
import { it as JUNIOR_THREAD_STATE_TTL_MS, rt as verifyTimerWatchCredentialSubject, u as getPlugins } from "./agent-hooks-BJ_5mlRH.js";
|
|
10
|
+
import { w as getStateAdapter } from "./profile-DpYjfKke.js";
|
|
11
|
+
import { r as sanitizeAssistantText } from "./assistant-reply-H1M-91oF.js";
|
|
12
|
+
import { r as EVENT_AUTHOR_ID } from "./prompt-xgpyMtg7.js";
|
|
13
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-DJLwq4x8.js";
|
|
14
14
|
import { z } from "zod";
|
|
15
15
|
import { eq, inArray } from "drizzle-orm";
|
|
16
|
-
import { eventMatchSchema, normalizeEventIdentifier, objectTypeSchema } from "@sentry/junior-plugin-api";
|
|
17
|
-
|
|
16
|
+
import { eventMatchFieldsSchema, eventMatchSchema, normalizeEventIdentifier, objectTypeSchema } from "@sentry/junior-plugin-api";
|
|
17
|
+
// src/chat/automation-result.ts
|
|
18
18
|
/**
|
|
19
19
|
* Automation run result.
|
|
20
20
|
*
|
|
@@ -104,8 +104,7 @@ function remindMissingAutomationResult(messages) {
|
|
|
104
104
|
timestamp: Date.now()
|
|
105
105
|
}];
|
|
106
106
|
}
|
|
107
|
-
|
|
108
|
-
//#region src/chat/services/automated-turn-limit.ts
|
|
107
|
+
// src/chat/services/automated-turn-limit.ts
|
|
109
108
|
const AUTOMATED_TURN_LIMIT_PREFIX = "junior:automated_turn_limit:v1";
|
|
110
109
|
const AUTOMATED_TURN_LIMIT_LOCK_TTL_MS = 5e3;
|
|
111
110
|
const AUTOMATED_TURN_LIMIT_LOCK_WAIT_MS = 2e3;
|
|
@@ -272,8 +271,7 @@ async function recordFinishedTurnForAutomatedLimit(args) {
|
|
|
272
271
|
state: args.state
|
|
273
272
|
});
|
|
274
273
|
}
|
|
275
|
-
|
|
276
|
-
//#region src/chat/slack/automated-turn-limit-notice.ts
|
|
274
|
+
// src/chat/slack/automated-turn-limit-notice.ts
|
|
277
275
|
/**
|
|
278
276
|
* Pause notice for the consecutive automated-turn limit.
|
|
279
277
|
*
|
|
@@ -328,8 +326,7 @@ async function maybePostAutomatedTurnLimitNotice(args) {
|
|
|
328
326
|
threadTs: args.threadTs
|
|
329
327
|
});
|
|
330
328
|
}
|
|
331
|
-
|
|
332
|
-
//#region src/chat/task-input.ts
|
|
329
|
+
// src/chat/task-input.ts
|
|
333
330
|
/**
|
|
334
331
|
* Shared closing lines. Automations pass outcomes and end with a declared
|
|
335
332
|
* result. Watches pass no outcomes and reply in the Conversation.
|
|
@@ -376,8 +373,7 @@ function renderTaskInput(args) {
|
|
|
376
373
|
lines.push("", ...replyContractLines(args.outcomes));
|
|
377
374
|
return lines.join("\n");
|
|
378
375
|
}
|
|
379
|
-
|
|
380
|
-
//#region src/chat/events/catalog.ts
|
|
376
|
+
// src/chat/events/catalog.ts
|
|
381
377
|
/** Core-owned event namespace. Not a plugin publisher. */
|
|
382
378
|
const CORE_EVENT_NAMESPACE = "junior";
|
|
383
379
|
/** True when the catalog has any enabled registration. */
|
|
@@ -468,8 +464,7 @@ function requireEventIdentifier(catalog, input) {
|
|
|
468
464
|
const fitting = resourceTypes.filter(fits).map((candidate) => candidate.type);
|
|
469
465
|
throw new ToolInputError([`Identifier "${identifier}" does not fit resourceType "${input.resourceType}" in namespace "${input.namespace}". Expected format: "${resourceType.identifier.format}".`, ...fitting.length > 0 ? [`If the identifier is correct, use one of these resourceType values: ${fitting.map((type) => `"${type}"`).join(", ")}.`] : []].join(" "));
|
|
470
466
|
}
|
|
471
|
-
|
|
472
|
-
//#region src/chat/sandbox/snapshot/events.ts
|
|
467
|
+
// src/chat/sandbox/snapshot/events.ts
|
|
473
468
|
const WORKSPACE_SNAPSHOT_NAMESPACE = CORE_EVENT_NAMESPACE;
|
|
474
469
|
const WORKSPACE_SNAPSHOT_RESOURCE_TYPE = "workspace_snapshot";
|
|
475
470
|
const WORKSPACE_SNAPSHOT_READY_EVENT = "workspace_snapshot.ready";
|
|
@@ -523,8 +518,14 @@ function workspaceSnapshotFinishedEvent(input) {
|
|
|
523
518
|
if (input.status === "failed" && input.error) event.untrustedText = input.error;
|
|
524
519
|
return event;
|
|
525
520
|
}
|
|
526
|
-
|
|
527
|
-
|
|
521
|
+
// src/chat/slack/channel-message-events.ts
|
|
522
|
+
/**
|
|
523
|
+
* Slack channel-message Events for Event automations.
|
|
524
|
+
*
|
|
525
|
+
* Core publishes these Events from Slack ingress, so the `slack` namespace is
|
|
526
|
+
* core owned, like `junior`. Anyone in the channel writes the Event text, so an
|
|
527
|
+
* automation can watch only its own channel and always uses system credentials.
|
|
528
|
+
*/
|
|
528
529
|
/** Core-owned event namespace for Slack Events. Not a plugin publisher. */
|
|
529
530
|
const SLACK_EVENT_NAMESPACE = "slack";
|
|
530
531
|
/** The trigger identifier that names the channel of the automation. */
|
|
@@ -532,6 +533,10 @@ const SLACK_CURRENT_CHANNEL_IDENTIFIER = "current_channel";
|
|
|
532
533
|
const CHANNEL_RESOURCE_TYPE = "channel";
|
|
533
534
|
const MESSAGE_POSTED_EVENT = "message.posted";
|
|
534
535
|
const CHANNEL_ID_PATTERN = /^[CG][A-Z0-9]{2,}$/;
|
|
536
|
+
const CHANNEL_MESSAGE_MATCH_FIELDS = eventMatchFieldsSchema.parse({ userId: {
|
|
537
|
+
kind: "string",
|
|
538
|
+
description: "Slack user ID of the message author. Required to run on bot posts, such as alert bots."
|
|
539
|
+
} });
|
|
535
540
|
/** Event registration for new top-level Slack channel messages. */
|
|
536
541
|
function slackChannelMessageEvents() {
|
|
537
542
|
return { resourceTypes: [{
|
|
@@ -542,7 +547,8 @@ function slackChannelMessageEvents() {
|
|
|
542
547
|
},
|
|
543
548
|
supportedEvents: [MESSAGE_POSTED_EVENT],
|
|
544
549
|
suggestedEvents: [],
|
|
545
|
-
|
|
550
|
+
matchFields: CHANNEL_MESSAGE_MATCH_FIELDS,
|
|
551
|
+
guidance: { [MESSAGE_POSTED_EVENT]: "A person or bot posted a new top-level message in this channel. A bot post runs the automation only when match names the bot in userId. A reply goes in that message's thread. If the instructions do not apply to this message, end with no action." }
|
|
546
552
|
}] };
|
|
547
553
|
}
|
|
548
554
|
/**
|
|
@@ -569,35 +575,48 @@ function requireSlackChannelMessageScope(automation) {
|
|
|
569
575
|
/**
|
|
570
576
|
* Build the Event for one new top-level channel message, or nothing.
|
|
571
577
|
*
|
|
572
|
-
* Thread replies and
|
|
573
|
-
*
|
|
578
|
+
* Thread replies and Slackbot posts do not count. Other bot posts are marked
|
|
579
|
+
* with `postedByBot`, so only automations that name the bot can run on them.
|
|
574
580
|
*/
|
|
575
581
|
function slackChannelMessageEvent(input) {
|
|
576
|
-
if (input.
|
|
582
|
+
if (input.userId === "USLACKBOT") return void 0;
|
|
577
583
|
if (input.threadTs && input.threadTs !== input.ts) return void 0;
|
|
578
584
|
if (!CHANNEL_ID_PATTERN.test(input.channelId)) return void 0;
|
|
585
|
+
const postedByBot = Boolean(input.botId || input.subtype === "bot_message");
|
|
579
586
|
return {
|
|
580
587
|
eventKey: `${input.channelId}:${input.ts}`,
|
|
581
588
|
eventType: MESSAGE_POSTED_EVENT,
|
|
582
589
|
identifier: input.channelId,
|
|
583
590
|
occurredAtMs: Math.floor(Number(input.ts) * 1e3),
|
|
584
|
-
trustedSummary:
|
|
591
|
+
trustedSummary: `${postedByBot ? "The bot " : ""}<@${input.userId}> posted a new message in <#${input.channelId}>.`,
|
|
585
592
|
data: {
|
|
586
593
|
channelId: input.channelId,
|
|
587
594
|
messageTs: input.ts,
|
|
588
|
-
userId: input.userId
|
|
595
|
+
userId: input.userId,
|
|
596
|
+
...postedByBot ? { postedByBot: true } : void 0
|
|
589
597
|
},
|
|
590
598
|
...input.text?.trim() ? { untrustedText: input.text } : void 0
|
|
591
599
|
};
|
|
592
600
|
}
|
|
601
|
+
/**
|
|
602
|
+
* Decide whether a channel-message Event may run one automation.
|
|
603
|
+
*
|
|
604
|
+
* A bot post runs only automations whose match names its author in `userId`.
|
|
605
|
+
* Bots can post often and would use up the run limit of every other
|
|
606
|
+
* automation in the channel.
|
|
607
|
+
*/
|
|
608
|
+
function slackChannelMessageRunsAutomation(event, automation) {
|
|
609
|
+
if (event.namespace !== "slack") return true;
|
|
610
|
+
if (event.data?.postedByBot !== true) return true;
|
|
611
|
+
return automation.trigger.match?.userId !== void 0;
|
|
612
|
+
}
|
|
593
613
|
/** Return the source message thread for a channel-message run. */
|
|
594
614
|
function slackChannelMessageReplyThreadTs(event) {
|
|
595
615
|
if (event.namespace !== "slack") return void 0;
|
|
596
616
|
const messageTs = event.data?.messageTs;
|
|
597
617
|
return typeof messageTs === "string" ? messageTs : void 0;
|
|
598
618
|
}
|
|
599
|
-
|
|
600
|
-
//#region src/chat/events/runtime-catalog.ts
|
|
619
|
+
// src/chat/events/runtime-catalog.ts
|
|
601
620
|
/**
|
|
602
621
|
* Enabled event registrations for search, guidance, and tool schemas.
|
|
603
622
|
*
|
|
@@ -622,8 +641,7 @@ function getEventCatalog() {
|
|
|
622
641
|
}
|
|
623
642
|
return catalog;
|
|
624
643
|
}
|
|
625
|
-
|
|
626
|
-
//#region src/chat/events/notification.ts
|
|
644
|
+
// src/chat/events/notification.ts
|
|
627
645
|
const EVENT_WAIT_MS = 3e4;
|
|
628
646
|
/**
|
|
629
647
|
* Render the runtime-owned conversation message for a subscribed event.
|
|
@@ -747,8 +765,7 @@ async function enqueueEventNotification(args) {
|
|
|
747
765
|
state: args.state
|
|
748
766
|
});
|
|
749
767
|
}
|
|
750
|
-
|
|
751
|
-
//#region src/chat/conversations/session-stop.ts
|
|
768
|
+
// src/chat/conversations/session-stop.ts
|
|
752
769
|
var session_stop_exports = /* @__PURE__ */ __exportAll({
|
|
753
770
|
getConversationStoppedAtMs: () => getConversationStoppedAtMs,
|
|
754
771
|
markConversationsStopped: () => markConversationsStopped,
|
|
@@ -781,5 +798,4 @@ async function skipInputBeforeConversationStop(context) {
|
|
|
781
798
|
await context.attempt.ack();
|
|
782
799
|
return { status: "completed" };
|
|
783
800
|
}
|
|
784
|
-
|
|
785
|
-
export { recordFinishedTurnForAutomatedLimit as A, registeredEventMatchSchema as C, requireSupportedEventMatch as D, requireEventIdentifier as E, finishedRunReply as F, readAutomationResult as I, remindMissingAutomationResult as L, FINISH_AUTOMATION_RUN_TOOL_NAME as M, automationResultSchema as N, renderTaskInput as O, deliversFinalText as P, runDispatchOutcome as R, pluginSupportsEvent as S, registeredResourceTypeSchema as T, workspaceSnapshotWatch as _, EVENT_WAIT_MS as a, eventNamespaceSchema as b, timerWatchCredentialSubject as c, requireSlackChannelMessageScope as d, slackChannelMessageEvent as f, workspaceSnapshotFinishedEvent as g, WORKSPACE_SNAPSHOT_READY_EVENT as h, skipInputBeforeConversationStop as i, resetAutomatedTurnLimit as j, maybePostAutomatedTurnLimitNotice as k, getEventCatalog as l, WORKSPACE_SNAPSHOT_FAILED_EVENT as m, markConversationsStopped as n, enqueueEventNotification as o, slackChannelMessageReplyThreadTs as p, session_stop_exports as r, isEventMailboxMetadata as s, getConversationStoppedAtMs as t, SLACK_EVENT_NAMESPACE as u, automationEventCatalog as v, registeredEventTypeSchema as w, hasEventCatalogEntries as x, eventGuidance as y };
|
|
801
|
+
export { maybePostAutomatedTurnLimitNotice as A, pluginSupportsEvent as C, requireEventIdentifier as D, registeredResourceTypeSchema as E, deliversFinalText as F, finishedRunReply as I, readAutomationResult as L, resetAutomatedTurnLimit as M, FINISH_AUTOMATION_RUN_TOOL_NAME as N, requireSupportedEventMatch as O, automationResultSchema as P, remindMissingAutomationResult as R, hasEventCatalogEntries as S, registeredEventTypeSchema as T, workspaceSnapshotFinishedEvent as _, EVENT_WAIT_MS as a, eventGuidance as b, timerWatchCredentialSubject as c, requireSlackChannelMessageScope as d, slackChannelMessageEvent as f, WORKSPACE_SNAPSHOT_READY_EVENT as g, WORKSPACE_SNAPSHOT_FAILED_EVENT as h, skipInputBeforeConversationStop as i, recordFinishedTurnForAutomatedLimit as j, renderTaskInput as k, getEventCatalog as l, slackChannelMessageRunsAutomation as m, markConversationsStopped as n, enqueueEventNotification as o, slackChannelMessageReplyThreadTs as p, session_stop_exports as r, isEventMailboxMetadata as s, getConversationStoppedAtMs as t, SLACK_EVENT_NAMESPACE as u, workspaceSnapshotWatch as v, registeredEventMatchSchema as w, eventNamespaceSchema as x, automationEventCatalog as y, runDispatchOutcome as z };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import {
|
|
3
|
-
import { s as skillRoots } from "./package-discovery-
|
|
4
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
+
import { m as logWarn } from "./logging-DsHONhVm.js";
|
|
3
|
+
import { s as skillRoots } from "./package-discovery-DJBompdd.js";
|
|
4
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BN4DVxco.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import fs from "node:fs/promises";
|
|
8
8
|
import { parse } from "yaml";
|
|
9
|
-
|
|
9
|
+
// src/chat/skills.ts
|
|
10
10
|
var skills_exports = /* @__PURE__ */ __exportAll({
|
|
11
11
|
discoverSkills: () => discoverSkills,
|
|
12
12
|
findSkillByName: () => findSkillByName,
|
|
@@ -82,7 +82,7 @@ function stripFrontmatter(raw) {
|
|
|
82
82
|
/** Parse a SKILL.md file's frontmatter and body. */
|
|
83
83
|
function parseSkillFile(raw, expectedName) {
|
|
84
84
|
const match = FRONTMATTER_RE.exec(raw);
|
|
85
|
-
if (
|
|
85
|
+
if (match?.[1] === void 0) return {
|
|
86
86
|
ok: false,
|
|
87
87
|
error: "Missing YAML frontmatter at start of file"
|
|
88
88
|
};
|
|
@@ -263,13 +263,14 @@ function parseSkillInvocation(messageText, availableSkills) {
|
|
|
263
263
|
const trimmed = messageText.trim();
|
|
264
264
|
const escapePattern = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
265
265
|
const slashMatch = /(?:^|\s)\/([a-z0-9]+(?:-[a-z0-9]+)*)/i.exec(trimmed);
|
|
266
|
-
if (slashMatch) {
|
|
266
|
+
if (slashMatch?.[1]) {
|
|
267
267
|
const skillName = slashMatch[1].toLowerCase();
|
|
268
268
|
if (!availableSkills.some((skill) => skill.name === skillName)) return null;
|
|
269
269
|
return { skillName };
|
|
270
270
|
}
|
|
271
271
|
for (const match of trimmed.matchAll(/(?:^|\s)\$([a-z0-9]+(?:-[a-z0-9]+)*)/gi)) {
|
|
272
|
-
const skillName = match[1]
|
|
272
|
+
const skillName = match[1]?.toLowerCase();
|
|
273
|
+
if (!skillName) continue;
|
|
273
274
|
if (isCommonEnvironmentVariable(skillName)) continue;
|
|
274
275
|
if (availableSkills.some((skill) => skill.name === skillName)) return { skillName };
|
|
275
276
|
}
|
|
@@ -312,5 +313,4 @@ async function loadSkillsByName(skillNames, available) {
|
|
|
312
313
|
}
|
|
313
314
|
return skills;
|
|
314
315
|
}
|
|
315
|
-
//#endregion
|
|
316
316
|
export { parseSkillInvocation as a, parseSkillFile as i, findSkillByName as n, skills_exports as o, loadSkillsByName as r, discoverSkills as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import { Ht as toolInvocationDestination, Vt as actorFromRun } from "./agent-runner-
|
|
3
|
-
import { n as createAndEnqueueAgentInvocation } from "./work-
|
|
4
|
-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
+
import { Ht as toolInvocationDestination, Vt as actorFromRun } from "./agent-runner-DGsFQw72.js";
|
|
3
|
+
import { n as createAndEnqueueAgentInvocation } from "./work-DRcsJ3hV.js";
|
|
4
|
+
// src/chat/agent-invocations/spawn.ts
|
|
5
5
|
var spawn_exports = /* @__PURE__ */ __exportAll({ bindSpawnAgent: () => bindSpawnAgent });
|
|
6
6
|
/** Bind a Run's Actor and credentials to new Agent invocations. */
|
|
7
7
|
function bindSpawnAgent(run, options) {
|
|
@@ -28,5 +28,4 @@ function bindSpawnAgent(run, options) {
|
|
|
28
28
|
})).childConversationId };
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
//#endregion
|
|
32
31
|
export { spawn_exports as n, bindSpawnAgent as t };
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { Destination, Source, locationSchema } from "@sentry/junior-plugin-api";
|
|
3
3
|
import "@earendil-works/pi-ai";
|
|
4
|
-
//#region src/chat/conversation-privacy.d.ts
|
|
5
4
|
type ConversationPrivacy = "public" | "private";
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/chat/conversations/location.d.ts
|
|
8
5
|
/** Validated Location associated with a Conversation. */
|
|
9
6
|
type Location = z.output<typeof locationSchema>;
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region src/chat/actor.d.ts
|
|
12
7
|
declare const storedSlackActorSchema: z.ZodObject<{
|
|
13
8
|
email: z.ZodOptional<z.ZodString>;
|
|
14
9
|
fullName: z.ZodOptional<z.ZodString>;
|
|
@@ -18,8 +13,6 @@ declare const storedSlackActorSchema: z.ZodObject<{
|
|
|
18
13
|
teamId: z.ZodOptional<z.ZodString>;
|
|
19
14
|
}, z.core.$strict>;
|
|
20
15
|
type StoredSlackActor = z.output<typeof storedSlackActorSchema>;
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/chat/source.d.ts
|
|
23
16
|
/** Legacy provider Source fields stored on a Conversation. */
|
|
24
17
|
type SessionSource = Extract<Source, {
|
|
25
18
|
kind: "web";
|
|
@@ -28,8 +21,6 @@ type SessionSource = Extract<Source, {
|
|
|
28
21
|
}> | Omit<Extract<Source, {
|
|
29
22
|
kind: "slack";
|
|
30
23
|
}>, "messageTs">;
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region src/usage-schema.d.ts
|
|
33
24
|
declare const usageSchema: z.ZodObject<{
|
|
34
25
|
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
35
26
|
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -46,8 +37,6 @@ declare const usageSchema: z.ZodObject<{
|
|
|
46
37
|
}, z.core.$strict>>;
|
|
47
38
|
}, z.core.$strict>;
|
|
48
39
|
type Usage = z.output<typeof usageSchema>;
|
|
49
|
-
//#endregion
|
|
50
|
-
//#region src/chat/usage.d.ts
|
|
51
40
|
/**
|
|
52
41
|
* Structured token and cost usage captured for a single agent turn.
|
|
53
42
|
*
|
|
@@ -57,8 +46,6 @@ type Usage = z.output<typeof usageSchema>;
|
|
|
57
46
|
* whether to display a breakdown or a single aggregate.
|
|
58
47
|
*/
|
|
59
48
|
type AgentTurnUsage = Usage;
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region src/chat/conversations/store.d.ts
|
|
62
49
|
type ConversationSource = "api" | "internal" | "local" | "plugin" | "event" | "scheduler" | "slack" | "web";
|
|
63
50
|
type ConversationStatus = "paused" | "failed" | "idle" | "pending" | "running";
|
|
64
51
|
interface ConversationExecution {
|
|
@@ -205,5 +192,4 @@ interface ConversationStore {
|
|
|
205
192
|
offset?: number;
|
|
206
193
|
}): Promise<Conversation[]>;
|
|
207
194
|
}
|
|
208
|
-
//#endregion
|
|
209
195
|
export { ConversationStore as t };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as getChatConfig } from "./config-
|
|
3
|
-
import { s as parseStoredSlackActor } from "./actor-
|
|
4
|
-
import {
|
|
5
|
-
import { it as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-
|
|
6
|
-
import { C as getDefaultRedisStateAdapterFor, w as getStateAdapter } from "./profile-
|
|
7
|
-
import "./job-queue-
|
|
1
|
+
import { B as toOptionalNumber, V as toOptionalString, z as isRecord } from "./logging-DsHONhVm.js";
|
|
2
|
+
import { i as getChatConfig } from "./config-_WO_AjCB.js";
|
|
3
|
+
import { s as parseStoredSlackActor } from "./actor-tlxzqaRe.js";
|
|
4
|
+
import { B as sameDestination, R as parseDestination, u as getConversationStore } from "./viewer-CGvvRqKp.js";
|
|
5
|
+
import { it as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-BJ_5mlRH.js";
|
|
6
|
+
import { C as getDefaultRedisStateAdapterFor, w as getStateAdapter } from "./profile-DpYjfKke.js";
|
|
7
|
+
import "./job-queue-DVe37it2.js";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
10
10
|
import { destinationSchema } from "@sentry/junior-plugin-api";
|
|
11
|
-
|
|
11
|
+
// src/chat/task-execution/state.ts
|
|
12
12
|
/**
|
|
13
13
|
* Expiring conversation mailbox and execution index store.
|
|
14
14
|
*
|
|
@@ -336,8 +336,8 @@ function uniqueIndexEntries(value) {
|
|
|
336
336
|
return [...entries.values()];
|
|
337
337
|
}
|
|
338
338
|
function retainedIndexEntries(indexKey, entries) {
|
|
339
|
-
if (indexKey ===
|
|
340
|
-
if (indexKey ===
|
|
339
|
+
if (indexKey === "junior:conversation:v2:by-activity") return entries.sort(compareIndexDescending).slice(0, CONVERSATION_ACTIVITY_INDEX_MAX_LENGTH);
|
|
340
|
+
if (indexKey === "junior:conversation:v2:active") return entries.sort(compareIndexAscending);
|
|
341
341
|
throw new Error(`Unknown conversation index ${indexKey}`);
|
|
342
342
|
}
|
|
343
343
|
function redisIndexKey(indexKey) {
|
|
@@ -402,7 +402,7 @@ function redisConversationIndexStore(client) {
|
|
|
402
402
|
},
|
|
403
403
|
async upsert(args) {
|
|
404
404
|
const key = redisIndexKey(args.indexKey);
|
|
405
|
-
if (args.indexKey ===
|
|
405
|
+
if (args.indexKey === "junior:conversation:v2:by-activity") {
|
|
406
406
|
await client.sendCommand([
|
|
407
407
|
"EVAL",
|
|
408
408
|
upsertBoundedActivityScript,
|
|
@@ -415,7 +415,7 @@ function redisConversationIndexStore(client) {
|
|
|
415
415
|
]);
|
|
416
416
|
return;
|
|
417
417
|
}
|
|
418
|
-
if (args.indexKey ===
|
|
418
|
+
if (args.indexKey === "junior:conversation:v2:active") {
|
|
419
419
|
await client.sendCommand([
|
|
420
420
|
"ZADD",
|
|
421
421
|
key,
|
|
@@ -1125,8 +1125,7 @@ async function listActiveConversationIds$1(args = {}) {
|
|
|
1125
1125
|
scoreMax: args.staleBeforeMs
|
|
1126
1126
|
})).map((entry) => entry.conversationId);
|
|
1127
1127
|
}
|
|
1128
|
-
|
|
1129
|
-
//#region src/chat/task-execution/store.ts
|
|
1128
|
+
// src/chat/task-execution/store.ts
|
|
1130
1129
|
function metadataStore(options) {
|
|
1131
1130
|
return options.conversationStore ?? getConversationStore();
|
|
1132
1131
|
}
|
|
@@ -1413,5 +1412,4 @@ async function removeActiveConversation(args) {
|
|
|
1413
1412
|
async function listActiveConversationIds(args = {}) {
|
|
1414
1413
|
return await listActiveConversationIds$1(args);
|
|
1415
1414
|
}
|
|
1416
|
-
//#endregion
|
|
1417
1415
|
export { hasRunnableConversationWork$1 as A, requestAnotherSlice as C, CONVERSATION_WORK_CHECK_IN_INTERVAL_MS as D, stopConversationWork as E, isInvalidConversationRecordError as M, CONVERSATION_WORK_STALE_ENQUEUE_MS as O, removeActiveConversation as S, startConversationWork as T, hasRunnableConversationWork as _, cancelHumanFacingPendingMessages as a, recordConversationRetry as b, clearExpiredConversationLease as c, countPendingConversationMessages as d, deadLetterAttempt as f, getConversationWorkState as g, getConversation as h, beginConversationResume as i, isFinalAttempt as j, hasConversationStop as k, completeConversationStop as l, ensureConversationWake as m, appendAndEnqueueExclusiveInboundMessage as n, checkInConversationWork as o, drainConversationMailbox as p, appendAndEnqueueInboundMessage as r, clearConsumedConversationWake as s, ackMessages as t, completeConversationWork as u, listActiveConversationIds as v, requestConversationWork as w, releaseConversationWork as x, recordAttemptFailure as y };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as QUEUE_SIGNATURE_MAX_AGE_MS, d as createVercelQueueClient, l as signQueueMessage, p as runWithTurnRequestDeadline, u as verifyQueueMessage } from "./job-queue-
|
|
1
|
+
import { m as logWarn } from "./logging-DsHONhVm.js";
|
|
2
|
+
import { c as QUEUE_SIGNATURE_MAX_AGE_MS, d as createVercelQueueClient, l as signQueueMessage, p as runWithTurnRequestDeadline, u as verifyQueueMessage } from "./job-queue-DVe37it2.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
import { handleCallback, registerDevConsumer } from "@vercel/queue";
|
|
6
|
-
|
|
6
|
+
// src/chat/queue/callback.ts
|
|
7
7
|
/** Shared Vercel Queue callback wiring for signed messages. */
|
|
8
8
|
/** Build the HTTP callback and local-dev consumer for one signed queue. */
|
|
9
9
|
function queueCallback(options) {
|
|
@@ -56,8 +56,7 @@ function queueCallback(options) {
|
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
//#region src/chat/plugins/task-queue.ts
|
|
59
|
+
// src/chat/plugins/task-queue.ts
|
|
61
60
|
/**
|
|
62
61
|
* Delivery for plugin-registered tasks.
|
|
63
62
|
*
|
|
@@ -115,7 +114,7 @@ function pluginTaskCallback() {
|
|
|
115
114
|
maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
|
|
116
115
|
onRejected: logPluginTaskQueueMessageRejected,
|
|
117
116
|
run: async (message) => {
|
|
118
|
-
const { processPluginTask } = await import("./task-runner-
|
|
117
|
+
const { processPluginTask } = await import("./task-runner-D3qJh4fK.js").then((n) => n.r);
|
|
119
118
|
await processPluginTask(message);
|
|
120
119
|
},
|
|
121
120
|
topic: PLUGIN_TASK_QUEUE_TOPIC,
|
|
@@ -137,5 +136,4 @@ function createVercelPluginTaskCallback() {
|
|
|
137
136
|
function registerVercelPluginTaskDevConsumer() {
|
|
138
137
|
return pluginTaskCallback().registerDev();
|
|
139
138
|
}
|
|
140
|
-
//#endregion
|
|
141
139
|
export { registerVercelPluginTaskDevConsumer as a, pluginTaskParamsSchema as i, createVercelPluginTaskCallback as n, sendVercelPluginTask as o, pluginTaskId as r, queueCallback as s, PLUGIN_TASK_QUEUE_TOPIC as t };
|