@sentry/junior 0.205.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.
- package/dist/{agent-D4nu8MQV.js → agent-C9yuiZUF.js} +247 -67
- package/dist/{agent-hooks-DXHpTJ4m.js → agent-hooks-DNjlz2A-.js} +1078 -12
- package/dist/{agent-runner-C04colea.js → agent-runner-E67lFrDG.js} +5 -5
- package/dist/api/schema.d.ts +77 -0
- package/dist/api/schema.js +2 -2
- package/dist/api.js +44 -511
- package/dist/{app-Cb776lL8.d.ts → app-AxGmJHwK.d.ts} +7 -0
- package/dist/app.d.ts +1 -1
- package/dist/app.js +50 -80
- package/dist/{auth-pause-state-C2P3guS1.js → auth-pause-state-MVZ6xvEK.js} +6 -6
- package/dist/briefs-CvJFQvhJ.js +398 -0
- package/dist/{catalog-runtime-CXw3asJD.js → catalog-runtime-TBR8n4e1.js} +1 -1
- package/dist/{checkpoint-CrViJ8Ps.js → checkpoint-BY47jJCB.js} +7 -6
- package/dist/cli/chat.js +14 -12
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +1 -0
- package/dist/cli/main.js +5 -1
- package/dist/cli/plugins.js +3 -3
- package/dist/cli/run.d.ts +2 -1
- package/dist/cli/run.js +2 -1
- package/dist/cli/snapshot-create.js +3 -3
- package/dist/cli/upgrade.js +3 -3
- package/dist/{config-BOtJQ7Pc.js → client-ceE7NtvC.js} +4 -367
- package/dist/config-CIE83sR2.js +386 -0
- package/dist/{schema-Rn8-XEaN.js → conversation-AA4R1VUn.js} +580 -558
- package/dist/{conversation-privacy-BZRA6Pes.js → conversation-privacy-Auyq26XQ.js} +1 -1
- package/dist/{credential-sync-Bep34IB_.js → credential-sync-BO33aNQd.js} +20 -19
- package/dist/{execution-stats-B6lgWxCK.js → execution-stats-SiS2FLcv.js} +4 -4
- package/dist/{executor-BlUhFL7_.js → executor-BfbYPW63.js} +31 -3
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-DLMqIK74.js → job-queue-CyTc24Es.js} +1 -1
- package/dist/{logging-BMJzdDlP.js → logging-D37bayDc.js} +1 -1
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-WwG5_Zgm.js → oauth-callback-server-BtfOeHTZ.js} +2 -2
- package/dist/{pending-auth-CUbXq06G.js → pending-auth-BPUzcs7n.js} +2 -2
- package/dist/{profile-T0tXE4zu.js → profile-CSixooTi.js} +4 -3
- package/dist/prompt-3gqNY1Ka.js +552 -0
- package/dist/{registry-BA0__8ai.js → registry-DiR0-xRg.js} +1 -1
- package/dist/{resolve-bvD1ORdv.js → resolve-Bn5q__9b.js} +2 -2
- package/dist/{runner-BXYxfIUL.js → runner-DFx3dIJH.js} +9 -9
- package/dist/{sandbox-egress-signals-ngEPjSEW.js → sandbox-egress-signals-bwvjihxA.js} +1 -1
- package/dist/schema-8GXFfclK.js +559 -0
- package/dist/{skills-DJOlYdBs.js → skills-BhM5qyCF.js} +2 -2
- package/dist/{spawn-h0R1bTEo.js → spawn-Dk0PqdH6.js} +2 -2
- package/dist/{stats-3YZn-Swi.js → stats-DKRP4rsY.js} +6 -6
- package/dist/{task-queue-CoXwd2eq.js → task-queue-CdpTvu4R.js} +3 -3
- package/dist/{task-runner-B2_mJZj0.js → task-runner-alpjVSxQ.js} +10 -10
- package/dist/{thread-state-CqZ1m-es.js → thread-state-CRK7aA41.js} +5 -5
- package/dist/{turn-execution-fI6PZ0iI.js → turn-execution-XtyzIHog.js} +3 -3
- package/dist/{turn-lifecycle-CcnwrOcp.js → turn-lifecycle-VbwZLfBv.js} +1 -1
- package/dist/{usage-B5SfMb3H.js → usage-D4A48Bdl.js} +4 -125
- package/dist/{validation-DfWcvhuS.js → validation-jn_46o4U.js} +1 -1
- package/dist/{version-oD-oPrbO.js → version-DcfJxB4z.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/web-authorization-CsfLSfEs.js +38 -0
- package/dist/{web-input-BOuq3oKK.js → web-input-BPp_sc7t.js} +6 -6
- package/dist/{work-B91LQKHr.js → work-Di-ubSGg.js} +9 -9
- package/dist/{worker-BcRRTe6k.js → worker-Cu_D5Mr8.js} +5 -4
- package/migrations/0040_conversation_briefs.sql +17 -0
- package/migrations/meta/0040_snapshot.json +3516 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +5 -5
- package/dist/history-CqTuSAdI.js +0 -441
- package/dist/usage-schema-CKaDkH_j.js +0 -20
- package/dist/web-authorization-Crbzlmzo.js +0 -76
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { F as isRecord, I as toOptionalNumber, L as toOptionalString } from "./logging-
|
|
2
|
-
import {
|
|
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-
|
|
5
|
-
import { $ as persistConversationMessages } from "./checkpoint-
|
|
6
|
-
import { w as getStateAdapter } from "./profile-
|
|
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 {
|
|
2
|
-
import { n as runAgentWithTimeout } from "./agent-runner-
|
|
3
|
-
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-
|
|
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 {
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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,
|
|
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-
|
|
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({
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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 {
|
|
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 {
|
|
8
|
-
import { Kt as buildDeterministicTurnId, c as parseSlackThreadId, ft as appendAndEnqueueExclusiveInboundMessage, pt as appendAndEnqueueInboundMessage } from "./stats-
|
|
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
|
|
3
|
-
import {
|
|
4
|
-
import { f as juniorAgentBindings, p as juniorAgentInvocations } from "./executor-
|
|
5
|
-
import { B as openConversationProjection, o as failTurnRecord, r as saveTurnCheckpoint, s as getTurnRecord, xt as getTerminalAssistantMessages } from "./checkpoint-
|
|
6
|
-
import { pt as appendAndEnqueueInboundMessage } from "./stats-
|
|
7
|
-
import { _ as isTurnInputCommitLostError, h as getConversationTurnBoundaryError, p as TurnInputCommitLostError, s as getAssistantReplyText } from "./pending-auth-
|
|
8
|
-
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-
|
|
9
|
-
import { n as executeTurn, t as AgentRunError } from "./turn-execution-
|
|
10
|
-
import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState } from "./thread-state-
|
|
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 {
|
|
3
|
-
import { S as withLogContext, d as logInfo, f as logWarn, u as logException } from "./logging-
|
|
4
|
-
import {
|
|
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-
|
|
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"));
|