@sentry/junior 0.131.0 → 0.133.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-hooks-M5V454P5.js → agent-hooks-5BUIXVIX.js} +9 -9
- package/dist/api/conversations/list.d.ts +13 -2
- package/dist/api/schema/task.d.ts +0 -3
- package/dist/api/schema.js +1 -1
- package/dist/api.js +24 -23
- package/dist/app.js +84 -37
- package/dist/{catalog-runtime-PI2IFWZ5.js → catalog-runtime-VGB3DWXZ.js} +5 -5
- package/dist/chat/config.d.ts +2 -0
- package/dist/chat/conversations/location.d.ts +10 -0
- package/dist/chat/conversations/projection.d.ts +3 -1
- package/dist/chat/conversations/sql/bindings.d.ts +13 -0
- package/dist/chat/conversations/sql/location.d.ts +9 -0
- package/dist/chat/conversations/sql/store.d.ts +3 -0
- package/dist/chat/conversations/store.d.ts +17 -0
- package/dist/chat/runtime/reply-executor.d.ts +1 -0
- package/dist/chat/runtime/slack-runtime.d.ts +2 -0
- package/dist/chat/scheduled-tasks/tool-support.d.ts +2 -5
- package/dist/chat/scheduled-tasks/tools/create.d.ts +2 -2
- package/dist/chat/scheduled-tasks/tools/delete.d.ts +2 -2
- package/dist/chat/scheduled-tasks/tools/list.d.ts +2 -2
- package/dist/chat/scheduled-tasks/tools/run-now.d.ts +2 -2
- package/dist/chat/scheduled-tasks/tools/update.d.ts +3 -3
- package/dist/chat/scheduled-tasks/types.d.ts +1 -1
- package/dist/chat/slack/dispatch-turn.d.ts +1 -0
- package/dist/chat/slack/reply.d.ts +1 -1
- package/dist/{chunk-UYYSD255.js → chunk-5ZAZHLIW.js} +1 -1
- package/dist/{chunk-JKHK3LM2.js → chunk-AH5HTUYX.js} +1 -1
- package/dist/{chunk-HZ5EVSPV.js → chunk-ECUILEUX.js} +24 -15
- package/dist/{chunk-HSPYTFMD.js → chunk-EJRJWBKG.js} +1 -1
- package/dist/{chunk-TD2A27ET.js → chunk-FX6BLEDP.js} +1 -1
- package/dist/{chunk-7Y2OKB5K.js → chunk-HJ4KDO4N.js} +1 -1
- package/dist/{chunk-DRFI6CW3.js → chunk-HTGXUNEC.js} +7 -7
- package/dist/{chunk-SVX4JDOR.js → chunk-IKO5LFIU.js} +1 -1
- package/dist/{chunk-J4I2GVGH.js → chunk-IVTHTAVK.js} +2 -2
- package/dist/{chunk-APUL3Y63.js → chunk-JLN4XSPR.js} +1 -1
- package/dist/{chunk-ZMIO64MA.js → chunk-LDRO4OQ4.js} +19 -3
- package/dist/{chunk-5ONXE2GF.js → chunk-LNYNTR27.js} +305 -235
- package/dist/{chunk-BVKP37NE.js → chunk-QVEXYYFM.js} +1 -1
- package/dist/{chunk-KB2M27DL.js → chunk-QWGZ273D.js} +78 -36
- package/dist/{chunk-TRKWWIB3.js → chunk-T5FPIBU2.js} +21 -21
- package/dist/{chunk-XXGCQCFJ.js → chunk-TBVS7GBE.js} +4 -4
- package/dist/{chunk-XMDY52DJ.js → chunk-TLN54TOQ.js} +1 -1
- package/dist/{chunk-VMPL77IK.js → chunk-TU7P77FI.js} +36 -24
- package/dist/{chunk-NGJEC4MF.js → chunk-V365UVCU.js} +2 -2
- package/dist/{chunk-KWYCUXJX.js → chunk-VL7OYSHD.js} +1 -1
- package/dist/{chunk-D6ZMP3FC.js → chunk-VQA25AL4.js} +6 -6
- package/dist/{chunk-MLIJGLW5.js → chunk-WHEMUEXT.js} +5 -5
- package/dist/{chunk-7X62XOC4.js → chunk-XTQGVNM3.js} +54 -19
- package/dist/cli/chat.js +24 -24
- package/dist/cli/check.js +6 -6
- package/dist/cli/init.js +1 -0
- package/dist/cli/plugins.js +12 -12
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +9 -8
- package/dist/db/executor.d.ts +2 -1
- package/dist/db/neon.d.ts +1 -0
- package/dist/db/postgres.d.ts +1 -0
- package/dist/db/schema/conversation-bindings.d.ts +110 -0
- package/dist/db/schema.d.ts +111 -1
- package/dist/{db-5P6K3ZCM.js → db-RICMPUFT.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-RIMCKQZX.js → oauth-callback-server-YFVS4SAX.js} +17 -17
- package/dist/{runner-CAD3BVML.js → runner-A3LVGZR6.js} +11 -11
- package/dist/{skills-WVPCTBUT.js → skills-P7Q6Z6PN.js} +6 -6
- package/dist/{validation-GLEXIFFI.js → validation-RYHOWBET.js} +6 -6
- package/dist/version.js +1 -1
- package/migrations/0017_drop_paused_scheduled_tasks.sql +19 -0
- package/migrations/0018_curvy_excalibur.sql +12 -0
- package/migrations/meta/0017_snapshot.json +1666 -0
- package/migrations/meta/0018_snapshot.json +1756 -0
- package/migrations/meta/_journal.json +15 -1
- package/package.json +5 -5
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ConversationPrivacy } from "@/chat/conversation-privacy";
|
|
2
|
+
import { type Location } from "@/chat/conversations/location";
|
|
3
|
+
import type { juniorDestinations } from "@/db/schema";
|
|
4
|
+
type LocationRow = typeof juniorDestinations.$inferSelect;
|
|
5
|
+
/** Project one supported provider location from its linked SQL row. */
|
|
6
|
+
export declare function locationFromRow(row: LocationRow | null): Location | undefined;
|
|
7
|
+
/** Resolve conversation privacy from one linked provider-location row. */
|
|
8
|
+
export declare function privacyFromLocationRow(row: LocationRow | null): ConversationPrivacy | undefined;
|
|
9
|
+
export {};
|
|
@@ -4,9 +4,12 @@ import type { StoredSlackActor } from "@/chat/actor";
|
|
|
4
4
|
import type { JuniorSqlDatabase } from "@/db/db";
|
|
5
5
|
import type { Conversation, ConversationExecution, ConversationSource, ConversationStore } from "../store";
|
|
6
6
|
import type { AgentTurnUsage } from "@/chat/usage";
|
|
7
|
+
import { type ProviderConversationBinding, type ProviderConversationReference } from "./bindings";
|
|
7
8
|
export declare class SqlStore implements ConversationStore {
|
|
8
9
|
private readonly executor;
|
|
9
10
|
constructor(executor: JuniorSqlDatabase);
|
|
11
|
+
getConversationIdByProviderConversation(args: ProviderConversationReference): Promise<string | undefined>;
|
|
12
|
+
bindProviderConversation(args: ProviderConversationBinding): Promise<void>;
|
|
10
13
|
get(args: {
|
|
11
14
|
conversationId: string;
|
|
12
15
|
}): Promise<Conversation | undefined>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Destination, Source } from "@sentry/junior-plugin-api";
|
|
2
2
|
import type { ConversationPrivacy } from "@/chat/conversation-privacy";
|
|
3
3
|
import type { StoredSlackActor } from "@/chat/actor";
|
|
4
|
+
import type { Location } from "@/chat/conversations/location";
|
|
4
5
|
import type { SessionSource } from "@/chat/source";
|
|
5
6
|
import type { AgentTurnUsage } from "@/chat/usage";
|
|
6
7
|
export type ConversationSource = "api" | "internal" | "local" | "plugin" | "resource_event" | "scheduler" | "slack";
|
|
@@ -25,6 +26,7 @@ export interface Conversation {
|
|
|
25
26
|
execution: ConversationExecution;
|
|
26
27
|
lastActivityAtMs: number;
|
|
27
28
|
lineage?: ConversationLineage;
|
|
29
|
+
location?: Location;
|
|
28
30
|
actor?: StoredSlackActor;
|
|
29
31
|
schemaVersion: 1;
|
|
30
32
|
source?: ConversationSource;
|
|
@@ -49,6 +51,21 @@ export interface ConversationStore {
|
|
|
49
51
|
get(args: {
|
|
50
52
|
conversationId: string;
|
|
51
53
|
}): Promise<Conversation | undefined>;
|
|
54
|
+
/** Resolve the durable conversation bound to one provider conversation. */
|
|
55
|
+
getConversationIdByProviderConversation(args: {
|
|
56
|
+
provider: string;
|
|
57
|
+
providerDestinationId: string;
|
|
58
|
+
providerTenantId: string;
|
|
59
|
+
providerConversationId: string;
|
|
60
|
+
}): Promise<string | undefined>;
|
|
61
|
+
/** Bind one provider conversation to its pre-existing durable conversation. */
|
|
62
|
+
bindProviderConversation(args: {
|
|
63
|
+
conversationId: string;
|
|
64
|
+
provider: string;
|
|
65
|
+
providerDestinationId: string;
|
|
66
|
+
providerTenantId: string;
|
|
67
|
+
providerConversationId: string;
|
|
68
|
+
}): Promise<void>;
|
|
52
69
|
/** Read confirmed public/private visibility for one destination. */
|
|
53
70
|
getDestinationVisibility(args: {
|
|
54
71
|
provider: string;
|
|
@@ -55,6 +55,7 @@ interface ReplyExecutorDeps {
|
|
|
55
55
|
/** Build the shared reply handler that prepares, advances, and commits a turn. */
|
|
56
56
|
export declare function createReplyToThread(deps: ReplyExecutorDeps): (thread: Thread, message: Message, options: {
|
|
57
57
|
beforeFirstResponsePost?: () => Promise<void>;
|
|
58
|
+
conversationId?: string;
|
|
58
59
|
destination: Destination;
|
|
59
60
|
explicitMention?: boolean;
|
|
60
61
|
ack?: () => Promise<void>;
|
|
@@ -38,6 +38,7 @@ interface SteeringDrainContext {
|
|
|
38
38
|
conversationContext?: string;
|
|
39
39
|
}
|
|
40
40
|
export interface SlackTurnOptions extends ReplyHooks {
|
|
41
|
+
conversationId?: string;
|
|
41
42
|
destination: Destination;
|
|
42
43
|
}
|
|
43
44
|
export interface SlackTurnRuntimeDependencies<TPreparedState> {
|
|
@@ -93,6 +94,7 @@ export interface SlackTurnRuntimeDependencies<TPreparedState> {
|
|
|
93
94
|
prepareTurnState: (args: PrepareTurnStateInput) => Promise<TPreparedState>;
|
|
94
95
|
replyToThread: (thread: Thread, message: Message, options: {
|
|
95
96
|
beforeFirstResponsePost?: () => Promise<void>;
|
|
97
|
+
conversationId?: string;
|
|
96
98
|
destination: Destination;
|
|
97
99
|
explicitMention?: boolean;
|
|
98
100
|
ack?: () => Promise<void>;
|
|
@@ -21,7 +21,6 @@ declare const compactTaskResultSchema: z.ZodObject<{
|
|
|
21
21
|
status: z.ZodEnum<{
|
|
22
22
|
blocked: "blocked";
|
|
23
23
|
active: "active";
|
|
24
|
-
paused: "paused";
|
|
25
24
|
deleted: "deleted";
|
|
26
25
|
}>;
|
|
27
26
|
task: z.ZodString;
|
|
@@ -59,7 +58,6 @@ export declare const scheduleTaskToolResultSchema: z.ZodObject<{
|
|
|
59
58
|
status: z.ZodEnum<{
|
|
60
59
|
blocked: "blocked";
|
|
61
60
|
active: "active";
|
|
62
|
-
paused: "paused";
|
|
63
61
|
deleted: "deleted";
|
|
64
62
|
}>;
|
|
65
63
|
task: z.ZodString;
|
|
@@ -97,7 +95,6 @@ export declare const scheduleListToolResultSchema: z.ZodObject<{
|
|
|
97
95
|
status: z.ZodEnum<{
|
|
98
96
|
blocked: "blocked";
|
|
99
97
|
active: "active";
|
|
100
|
-
paused: "paused";
|
|
101
98
|
deleted: "deleted";
|
|
102
99
|
}>;
|
|
103
100
|
task: z.ZodString;
|
|
@@ -148,7 +145,7 @@ export declare function scheduleTaskToolResult(target: string, task: CompactTask
|
|
|
148
145
|
readonly target: string;
|
|
149
146
|
readonly task: {
|
|
150
147
|
id: string;
|
|
151
|
-
status: "blocked" | "active" | "
|
|
148
|
+
status: "blocked" | "active" | "deleted";
|
|
152
149
|
task: string;
|
|
153
150
|
schedule: string;
|
|
154
151
|
timezone: string;
|
|
@@ -172,7 +169,7 @@ export declare function scheduleListToolResult(args: {
|
|
|
172
169
|
readonly target: string;
|
|
173
170
|
readonly tasks: {
|
|
174
171
|
id: string;
|
|
175
|
-
status: "blocked" | "active" | "
|
|
172
|
+
status: "blocked" | "active" | "deleted";
|
|
176
173
|
task: string;
|
|
177
174
|
schedule: string;
|
|
178
175
|
timezone: string;
|
|
@@ -34,7 +34,7 @@ export declare function createSlackScheduleCreateTaskTool(context: SchedulerTool
|
|
|
34
34
|
target: string;
|
|
35
35
|
task: {
|
|
36
36
|
id: string;
|
|
37
|
-
status: "blocked" | "active" | "
|
|
37
|
+
status: "blocked" | "active" | "deleted";
|
|
38
38
|
task: string;
|
|
39
39
|
schedule: string;
|
|
40
40
|
timezone: string;
|
|
@@ -57,7 +57,7 @@ export declare function createSlackScheduleCreateTaskTool(context: SchedulerTool
|
|
|
57
57
|
target: string;
|
|
58
58
|
task: {
|
|
59
59
|
id: string;
|
|
60
|
-
status: "blocked" | "active" | "
|
|
60
|
+
status: "blocked" | "active" | "deleted";
|
|
61
61
|
task: string;
|
|
62
62
|
schedule: string;
|
|
63
63
|
timezone: string;
|
|
@@ -10,7 +10,7 @@ export declare function createSlackScheduleDeleteTaskTool(context: SchedulerTool
|
|
|
10
10
|
target: string;
|
|
11
11
|
task: {
|
|
12
12
|
id: string;
|
|
13
|
-
status: "blocked" | "active" | "
|
|
13
|
+
status: "blocked" | "active" | "deleted";
|
|
14
14
|
task: string;
|
|
15
15
|
schedule: string;
|
|
16
16
|
timezone: string;
|
|
@@ -33,7 +33,7 @@ export declare function createSlackScheduleDeleteTaskTool(context: SchedulerTool
|
|
|
33
33
|
target: string;
|
|
34
34
|
task: {
|
|
35
35
|
id: string;
|
|
36
|
-
status: "blocked" | "active" | "
|
|
36
|
+
status: "blocked" | "active" | "deleted";
|
|
37
37
|
task: string;
|
|
38
38
|
schedule: string;
|
|
39
39
|
timezone: string;
|
|
@@ -8,7 +8,7 @@ export declare function createSlackScheduleListTasksTool(context: SchedulerToolC
|
|
|
8
8
|
target: string;
|
|
9
9
|
tasks: {
|
|
10
10
|
id: string;
|
|
11
|
-
status: "blocked" | "active" | "
|
|
11
|
+
status: "blocked" | "active" | "deleted";
|
|
12
12
|
task: string;
|
|
13
13
|
schedule: string;
|
|
14
14
|
timezone: string;
|
|
@@ -31,7 +31,7 @@ export declare function createSlackScheduleListTasksTool(context: SchedulerToolC
|
|
|
31
31
|
target: string;
|
|
32
32
|
tasks: {
|
|
33
33
|
id: string;
|
|
34
|
-
status: "blocked" | "active" | "
|
|
34
|
+
status: "blocked" | "active" | "deleted";
|
|
35
35
|
task: string;
|
|
36
36
|
schedule: string;
|
|
37
37
|
timezone: string;
|
|
@@ -10,7 +10,7 @@ export declare function createSlackScheduleRunTaskNowTool(context: SchedulerTool
|
|
|
10
10
|
target: string;
|
|
11
11
|
task: {
|
|
12
12
|
id: string;
|
|
13
|
-
status: "blocked" | "active" | "
|
|
13
|
+
status: "blocked" | "active" | "deleted";
|
|
14
14
|
task: string;
|
|
15
15
|
schedule: string;
|
|
16
16
|
timezone: string;
|
|
@@ -33,7 +33,7 @@ export declare function createSlackScheduleRunTaskNowTool(context: SchedulerTool
|
|
|
33
33
|
target: string;
|
|
34
34
|
task: {
|
|
35
35
|
id: string;
|
|
36
|
-
status: "blocked" | "active" | "
|
|
36
|
+
status: "blocked" | "active" | "deleted";
|
|
37
37
|
task: string;
|
|
38
38
|
schedule: string;
|
|
39
39
|
timezone: string;
|
|
@@ -29,14 +29,14 @@ export declare function createSlackScheduleUpdateTaskTool(context: SchedulerTool
|
|
|
29
29
|
};
|
|
30
30
|
timezone?: string | null | undefined;
|
|
31
31
|
} | null | undefined;
|
|
32
|
-
status?: "blocked" | "active" |
|
|
32
|
+
status?: "blocked" | "active" | undefined;
|
|
33
33
|
credential_mode?: "system" | "creator" | null | undefined;
|
|
34
34
|
};
|
|
35
35
|
execute?: ((input: unknown, options: import("../../tools/definition").ToolExecuteOptions) => {
|
|
36
36
|
target: string;
|
|
37
37
|
task: {
|
|
38
38
|
id: string;
|
|
39
|
-
status: "blocked" | "active" | "
|
|
39
|
+
status: "blocked" | "active" | "deleted";
|
|
40
40
|
task: string;
|
|
41
41
|
schedule: string;
|
|
42
42
|
timezone: string;
|
|
@@ -59,7 +59,7 @@ export declare function createSlackScheduleUpdateTaskTool(context: SchedulerTool
|
|
|
59
59
|
target: string;
|
|
60
60
|
task: {
|
|
61
61
|
id: string;
|
|
62
|
-
status: "blocked" | "active" | "
|
|
62
|
+
status: "blocked" | "active" | "deleted";
|
|
63
63
|
task: string;
|
|
64
64
|
schedule: string;
|
|
65
65
|
timezone: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Durable scheduled-task domain types owned by Junior core. */
|
|
2
2
|
import type { SlackDestination, SystemActor } from "@sentry/junior-plugin-api";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
export type ScheduledTaskStatus = "active" | "
|
|
4
|
+
export type ScheduledTaskStatus = "active" | "blocked" | "deleted";
|
|
5
5
|
export declare const scheduledTaskCredentialModeSchema: z.ZodEnum<{
|
|
6
6
|
system: "system";
|
|
7
7
|
creator: "creator";
|
|
@@ -5,6 +5,7 @@ import type { DispatchRecord } from "@/chat/agent-dispatch/types";
|
|
|
5
5
|
interface DispatchReplyToThread {
|
|
6
6
|
(thread: ThreadImpl, message: Message, options: {
|
|
7
7
|
ack?: () => Promise<void>;
|
|
8
|
+
conversationId?: string;
|
|
8
9
|
destination: DispatchRecord["destination"];
|
|
9
10
|
execution: DispatchTurnContext;
|
|
10
11
|
onTurnDeliveryAccepted?: (messageId?: string) => void;
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from "./chunk-HX236W2U.js";
|
|
8
8
|
import {
|
|
9
9
|
agentHistoryItemSchema,
|
|
10
|
+
bindProviderConversation,
|
|
10
11
|
contextProvenance,
|
|
11
12
|
createSqlConversationEventStore,
|
|
12
13
|
getConversationEventStore,
|
|
@@ -16,17 +17,17 @@ import {
|
|
|
16
17
|
instructionProvenanceFor,
|
|
17
18
|
sanitizePostgresJson,
|
|
18
19
|
withConversationEventLock
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-LNYNTR27.js";
|
|
20
21
|
import {
|
|
21
22
|
getStateAdapter,
|
|
22
23
|
sleep
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-TLN54TOQ.js";
|
|
24
25
|
import {
|
|
25
26
|
botConfig,
|
|
26
27
|
escapeXml,
|
|
27
28
|
resolveGatewayModel,
|
|
28
29
|
unwrapCurrentInstruction
|
|
29
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-LDRO4OQ4.js";
|
|
30
31
|
import {
|
|
31
32
|
toStoredSlackActor
|
|
32
33
|
} from "./chunk-HZF5P5UN.js";
|
|
@@ -41,7 +42,7 @@ import {
|
|
|
41
42
|
setSpanAttributes,
|
|
42
43
|
toOptionalNumber,
|
|
43
44
|
toOptionalString
|
|
44
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-EJRJWBKG.js";
|
|
45
46
|
|
|
46
47
|
// src/chat/turn-context-tag.ts
|
|
47
48
|
var TURN_CONTEXT_TAG = "runtime-turn-context";
|
|
@@ -997,17 +998,19 @@ async function commitAcceptedReply(args) {
|
|
|
997
998
|
executor,
|
|
998
999
|
args.conversationId,
|
|
999
1000
|
async () => executor.transaction(async () => {
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1001
|
+
if (args.agentMessage) {
|
|
1002
|
+
const agentMessage = normalizeDurableMessage(args.agentMessage);
|
|
1003
|
+
await createSqlConversationEventStore(executor).append(
|
|
1004
|
+
args.conversationId,
|
|
1005
|
+
[
|
|
1006
|
+
{
|
|
1007
|
+
idempotencyKey: `message:${args.conversationMessageId}:agent`,
|
|
1008
|
+
data: historyItemFromPiMessage(agentMessage, contextProvenance),
|
|
1009
|
+
createdAtMs: messageTimestamp(agentMessage)
|
|
1010
|
+
}
|
|
1011
|
+
]
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
1011
1014
|
await appendConversationMessages(
|
|
1012
1015
|
createSqlConversationEventStore(executor),
|
|
1013
1016
|
{
|
|
@@ -1016,6 +1019,12 @@ async function commitAcceptedReply(args) {
|
|
|
1016
1019
|
...args.repliedAtMs === void 0 ? {} : { repliedAtMs: args.repliedAtMs }
|
|
1017
1020
|
}
|
|
1018
1021
|
);
|
|
1022
|
+
for (const binding of args.providerConversationBindings ?? []) {
|
|
1023
|
+
await bindProviderConversation(executor, {
|
|
1024
|
+
conversationId: args.conversationId,
|
|
1025
|
+
...binding
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1019
1028
|
})
|
|
1020
1029
|
);
|
|
1021
1030
|
}
|
|
@@ -6,25 +6,25 @@ import {
|
|
|
6
6
|
isDmChannel,
|
|
7
7
|
normalizeSlackConversationId,
|
|
8
8
|
withSlackRetries
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-WHEMUEXT.js";
|
|
10
10
|
import {
|
|
11
11
|
getDb,
|
|
12
12
|
parseDestination
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-LNYNTR27.js";
|
|
14
14
|
import {
|
|
15
15
|
acquireActiveLock,
|
|
16
16
|
getStateAdapter,
|
|
17
17
|
sleep
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-TLN54TOQ.js";
|
|
19
19
|
import {
|
|
20
20
|
normalizeSlackEmojiName
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-LDRO4OQ4.js";
|
|
22
22
|
import {
|
|
23
23
|
pluginCatalogRuntime
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-JLN4XSPR.js";
|
|
25
25
|
import {
|
|
26
26
|
fetchWithBoundedOAuthErrorBodies
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-HJ4KDO4N.js";
|
|
28
28
|
import {
|
|
29
29
|
parseSlackMessageTs,
|
|
30
30
|
parseSlackUserId
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
isRecord,
|
|
34
34
|
logInfo,
|
|
35
35
|
logWarn
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-EJRJWBKG.js";
|
|
37
37
|
|
|
38
38
|
// src/chat/capabilities/router.ts
|
|
39
39
|
var ProviderCredentialRouter = class {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
toCanonicalInputMessage,
|
|
4
4
|
toCanonicalOutputMessage,
|
|
5
5
|
toGenAiMessagesTraceAttributes
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VL7OYSHD.js";
|
|
7
7
|
import {
|
|
8
8
|
extractGenAiUsageAttributes,
|
|
9
9
|
logException,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
normalizeGenAiFinishReason,
|
|
12
12
|
serializeGenAiAttribute,
|
|
13
13
|
withSpan
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-EJRJWBKG.js";
|
|
15
15
|
|
|
16
16
|
// src/chat/config.ts
|
|
17
17
|
import { getModel as getModel2 } from "@earendil-works/pi-ai/compat";
|
|
@@ -675,6 +675,7 @@ var DEFAULT_SLACK_SLASH_COMMAND = "/jr";
|
|
|
675
675
|
var DEFAULT_PROCESSING_REACTION_EMOJI = "eyes";
|
|
676
676
|
var DEFAULT_COMPLETED_REACTION_EMOJI = "white_check_mark";
|
|
677
677
|
var DEFAULT_MODEL_CONTEXT_WINDOW_TOKENS = 4e5;
|
|
678
|
+
var DEFAULT_SQL_STATEMENT_TIMEOUT_MS = 3e4;
|
|
678
679
|
var FUNCTION_TIMEOUT_BUFFER_SECONDS = 20;
|
|
679
680
|
var CONVERSATION_WORK_SOFT_YIELD_BUFFER_SECONDS = 40;
|
|
680
681
|
var DEFAULT_ASSISTANT_LOADING_MESSAGES = [
|
|
@@ -904,6 +905,19 @@ function readSqlDriver(env, databaseUrl) {
|
|
|
904
905
|
}
|
|
905
906
|
throw new Error("JUNIOR_DATABASE_DRIVER must be postgres or neon");
|
|
906
907
|
}
|
|
908
|
+
function readSqlStatementTimeoutMs(env) {
|
|
909
|
+
const rawValue = toOptionalTrimmed(env.JUNIOR_SQL_STATEMENT_TIMEOUT_MS);
|
|
910
|
+
if (rawValue === void 0) {
|
|
911
|
+
return DEFAULT_SQL_STATEMENT_TIMEOUT_MS;
|
|
912
|
+
}
|
|
913
|
+
const value = Number.parseInt(rawValue, 10);
|
|
914
|
+
if (!Number.isSafeInteger(value) || value < 0 || String(value) !== rawValue) {
|
|
915
|
+
throw new Error(
|
|
916
|
+
"JUNIOR_SQL_STATEMENT_TIMEOUT_MS must be a non-negative integer"
|
|
917
|
+
);
|
|
918
|
+
}
|
|
919
|
+
return value === 0 ? false : value;
|
|
920
|
+
}
|
|
907
921
|
function readChatConfig(env = process.env, functionMaxDurationSeconds = DEFAULT_FUNCTION_MAX_DURATION_SECONDS) {
|
|
908
922
|
const databaseUrl = readDatabaseUrl(env);
|
|
909
923
|
const resolvedFunctionMaxDurationSeconds = resolveFunctionMaxDurationSeconds(
|
|
@@ -917,7 +931,8 @@ function readChatConfig(env = process.env, functionMaxDurationSeconds = DEFAULT_
|
|
|
917
931
|
),
|
|
918
932
|
sql: {
|
|
919
933
|
databaseUrl,
|
|
920
|
-
driver: readSqlDriver(env, databaseUrl)
|
|
934
|
+
driver: readSqlDriver(env, databaseUrl),
|
|
935
|
+
statementTimeoutMs: readSqlStatementTimeoutMs(env)
|
|
921
936
|
},
|
|
922
937
|
slack: {
|
|
923
938
|
botToken: toOptionalTrimmed(env.SLACK_BOT_TOKEN) ?? toOptionalTrimmed(env.SLACK_BOT_USER_TOKEN),
|
|
@@ -1027,6 +1042,7 @@ export {
|
|
|
1027
1042
|
modelIdForProfile,
|
|
1028
1043
|
standardModelId,
|
|
1029
1044
|
profileConfig,
|
|
1045
|
+
DEFAULT_SQL_STATEMENT_TIMEOUT_MS,
|
|
1030
1046
|
FUNCTION_TIMEOUT_BUFFER_SECONDS,
|
|
1031
1047
|
configureFunctionMaxDurationSeconds,
|
|
1032
1048
|
getChatConfig,
|