@sentry/junior 0.204.0 → 0.206.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.
Files changed (66) hide show
  1. package/dist/{agent-CMyTD4DD.js → agent-C9yuiZUF.js} +277 -85
  2. package/dist/{agent-hooks-Bbcp9e33.js → agent-hooks-DNjlz2A-.js} +1084 -16
  3. package/dist/{agent-runner-DNb1A49M.js → agent-runner-E67lFrDG.js} +5 -5
  4. package/dist/api/schema.d.ts +85 -0
  5. package/dist/api/schema.js +2 -2
  6. package/dist/api.js +44 -511
  7. package/dist/{app-B1TOqBI8.d.ts → app-AxGmJHwK.d.ts} +8 -0
  8. package/dist/app.d.ts +1 -1
  9. package/dist/app.js +56 -84
  10. package/dist/{auth-pause-state-DosEalIG.js → auth-pause-state-MVZ6xvEK.js} +6 -6
  11. package/dist/briefs-CvJFQvhJ.js +398 -0
  12. package/dist/{catalog-runtime-BReos-D4.js → catalog-runtime-TBR8n4e1.js} +1 -1
  13. package/dist/{checkpoint-CNrPyRJN.js → checkpoint-BY47jJCB.js} +7 -6
  14. package/dist/cli/chat.js +14 -12
  15. package/dist/cli/check.js +3 -3
  16. package/dist/cli/init.js +1 -0
  17. package/dist/cli/main.js +5 -1
  18. package/dist/cli/plugins.js +3 -3
  19. package/dist/cli/run.d.ts +2 -1
  20. package/dist/cli/run.js +2 -1
  21. package/dist/cli/snapshot-create.js +3 -3
  22. package/dist/cli/upgrade.js +3 -3
  23. package/dist/{config-nGCW1OTG.js → client-ceE7NtvC.js} +4 -367
  24. package/dist/config-CIE83sR2.js +386 -0
  25. package/dist/{schema-Rn8-XEaN.js → conversation-AA4R1VUn.js} +580 -558
  26. package/dist/{conversation-privacy-B4voFRSm.js → conversation-privacy-Auyq26XQ.js} +1 -1
  27. package/dist/{credential-sync-kXr1hvO1.js → credential-sync-BO33aNQd.js} +22 -20
  28. package/dist/{execution-stats-DWfSihcH.js → execution-stats-SiS2FLcv.js} +4 -4
  29. package/dist/{executor-DcMSlI5c.js → executor-BfbYPW63.js} +31 -3
  30. package/dist/instrumentation.js +2 -2
  31. package/dist/{job-queue-Drn_LXlM.js → job-queue-CyTc24Es.js} +1 -1
  32. package/dist/{logging-BzAk1S_s.js → logging-D37bayDc.js} +1 -1
  33. package/dist/nitro.d.ts +1 -1
  34. package/dist/nitro.js +3 -3
  35. package/dist/{oauth-callback-server-JiftokvA.js → oauth-callback-server-BtfOeHTZ.js} +2 -2
  36. package/dist/{pending-auth-CWmSdZVg.js → pending-auth-BPUzcs7n.js} +2 -2
  37. package/dist/{profile-CrT5nXbw.js → profile-CSixooTi.js} +4 -3
  38. package/dist/prompt-3gqNY1Ka.js +552 -0
  39. package/dist/{registry-DH1xUo2N.js → registry-DiR0-xRg.js} +1 -1
  40. package/dist/{resolve-CZHnfxaS.js → resolve-Bn5q__9b.js} +2 -2
  41. package/dist/{runner-CZV2sC46.js → runner-DFx3dIJH.js} +9 -9
  42. package/dist/{sandbox-egress-signals-bHZfmhbd.js → sandbox-egress-signals-bwvjihxA.js} +1 -1
  43. package/dist/schema-8GXFfclK.js +559 -0
  44. package/dist/{skills-CIcDQSgM.js → skills-BhM5qyCF.js} +2 -2
  45. package/dist/{spawn-DdkUFRmq.js → spawn-Dk0PqdH6.js} +2 -2
  46. package/dist/{stats-DTUbAb88.js → stats-DKRP4rsY.js} +26 -12
  47. package/dist/{task-queue-CJIR4RF7.js → task-queue-CdpTvu4R.js} +3 -3
  48. package/dist/{task-runner-D-O3A-Cp.js → task-runner-alpjVSxQ.js} +10 -10
  49. package/dist/{thread-state-CRc9jTJS.js → thread-state-CRK7aA41.js} +5 -5
  50. package/dist/{turn-execution-BkinIdJF.js → turn-execution-XtyzIHog.js} +3 -3
  51. package/dist/{turn-lifecycle-DQV19VTW.js → turn-lifecycle-VbwZLfBv.js} +1 -1
  52. package/dist/{usage-D3EbSO7w.js → usage-D4A48Bdl.js} +4 -125
  53. package/dist/{validation-C2CR-OX3.js → validation-jn_46o4U.js} +1 -1
  54. package/dist/{version-DxcWdoKa.js → version-DcfJxB4z.js} +1 -1
  55. package/dist/version.js +1 -1
  56. package/dist/web-authorization-CsfLSfEs.js +38 -0
  57. package/dist/{web-input-3EPfpf55.js → web-input-BPp_sc7t.js} +6 -6
  58. package/dist/{work-fGofI7Op.js → work-Di-ubSGg.js} +9 -9
  59. package/dist/{worker-CsOLq-mR.js → worker-Cu_D5Mr8.js} +5 -4
  60. package/migrations/0040_conversation_briefs.sql +17 -0
  61. package/migrations/meta/0040_snapshot.json +3516 -0
  62. package/migrations/meta/_journal.json +7 -0
  63. package/package.json +4 -4
  64. package/dist/history-CqTuSAdI.js +0 -441
  65. package/dist/usage-schema-CKaDkH_j.js +0 -20
  66. package/dist/web-authorization-RMBxAR_t.js +0 -76
@@ -1,12 +1,12 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
2
  import { _ as parseSlackMessageTs, r as credentialSubjectSchema } from "./context-B45_WqVX.js";
3
- import { Et as getDb, Tt as getConversationStore, Y as readActorIdentity, _t as createPluginLogger, gt as createPluginModel, ht as createPluginEmbedder, mt as createPluginState, u as getPlugins, ut as JUNIOR_THREAD_STATE_TTL_MS, vt as createPluginConversationEvents } from "./agent-hooks-Bbcp9e33.js";
4
- import { f as sameActorIdentity } from "./history-CqTuSAdI.js";
5
- import { Dt as isToolResultError, Ot as isToolResultMessage, Q as hydrateConversationMessages, bt as getPiMessageRole, jt as stripRuntimeTurnContext, kt as normalizeToolNameFromResult, s as getTurnRecord, wt as instructionTextForProjection } from "./checkpoint-CNrPyRJN.js";
6
- import { w as getStateAdapter } from "./profile-CrT5nXbw.js";
7
- import { u as recordTaskExecution } from "./execution-stats-DWfSihcH.js";
8
- import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-CRc9jTJS.js";
9
- import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-CJIR4RF7.js";
3
+ import { Ft as getConversationStore, It as getDb, Q as readActorIdentity, _t as createPluginState, bt as createPluginLogger, p as coreTaskRegistrations, pt as JUNIOR_THREAD_STATE_TTL_MS, u as getPlugins, vt as createPluginEmbedder, xt as createPluginConversationEvents, yt as createPluginModel } from "./agent-hooks-DNjlz2A-.js";
4
+ import { K as sameActorIdentity } from "./conversation-AA4R1VUn.js";
5
+ import { Dt as isToolResultError, Ot as isToolResultMessage, Q as hydrateConversationMessages, bt as getPiMessageRole, jt as stripRuntimeTurnContext, kt as normalizeToolNameFromResult, s as getTurnRecord, wt as instructionTextForProjection } from "./checkpoint-BY47jJCB.js";
6
+ import { w as getStateAdapter } from "./profile-CSixooTi.js";
7
+ import { u as recordTaskExecution } from "./execution-stats-SiS2FLcv.js";
8
+ import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-CRK7aA41.js";
9
+ import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-CdpTvu4R.js";
10
10
  import { z } from "zod";
11
11
  import { createHash } from "node:crypto";
12
12
  import { destinationSchema, destinationVisibilitySchema, isSlackDestination, pluginRunContextSchema, replyAttributionSchema, sourceSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
@@ -345,7 +345,7 @@ function slackSourceForDestination(args) {
345
345
  * Reads parent Conversations when this Conversation has no Destination.
346
346
  */
347
347
  async function resolveConversationRouting(args) {
348
- const conversationStore = args.conversationStore ?? (await import("./agent-hooks-Bbcp9e33.js").then((n) => n.St)).getConversationStore();
348
+ const conversationStore = args.conversationStore ?? (await import("./agent-hooks-DNjlz2A-.js").then((n) => n.Mt)).getConversationStore();
349
349
  const chain = await loadConversationChain(args.conversationId, conversationStore);
350
350
  let destination;
351
351
  let source;
@@ -600,7 +600,7 @@ function taskPluginContext(plugin, message, options = {}) {
600
600
  };
601
601
  }
602
602
  function findPluginTask(message) {
603
- const plugin = getPlugins().find((candidate) => candidate.manifest.name === message.plugin);
603
+ const plugin = [...coreTaskRegistrations(), ...getPlugins()].find((candidate) => candidate.manifest.name === message.plugin);
604
604
  if (!plugin?.tasks || !Object.hasOwn(plugin.tasks, message.name)) return;
605
605
  return {
606
606
  plugin,
@@ -610,7 +610,7 @@ function findPluginTask(message) {
610
610
  /** Schedule all plugin tasks interested in a completed agent-run session. */
611
611
  async function scheduleSessionCompletedPluginTasks(params, options = {}) {
612
612
  const coreParams = pluginTaskParamsSchema.parse(params);
613
- const taskRegistrations = getPlugins().flatMap((plugin) => Object.keys(plugin.tasks ?? {}).map((name) => ({
613
+ const taskRegistrations = [...getPlugins(), ...coreTaskRegistrations()].flatMap((plugin) => Object.keys(plugin.tasks ?? {}).map((name) => ({
614
614
  name,
615
615
  plugin
616
616
  })));
@@ -1,9 +1,9 @@
1
- import { F as isRecord, I as toOptionalNumber, L as toOptionalString } from "./logging-BzAk1S_s.js";
2
- import { Et as getDb, ut as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-Bbcp9e33.js";
1
+ import { F as isRecord, I as toOptionalNumber, L as toOptionalString } from "./logging-D37bayDc.js";
2
+ import { It as getDb, pt as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-DNjlz2A-.js";
3
3
  import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
4
- import { u as juniorLocationConfigurations } from "./executor-DcMSlI5c.js";
5
- import { $ as persistConversationMessages } from "./checkpoint-CNrPyRJN.js";
6
- import { w as getStateAdapter } from "./profile-CrT5nXbw.js";
4
+ import { u as juniorLocationConfigurations } from "./executor-BfbYPW63.js";
5
+ import { $ as persistConversationMessages } from "./checkpoint-BY47jJCB.js";
6
+ import { w as getStateAdapter } from "./profile-CSixooTi.js";
7
7
  import { z } from "zod";
8
8
  import { randomUUID } from "node:crypto";
9
9
  import { and, eq, sql } from "drizzle-orm";
@@ -1,6 +1,6 @@
1
- import { Ct as getConversationEventStore } from "./agent-hooks-Bbcp9e33.js";
2
- import { n as runAgentWithTimeout } from "./agent-runner-DNb1A49M.js";
3
- import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-DQV19VTW.js";
1
+ import { Nt as getConversationEventStore } from "./agent-hooks-DNjlz2A-.js";
2
+ import { n as runAgentWithTimeout } from "./agent-runner-E67lFrDG.js";
3
+ import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-VbwZLfBv.js";
4
4
  //#region src/chat/runtime/turn-execution.ts
5
5
  /** An error thrown while the agent advances a Run. */
6
6
  var AgentRunError = class extends Error {
@@ -1,4 +1,4 @@
1
- import { Ct as getConversationEventStore } from "./agent-hooks-Bbcp9e33.js";
1
+ import { Nt as getConversationEventStore } from "./agent-hooks-DNjlz2A-.js";
2
2
  //#region src/chat/conversations/turn-lifecycle.ts
3
3
  /** Persist correlated turn lifecycle facts with retry-safe terminal exclusion. */
4
4
  var ConversationTurnLifecycleService = class {
@@ -1,127 +1,6 @@
1
- import { n as botConfig } from "./config-nGCW1OTG.js";
2
- import { f as logWarn } from "./logging-BzAk1S_s.js";
3
- import { t as usageSchema } from "./usage-schema-CKaDkH_j.js";
4
- import { z } from "zod";
5
- import { conversationEventPresentationSchema, defineConversationEvent } from "@sentry/junior-plugin-api";
6
- //#region src/chat/conversations/structured-events.ts
7
- /** Reserved namespace for Junior-owned conversation metadata events. */
8
- const JUNIOR_NATIVE_EVENT_NAMESPACE = "junior";
9
- const authenticationEventContentSchema = z.object({
10
- accountLabel: z.string().trim().min(1).max(120).optional(),
11
- actorId: z.string().min(1),
12
- authorizationId: z.string().min(1).optional(),
13
- provider: z.string().regex(/^[a-z][a-z0-9-]*$/),
14
- providerLabel: z.string().trim().min(1).max(80).optional()
15
- }).strict();
16
- const agentsInstructionsUpdatedContentSchema = z.object({
17
- action: z.enum([
18
- "loaded",
19
- "replaced",
20
- "cleared"
21
- ]),
22
- directory: z.string().trim().min(1).max(500).optional(),
23
- fingerprint: z.string().trim().min(1).max(128),
24
- sources: z.array(z.object({
25
- content: z.string().min(1).max(32768),
26
- path: z.string().trim().min(1).max(500)
27
- }).strict()).max(32),
28
- textBytes: z.number().int().nonnegative().optional()
29
- }).strict();
30
- function providerTitle(content) {
31
- return content.providerLabel?.trim() || content.provider;
32
- }
33
- function agentsInstructionsTitle(action) {
34
- if (action === "loaded") return "Loaded AGENTS.md";
35
- if (action === "replaced") return "Updated AGENTS.md";
36
- return "Cleared AGENTS.md";
37
- }
38
- function sourceFilename(sourcePath) {
39
- return sourcePath.split("/").at(-1) || sourcePath;
40
- }
41
- function formatBytes(bytes) {
42
- if (bytes < 1024) return `${bytes} bytes`;
43
- const kilobytes = bytes / 1024;
44
- return `${Number.isInteger(kilobytes) ? kilobytes : kilobytes.toFixed(1)} KB`;
45
- }
46
- function agentsInstructionsPreview(content) {
47
- const source = content.sources[0];
48
- if (!source) return void 0;
49
- const filename = sourceFilename(source.path);
50
- const label = content.sources.length === 1 ? filename : `${content.sources.length} AGENTS.md files`;
51
- return typeof content.textBytes === "number" ? `${label} · ${formatBytes(content.textBytes)}` : label;
52
- }
53
- /** Junior-owned account-link transcript event. */
54
- const authenticationLinkedEvent = defineConversationEvent({
55
- name: "authentication_linked",
56
- version: 1,
57
- schema: authenticationEventContentSchema,
58
- renderEvent(event) {
59
- const provider = providerTitle(event);
60
- return {
61
- icon: "link",
62
- title: `${provider} connected`,
63
- ...event.accountLabel ? { preview: `Connected as \`${event.accountLabel}\`` } : void 0,
64
- details: [{
65
- title: `${provider} connected`,
66
- ...event.accountLabel ? { description: `Connected as \`${event.accountLabel}\`` } : void 0,
67
- metadata: [event.provider]
68
- }]
69
- };
70
- }
71
- });
72
- /** Junior-owned account-unlink transcript event. */
73
- const authenticationUnlinkedEvent = defineConversationEvent({
74
- name: "authentication_unlinked",
75
- version: 1,
76
- schema: authenticationEventContentSchema,
77
- renderEvent(event) {
78
- const provider = providerTitle(event);
79
- return {
80
- icon: "key",
81
- title: `${provider} disconnected`,
82
- details: [{
83
- title: `${provider} disconnected`,
84
- metadata: [event.provider]
85
- }]
86
- };
87
- }
88
- });
89
- /** Junior-owned AGENTS.md bootstrap transition for the dashboard timeline. */
90
- const agentsInstructionsUpdatedEvent = defineConversationEvent({
91
- name: "agents_instructions_updated",
92
- version: 1,
93
- schema: agentsInstructionsUpdatedContentSchema,
94
- renderEvent(event) {
95
- const title = agentsInstructionsTitle(event.action);
96
- const preview = agentsInstructionsPreview(event);
97
- return {
98
- icon: "brain",
99
- title,
100
- ...preview ? { preview } : void 0,
101
- ...event.sources.length > 0 ? { details: event.sources.map((source) => ({
102
- title: sourceFilename(source.path),
103
- content: source.content
104
- })) } : void 0
105
- };
106
- }
107
- });
108
- const NATIVE_EVENT_DEFINITIONS = [
109
- authenticationLinkedEvent,
110
- authenticationUnlinkedEvent,
111
- agentsInstructionsUpdatedEvent
112
- ];
113
- /** Resolve a registered Junior-native conversation event definition. */
114
- function getJuniorNativeEventDefinition(args) {
115
- return NATIVE_EVENT_DEFINITIONS.find((definition) => definition.eventName === args.name && definition.version === args.version);
116
- }
117
- /** Render one Junior-native event through its active definition. */
118
- function renderJuniorNativeConversationEvent(args) {
119
- if (args.namespace !== "junior") return void 0;
120
- const definition = getJuniorNativeEventDefinition(args);
121
- if (!definition) return void 0;
122
- const presentation = definition.renderEvent(definition.parse(args.content));
123
- return presentation === void 0 ? void 0 : conversationEventPresentationSchema.parse(presentation);
124
- }
1
+ import { f as logWarn } from "./logging-D37bayDc.js";
2
+ import { n as botConfig } from "./config-CIE83sR2.js";
3
+ import { P as usageSchema } from "./conversation-AA4R1VUn.js";
125
4
  const TITLE_PROMPTS = {
126
5
  conversation: [
127
6
  "Generate a concise 5-8 word conversation title from the first user message below.",
@@ -293,4 +172,4 @@ function addAgentTurnUsage(...usages) {
293
172
  return hasAgentTurnUsage(result) ? result : void 0;
294
173
  }
295
174
  //#endregion
296
- export { hasAgentTurnUsage as a, generateShortTitle as c, agentsInstructionsUpdatedEvent as d, authenticationLinkedEvent as f, agentTurnUsageSchema as i, resolveTaskTitle as l, renderJuniorNativeConversationEvent as m, agentTurnCostUsd as n, ToolInputError as o, authenticationUnlinkedEvent as p, agentTurnTotalTokens as r, fallbackShortTitle as s, addAgentTurnUsage as t, JUNIOR_NATIVE_EVENT_NAMESPACE as u };
175
+ export { hasAgentTurnUsage as a, generateShortTitle as c, agentTurnUsageSchema as i, resolveTaskTitle as l, agentTurnCostUsd as n, ToolInputError as o, agentTurnTotalTokens as r, fallbackShortTitle as s, addAgentTurnUsage as t };
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime-BReos-D4.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-TBR8n4e1.js";
3
3
  import { isDeepStrictEqual } from "node:util";
4
4
  //#region src/chat/plugins/validation.ts
5
5
  var validation_exports = /* @__PURE__ */ __exportAll({
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.204.0";
2
+ var version = "0.206.0";
3
3
  //#endregion
4
4
  //#region src/version.ts
5
5
  /** Installed Junior package version, or `unknown` when package metadata is unavailable. */
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as JUNIOR_VERSION } from "./version-DxcWdoKa.js";
1
+ import { t as JUNIOR_VERSION } from "./version-DcfJxB4z.js";
2
2
  export { JUNIOR_VERSION };
@@ -0,0 +1,38 @@
1
+ import { w as getStateAdapter } from "./profile-CSixooTi.js";
2
+ import { randomUUID } from "node:crypto";
3
+ //#region src/chat/conversations/web-authorization.ts
4
+ const WEB_AUTHORIZATION_PREFIX = "junior:web_authorization:v1";
5
+ const WEB_AUTHORIZATION_TTL_MS = 864e5;
6
+ function authorizationKey(conversationId, actorId) {
7
+ return `${WEB_AUTHORIZATION_PREFIX}:${conversationId}:${actorId}`;
8
+ }
9
+ /** Build authorization delivery for one web turn. */
10
+ function createWebAuthorization(args) {
11
+ return {
12
+ createState: async () => randomUUID(),
13
+ deliver: async (request) => {
14
+ await getStateAdapter().set(authorizationKey(args.conversationId, args.actorId), JSON.stringify({
15
+ ...request,
16
+ ...args
17
+ }), WEB_AUTHORIZATION_TTL_MS);
18
+ }
19
+ };
20
+ }
21
+ /** Read the pending authorization request for one web actor. */
22
+ async function getWebAuthorization(args) {
23
+ const value = await getStateAdapter().get(authorizationKey(args.conversationId, args.actorId));
24
+ if (typeof value !== "string") return void 0;
25
+ try {
26
+ const parsed = JSON.parse(value);
27
+ if (parsed.actorId !== args.actorId || parsed.conversationId !== args.conversationId || typeof parsed.authorizationUrl !== "string" || typeof parsed.label !== "string" || typeof parsed.completionText !== "string") return;
28
+ return parsed;
29
+ } catch {
30
+ return;
31
+ }
32
+ }
33
+ /** Remove a web authorization request after the parked turn continues. */
34
+ async function deleteWebAuthorization(args) {
35
+ await getStateAdapter().delete(authorizationKey(args.conversationId, args.actorId));
36
+ }
37
+ //#endregion
38
+ export { deleteWebAuthorization as n, getWebAuthorization as r, createWebAuthorization as t };
@@ -1,11 +1,11 @@
1
- import { o as getSlackBotToken } from "./config-nGCW1OTG.js";
2
- import { f as logWarn } from "./logging-BzAk1S_s.js";
3
- import { t as canExposeConversationPayload } from "./conversation-privacy-B4voFRSm.js";
1
+ import { f as logWarn } from "./logging-D37bayDc.js";
2
+ import { t as canExposeConversationPayload } from "./conversation-privacy-Auyq26XQ.js";
3
+ import { s as getSlackBotToken } from "./config-CIE83sR2.js";
4
4
  import "./context-B45_WqVX.js";
5
- import { Et as getDb, Tt as getConversationStore, U as normalizeSlackConversationId } from "./agent-hooks-Bbcp9e33.js";
5
+ import { Ft as getConversationStore, It as getDb, K as normalizeSlackConversationId } from "./agent-hooks-DNjlz2A-.js";
6
6
  import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
7
- import { C as juniorConversations, T as juniorUsers, m as juniorConversationParticipants, w as juniorIdentities } from "./executor-DcMSlI5c.js";
8
- import { Gt as buildDeterministicTurnId, c as parseSlackThreadId, dt as appendAndEnqueueExclusiveInboundMessage, ft as appendAndEnqueueInboundMessage } from "./stats-DTUbAb88.js";
7
+ import { E as juniorUsers, T as juniorIdentities, m as juniorConversationParticipants, w as juniorConversations } from "./executor-BfbYPW63.js";
8
+ import { Kt as buildDeterministicTurnId, c as parseSlackThreadId, ft as appendAndEnqueueExclusiveInboundMessage, pt as appendAndEnqueueInboundMessage } from "./stats-DKRP4rsY.js";
9
9
  import { t as healthReportSchema } from "./reporting-schema-DosTN__Q.js";
10
10
  import { z } from "zod";
11
11
  import { createHash } from "node:crypto";
@@ -1,13 +1,13 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { A as createAgentInvocationSchema, M as AgentInvocationLimitError, O as agentBindingSchema, f as PluginCredentialFailureError, j as AgentInvocationBusyError, k as agentInvocationSchema, tt as AuthorizationFlowDisabledError } from "./agent-CMyTD4DD.js";
3
- import { Ct as getConversationEventStore, Dt as getSqlExecutor, Tt as getConversationStore } from "./agent-hooks-Bbcp9e33.js";
4
- import { f as juniorAgentBindings, p as juniorAgentInvocations } from "./executor-DcMSlI5c.js";
5
- import { B as openConversationProjection, o as failTurnRecord, r as saveTurnCheckpoint, s as getTurnRecord, xt as getTerminalAssistantMessages } from "./checkpoint-CNrPyRJN.js";
6
- import { ft as appendAndEnqueueInboundMessage } from "./stats-DTUbAb88.js";
7
- import { _ as isTurnInputCommitLostError, h as getConversationTurnBoundaryError, p as TurnInputCommitLostError, s as getAssistantReplyText } from "./pending-auth-CWmSdZVg.js";
8
- import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-DQV19VTW.js";
9
- import { n as executeTurn, t as AgentRunError } from "./turn-execution-BkinIdJF.js";
10
- import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState } from "./thread-state-CRc9jTJS.js";
2
+ import { A as createAgentInvocationSchema, M as AgentInvocationLimitError, O as agentBindingSchema, Q as AuthorizationFlowDisabledError, f as PluginCredentialFailureError, j as AgentInvocationBusyError, k as agentInvocationSchema } from "./agent-C9yuiZUF.js";
3
+ import { Ft as getConversationStore, Lt as getSqlExecutor, Nt as getConversationEventStore } from "./agent-hooks-DNjlz2A-.js";
4
+ import { f as juniorAgentBindings, p as juniorAgentInvocations } from "./executor-BfbYPW63.js";
5
+ import { B as openConversationProjection, o as failTurnRecord, r as saveTurnCheckpoint, s as getTurnRecord, xt as getTerminalAssistantMessages } from "./checkpoint-BY47jJCB.js";
6
+ import { pt as appendAndEnqueueInboundMessage } from "./stats-DKRP4rsY.js";
7
+ import { _ as isTurnInputCommitLostError, h as getConversationTurnBoundaryError, p as TurnInputCommitLostError, s as getAssistantReplyText } from "./pending-auth-BPUzcs7n.js";
8
+ import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-VbwZLfBv.js";
9
+ import { n as executeTurn, t as AgentRunError } from "./turn-execution-XtyzIHog.js";
10
+ import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState } from "./thread-state-CRK7aA41.js";
11
11
  import { z } from "zod";
12
12
  import { createHash } from "node:crypto";
13
13
  import { and, asc, count, eq, inArray } from "drizzle-orm";
@@ -1,9 +1,10 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { P as isProviderRetryError, i as getChatConfig } from "./config-nGCW1OTG.js";
3
- import { S as withLogContext, d as logInfo, f as logWarn, u as logException } from "./logging-BzAk1S_s.js";
4
- import { At as releaseConversationWork, Bt as isInvalidConversationRecordError, Ct as ensureConversationWake, Mt as requestAnotherSlice, Ot as recordAttemptFailure, Pt as startConversationWork, St as drainConversationMailbox, Tt as getConversationWorkState, bt as countPendingConversationMessages, gt as clearConsumedConversationWake, ht as checkInConversationWork, kt as recordConversationRetry, pt as beginConversationResume, ut as ackMessages, vt as completeConversationStop, xt as deadLetterAttempt, yt as completeConversationWork, zt as isFinalAttempt } from "./stats-DTUbAb88.js";
2
+ import { b as isProviderRetryError } from "./client-ceE7NtvC.js";
3
+ import { S as withLogContext, d as logInfo, f as logWarn, u as logException } from "./logging-D37bayDc.js";
4
+ import { a as getChatConfig } from "./config-CIE83sR2.js";
5
+ import { At as recordConversationRetry, Bt as isFinalAttempt, Ct as drainConversationMailbox, Et as getConversationWorkState, Ft as startConversationWork, Nt as requestAnotherSlice, St as deadLetterAttempt, Vt as isInvalidConversationRecordError, _t as clearConsumedConversationWake, bt as completeConversationWork, dt as ackMessages, gt as checkInConversationWork, jt as releaseConversationWork, kt as recordAttemptFailure, mt as beginConversationResume, wt as ensureConversationWake, xt as countPendingConversationMessages, yt as completeConversationStop } from "./stats-DKRP4rsY.js";
5
6
  import { c as ConversationQueueMessageRejectedError } from "./vercel-queue-DIkVcfK4.js";
6
- import { a as getTurnRequestDeadline } from "./job-queue-Drn_LXlM.js";
7
+ import { a as getTurnRequestDeadline } from "./job-queue-CyTc24Es.js";
7
8
  //#region src/chat/task-execution/worker.ts
8
9
  var worker_exports = /* @__PURE__ */ __exportAll({
9
10
  CONVERSATION_WORK_DEFER_DELAY_MS: () => CONVERSATION_WORK_DEFER_DELAY_MS,
@@ -0,0 +1,17 @@
1
+ CREATE TABLE "junior_conversation_briefs" (
2
+ "conversation_id" text NOT NULL,
3
+ "version" integer NOT NULL,
4
+ "turn_id" text NOT NULL,
5
+ "through_seq" integer NOT NULL,
6
+ "content" jsonb NOT NULL,
7
+ "search_text" text NOT NULL,
8
+ "model_id" text NOT NULL,
9
+ "cost_usd" double precision,
10
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
11
+ CONSTRAINT "junior_conversation_briefs_conversation_id_version_pk" PRIMARY KEY("conversation_id","version")
12
+ );
13
+ --> statement-breakpoint
14
+ ALTER TABLE "junior_conversation_briefs" ADD CONSTRAINT "junior_conversation_briefs_conversation_id_junior_conversations_conversation_id_fk" FOREIGN KEY ("conversation_id") REFERENCES "public"."junior_conversations"("conversation_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
15
+ CREATE UNIQUE INDEX "junior_conversation_briefs_conversation_turn_idx" ON "junior_conversation_briefs" USING btree ("conversation_id","turn_id");--> statement-breakpoint
16
+ CREATE INDEX "junior_conversation_briefs_conversation_version_idx" ON "junior_conversation_briefs" USING btree ("conversation_id","version" DESC NULLS LAST);--> statement-breakpoint
17
+ CREATE INDEX "junior_conversation_briefs_search_idx" ON "junior_conversation_briefs" USING gin (to_tsvector('english', "search_text"));