@sentry/junior 0.191.0 → 0.193.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-HIWWBBKO.js → agent-hooks-DWY3MZZ7.js} +11 -11
- package/dist/api/activity.d.ts +3 -1
- package/dist/api/code/overview.d.ts +12 -0
- package/dist/api/locations/detail.d.ts +8 -0
- package/dist/api/locations/list.d.ts +5 -0
- package/dist/api/people/code.d.ts +6 -0
- package/dist/api/people/shared.d.ts +2 -0
- package/dist/api/reporting-window.d.ts +40 -0
- package/dist/api/schema/code.d.ts +14 -0
- package/dist/api/schema/conversation.d.ts +27 -0
- package/dist/api/schema/location.d.ts +15 -0
- package/dist/api/schema/person.d.ts +104 -0
- package/dist/api/schema/task.d.ts +15 -2
- package/dist/api/schema.d.ts +1 -1
- package/dist/api/schema.js +2 -2
- package/dist/api.js +536 -141
- package/dist/app.js +50 -83
- package/dist/{catalog-runtime-4OKH4265.js → catalog-runtime-NAD44W5K.js} +4 -4
- package/dist/chat/agent/prompt.d.ts +1 -1
- package/dist/chat/agent-dispatch/types.d.ts +2 -1
- package/dist/chat/agent-dispatch/validation.d.ts +1 -1
- package/dist/chat/agent-invocations/types.d.ts +24 -28
- package/dist/chat/event-tasks/tool-support.d.ts +10 -1
- package/dist/chat/plugins/agent-hooks.d.ts +2 -2
- package/dist/chat/prompt.d.ts +4 -5
- package/dist/chat/services/turn-session-routing.d.ts +4 -3
- package/dist/chat/slack/tool-support/context.d.ts +3 -6
- package/dist/chat/source.d.ts +4 -6
- package/dist/chat/tasks/execution-stats.d.ts +12 -0
- package/dist/chat/tools/delete-event-task.d.ts +1 -1
- package/dist/chat/tools/types.d.ts +10 -9
- package/dist/chat/tools/update-event-task.d.ts +1 -1
- package/dist/{chunk-S7NSFCCW.js → chunk-2CYWEVOP.js} +4 -4
- package/dist/{chunk-6KISW5UY.js → chunk-3YZ2Q6AW.js} +2 -2
- package/dist/{chunk-X6PQKQTY.js → chunk-42N6CDWF.js} +4 -4
- package/dist/{chunk-Q32BSFN4.js → chunk-4UA5C7AM.js} +32 -25
- package/dist/{chunk-VGYZ3YZM.js → chunk-5E5SLAVD.js} +21 -21
- package/dist/{chunk-3PDR63SX.js → chunk-5LEVZYXF.js} +4 -4
- package/dist/{chunk-SEIZ2XLD.js → chunk-5S6AQFNG.js} +1 -1
- package/dist/{chunk-AWFSSFAX.js → chunk-AZVDODSP.js} +11 -11
- package/dist/{chunk-LOYTPSAK.js → chunk-BFP3ZKG6.js} +12 -8
- package/dist/{chunk-GQN4REF5.js → chunk-COCVPDWX.js} +11 -7
- package/dist/{chunk-CECRMPXJ.js → chunk-D4XQZOHB.js} +8 -8
- package/dist/{chunk-WNIVCR74.js → chunk-D5YQPCEG.js} +2 -2
- package/dist/{chunk-CCPOZMS4.js → chunk-DVU734PI.js} +3 -3
- package/dist/{chunk-EQZUBYRF.js → chunk-DXFUYLHX.js} +1 -1
- package/dist/{chunk-PFAZSRGR.js → chunk-EYIMZY5O.js} +114 -19
- package/dist/{chunk-NK3UEKAW.js → chunk-FQ5HFSFR.js} +81 -33
- package/dist/{chunk-K2NKG42A.js → chunk-GTXQHZ2O.js} +5 -5
- package/dist/{chunk-BVWC5DBM.js → chunk-GUKGU6R7.js} +1 -1
- package/dist/{chunk-ZJRGWZZ2.js → chunk-GUMBIDDL.js} +74 -4
- package/dist/{chunk-DP6H3U2X.js → chunk-HMBTX5RK.js} +1 -1
- package/dist/{chunk-CUUE5MGF.js → chunk-IBXXTO3J.js} +3 -3
- package/dist/{chunk-YNRLCUCB.js → chunk-IOUUS6H4.js} +1 -1
- package/dist/{chunk-MFZOIKET.js → chunk-IQCL5JGL.js} +1 -1
- package/dist/{chunk-WCSXTDOL.js → chunk-K47OVEO4.js} +1 -1
- package/dist/{chunk-7PYCRKQL.js → chunk-KWXZMHJS.js} +3 -3
- package/dist/{chunk-5IMKUVMS.js → chunk-LG7Q4OW4.js} +9 -9
- package/dist/{chunk-HNMRX2EN.js → chunk-LXRTHE43.js} +6 -7
- package/dist/{chunk-RZS4F5K4.js → chunk-N6Q2PNSI.js} +3 -3
- package/dist/{chunk-BVYUIVXE.js → chunk-OICYQPKP.js} +1 -1
- package/dist/{chunk-NY5SJGJZ.js → chunk-PYBFVK6K.js} +73 -64
- package/dist/{chunk-ZNFNGDT7.js → chunk-QDU5MW2R.js} +1 -1
- package/dist/{chunk-QRNJO7DZ.js → chunk-QWY4KI2V.js} +1 -1
- package/dist/{chunk-L4JLLS6C.js → chunk-QY2IU47O.js} +1 -1
- package/dist/{chunk-UTL3MHPC.js → chunk-RC745GGZ.js} +8 -1
- package/dist/{chunk-SGRL7NV6.js → chunk-S5HS6WRH.js} +5 -5
- package/dist/{chunk-WBNQYVCM.js → chunk-THFNL3TL.js} +3 -4
- package/dist/{chunk-ZRN3OS7M.js → chunk-THYNA2QN.js} +1 -1
- package/dist/{chunk-TH6LMEOW.js → chunk-WH5VV2RW.js} +1 -1
- package/dist/{chunk-2JAWOTUT.js → chunk-WJJDQLVL.js} +2 -2
- package/dist/{chunk-KTW62MG5.js → chunk-ZFPEPWOO.js} +6 -6
- package/dist/cli/chat.js +33 -33
- package/dist/cli/check.js +5 -5
- package/dist/cli/plugins.js +12 -12
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +6 -6
- package/dist/db/schema/agent-invocations.d.ts +16 -0
- package/dist/db/schema/stats.d.ts +5 -1
- package/dist/db/schema.d.ts +16 -0
- package/dist/{db-LG4ZEWA3.js → db-H5MDRQEY.js} +6 -6
- package/dist/instrumentation.js +3 -3
- package/dist/nitro.js +6 -6
- package/dist/{oauth-callback-server-KI7ZRTOG.js → oauth-callback-server-IOU3NUHT.js} +29 -29
- package/dist/reporting-schema.d.ts +2 -2
- package/dist/{runner-K2EOSAZQ.js → runner-FZ5ZHLFG.js} +21 -21
- package/dist/{skills-JTRDFKMA.js → skills-AR3WD6BX.js} +5 -5
- package/dist/spawn-ZU6JABR7.js +42 -0
- package/dist/task-runner-EEGGG2PM.js +36 -0
- package/dist/{validation-NBWURHAP.js → validation-VYE7TQY7.js} +5 -5
- package/dist/version.js +1 -1
- package/dist/{work-35TBEAUI.js → work-CTQFWYKE.js} +21 -21
- package/dist/{worker-F762M6XM.js → worker-6WQU3IT5.js} +10 -10
- package/package.json +5 -5
- package/dist/spawn-SRBETYCF.js +0 -42
- package/dist/task-runner-INQIQ4VF.js +0 -36
|
@@ -46,6 +46,10 @@ export declare function readTaskExecutionSummaries(type: TaskExecutionType, name
|
|
|
46
46
|
export declare function readTaskExecutionDays(dayCount?: number, options?: {
|
|
47
47
|
nowMs?: number;
|
|
48
48
|
}): Promise<TaskExecutionDay[]>;
|
|
49
|
+
/** Load a fixed trailing window of completed executions stacked by hour. */
|
|
50
|
+
export declare function readTaskExecutionHours(hourCount?: number, options?: {
|
|
51
|
+
nowMs?: number;
|
|
52
|
+
}): Promise<TaskExecutionDay[]>;
|
|
49
53
|
/** Load the newest terminal task execution linked to one conversation, if any. */
|
|
50
54
|
export declare function readTaskExecutionByConversationId(args: {
|
|
51
55
|
conversationId: string;
|
|
@@ -78,3 +82,11 @@ export declare function readTaskExecutionStatusDays(args: {
|
|
|
78
82
|
nowMs?: number;
|
|
79
83
|
taskId: string;
|
|
80
84
|
}): Promise<TaskExecutionStatusDay[]>;
|
|
85
|
+
/** Load a fixed trailing window of terminal executions for one task by hour. */
|
|
86
|
+
export declare function readTaskExecutionStatusHours(args: {
|
|
87
|
+
hourCount?: number;
|
|
88
|
+
kind: TaskExecutionType;
|
|
89
|
+
namespace?: string;
|
|
90
|
+
nowMs?: number;
|
|
91
|
+
taskId: string;
|
|
92
|
+
}): Promise<TaskExecutionStatusDay[]>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ResourceEventCatalog } from "@/chat/resource-events/catalog";
|
|
2
2
|
import type { ToolRuntimeContext } from "@/chat/tools/types";
|
|
3
|
-
/** Create the core tool that deletes an event task
|
|
3
|
+
/** Create the core tool that deletes an event task. */
|
|
4
4
|
export declare function createDeleteEventTaskTool(context: ToolRuntimeContext, catalog: ResourceEventCatalog): Omit<import("./definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
5
5
|
inputSchema: import("./definition").JsonSchemaObject;
|
|
6
6
|
outputSchema: import("./definition").JsonSchemaObject;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FileUpload } from "chat";
|
|
2
|
-
import type { WebSource, ResourceEventSource, Destination, Identity, LocalDestination, LocalSource, PluginEgress, SlackDestination, SlackSource, Source,
|
|
2
|
+
import type { AgentInvocationSource, EventTaskSource, WebSource, ResourceEventSource, Destination, Identity, Location, LocalDestination, LocalSource, PluginDispatchSource, PluginEgress, SlackDestination, SlackSource, Source, ScheduledTaskSource, User } from "@sentry/junior-plugin-api";
|
|
3
3
|
import type { McpToolManager } from "@/chat/mcp/tool-manager";
|
|
4
4
|
import type { SandboxWorkspace } from "@/chat/sandbox/workspace";
|
|
5
5
|
import type { AgentTurnSurface } from "@/chat/task-execution/checkpoint";
|
|
@@ -12,6 +12,7 @@ import type { GeneratedArtifactFileRef } from "@/chat/tools/sandbox/file-uploads
|
|
|
12
12
|
import type { SpawnAgent } from "@/chat/agent/types";
|
|
13
13
|
import type { AttachmentStorage } from "@/chat/attachments/storage";
|
|
14
14
|
import type { Workspace } from "@/chat/workspaces/types";
|
|
15
|
+
import type { ConversationPrivacy } from "@/chat/conversation-privacy";
|
|
15
16
|
interface HandoffControl {
|
|
16
17
|
/** Non-empty catalog of configured targets. */
|
|
17
18
|
profiles: readonly [ModelProfile, ...ModelProfile[]];
|
|
@@ -65,7 +66,11 @@ interface BaseToolRuntimeContext {
|
|
|
65
66
|
*/
|
|
66
67
|
conversationId: string;
|
|
67
68
|
/** Location associated with this Conversation. */
|
|
69
|
+
location?: Location;
|
|
70
|
+
/** Legacy Location identity used by memory and plugin contexts. */
|
|
68
71
|
locationId?: string;
|
|
72
|
+
/** Stored Conversation visibility used by tools. */
|
|
73
|
+
conversationPrivacy?: ConversationPrivacy;
|
|
69
74
|
/** Runtime-owned default outbound destination for this invocation. */
|
|
70
75
|
destination: Destination;
|
|
71
76
|
actor?: Actor;
|
|
@@ -99,24 +104,20 @@ interface LocalToolRuntimeContext extends BaseToolRuntimeContext {
|
|
|
99
104
|
destination: LocalDestination;
|
|
100
105
|
actor?: LocalActor;
|
|
101
106
|
source: LocalSource;
|
|
102
|
-
slack?: never;
|
|
103
107
|
slackActionToken?: never;
|
|
104
108
|
}
|
|
105
109
|
interface WebToolRuntimeContext extends BaseToolRuntimeContext {
|
|
106
110
|
destination: Destination;
|
|
107
111
|
actor?: WebActor;
|
|
108
112
|
source: WebSource;
|
|
109
|
-
slack?: never;
|
|
110
113
|
slackActionToken?: never;
|
|
111
114
|
}
|
|
112
|
-
|
|
115
|
+
export type ToolRuntimeContext = LocalToolRuntimeContext | SlackToolRuntimeContext | WebToolRuntimeContext | (BaseToolRuntimeContext & {
|
|
113
116
|
destination: Destination;
|
|
114
|
-
actor?:
|
|
115
|
-
source: ResourceEventSource;
|
|
116
|
-
slack?: never;
|
|
117
|
+
actor?: Actor;
|
|
118
|
+
source: AgentInvocationSource | EventTaskSource | PluginDispatchSource | ResourceEventSource | ScheduledTaskSource;
|
|
117
119
|
slackActionToken?: never;
|
|
118
|
-
}
|
|
119
|
-
export type ToolRuntimeContext = LocalToolRuntimeContext | ResourceEventToolRuntimeContext | SlackToolRuntimeContext | WebToolRuntimeContext;
|
|
120
|
+
});
|
|
120
121
|
export interface ToolState {
|
|
121
122
|
getOperationResult: <T>(operationKey: string) => T | undefined;
|
|
122
123
|
setOperationResult: (operationKey: string, result: unknown) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ResourceEventCatalog } from "@/chat/resource-events/catalog";
|
|
2
2
|
import type { ToolRuntimeContext } from "@/chat/tools/types";
|
|
3
|
-
/** Create the core tool that updates an event task
|
|
3
|
+
/** Create the core tool that updates an event task. */
|
|
4
4
|
export declare function createUpdateEventTaskTool(context: ToolRuntimeContext, catalog: ResourceEventCatalog): Omit<import("./definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
|
|
5
5
|
inputSchema: import("./definition").JsonSchemaObject;
|
|
6
6
|
outputSchema: import("./definition").JsonSchemaObject;
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
juniorConversations,
|
|
9
9
|
juniorIdentities,
|
|
10
10
|
juniorUsers
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-5S6AQFNG.js";
|
|
12
12
|
import {
|
|
13
13
|
conversationEventDataSchema,
|
|
14
14
|
decodeStoredConversationEvent,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./chunk-VFUK3X5B.js";
|
|
21
21
|
import {
|
|
22
22
|
getChatConfig
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-WJJDQLVL.js";
|
|
24
24
|
import {
|
|
25
25
|
parseActorUserId,
|
|
26
26
|
parseSlackChannelReferenceId,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from "./chunk-N7TMSOZH.js";
|
|
29
29
|
import {
|
|
30
30
|
normalizeIdentityEmail
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-QY2IU47O.js";
|
|
32
32
|
|
|
33
33
|
// src/chat/conversations/sql/store.ts
|
|
34
34
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -271,7 +271,7 @@ function normalizeSessionSource(value) {
|
|
|
271
271
|
conversationId: value.conversationId
|
|
272
272
|
};
|
|
273
273
|
}
|
|
274
|
-
if (value.kind === "resource_event") {
|
|
274
|
+
if (value.kind === "resource_event" || value.kind === "scheduled_task" || value.kind === "event_task" || value.kind === "plugin_dispatch" || value.kind === "agent_invocation") {
|
|
275
275
|
return void 0;
|
|
276
276
|
}
|
|
277
277
|
const threadTs = value.threadTs?.trim();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pluginCatalogRuntime
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DXFUYLHX.js";
|
|
4
4
|
import {
|
|
5
5
|
skillRoots
|
|
6
6
|
} from "./chunk-TXKUKMVO.js";
|
|
7
7
|
import {
|
|
8
8
|
logWarn
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QY2IU47O.js";
|
|
10
10
|
|
|
11
11
|
// src/chat/skills.ts
|
|
12
12
|
import fs from "fs/promises";
|
|
@@ -19,23 +19,23 @@ import {
|
|
|
19
19
|
releaseConversationWork,
|
|
20
20
|
requestAnotherSlice,
|
|
21
21
|
startConversationWork
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-5LEVZYXF.js";
|
|
23
23
|
import {
|
|
24
24
|
getTurnRequestDeadline
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-IQCL5JGL.js";
|
|
26
26
|
import {
|
|
27
27
|
ConversationQueueMessageRejectedError
|
|
28
28
|
} from "./chunk-JAL3CH4G.js";
|
|
29
29
|
import {
|
|
30
30
|
getChatConfig,
|
|
31
31
|
isProviderRetryError
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-WJJDQLVL.js";
|
|
33
33
|
import {
|
|
34
34
|
logException,
|
|
35
35
|
logInfo,
|
|
36
36
|
logWarn,
|
|
37
37
|
withLogContext
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-QY2IU47O.js";
|
|
39
39
|
|
|
40
40
|
// src/chat/task-execution/worker.ts
|
|
41
41
|
var CONVERSATION_WORK_DEFER_DELAY_MS = 15e3;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
coerceThreadConversationState,
|
|
3
3
|
getPersistedThreadState
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-S5HS6WRH.js";
|
|
5
5
|
import {
|
|
6
6
|
recordTaskExecution
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GUMBIDDL.js";
|
|
8
8
|
import {
|
|
9
9
|
pluginTaskId,
|
|
10
10
|
pluginTaskParamsSchema,
|
|
11
11
|
sendVercelPluginTask
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-N6Q2PNSI.js";
|
|
13
13
|
import {
|
|
14
14
|
getPiMessageRole,
|
|
15
15
|
getTurnRecord,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
isToolResultMessage,
|
|
20
20
|
normalizeToolNameFromResult,
|
|
21
21
|
stripRuntimeTurnContext
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-ZFPEPWOO.js";
|
|
23
23
|
import {
|
|
24
24
|
createPluginConversationEvents,
|
|
25
25
|
createPluginEmbedder,
|
|
@@ -28,17 +28,17 @@ import {
|
|
|
28
28
|
createPluginState,
|
|
29
29
|
getPlugins,
|
|
30
30
|
readActorIdentity
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-FQ5HFSFR.js";
|
|
32
32
|
import {
|
|
33
33
|
JUNIOR_THREAD_STATE_TTL_MS
|
|
34
34
|
} from "./chunk-3Y47VMHV.js";
|
|
35
35
|
import {
|
|
36
36
|
getConversationStore,
|
|
37
37
|
getDb
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-2CYWEVOP.js";
|
|
39
39
|
import {
|
|
40
40
|
getStateAdapter
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-IOUUS6H4.js";
|
|
42
42
|
import {
|
|
43
43
|
sameActorIdentity
|
|
44
44
|
} from "./chunk-GFBR4S3Q.js";
|
|
@@ -84,7 +84,7 @@ function slackSourceForDestination(args) {
|
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
async function resolveConversationRouting(args) {
|
|
87
|
-
const conversationStore = args.conversationStore ?? (await import("./db-
|
|
87
|
+
const conversationStore = args.conversationStore ?? (await import("./db-H5MDRQEY.js")).getConversationStore();
|
|
88
88
|
const chain = await loadConversationChain(
|
|
89
89
|
args.conversationId,
|
|
90
90
|
conversationStore
|
|
@@ -579,14 +579,14 @@ function turnMessagesWithProvenance(record) {
|
|
|
579
579
|
}
|
|
580
580
|
return paired;
|
|
581
581
|
}
|
|
582
|
-
function slackContextAuthor(
|
|
582
|
+
function slackContextAuthor(location, message) {
|
|
583
583
|
const userId = message.author?.userId?.trim();
|
|
584
584
|
if (!userId) {
|
|
585
585
|
return void 0;
|
|
586
586
|
}
|
|
587
587
|
return {
|
|
588
588
|
platform: "slack",
|
|
589
|
-
teamId:
|
|
589
|
+
teamId: location.teamId,
|
|
590
590
|
userId,
|
|
591
591
|
...message.author?.userName ? { userName: message.author.userName } : void 0,
|
|
592
592
|
...message.author?.fullName ? { fullName: message.author.fullName } : void 0
|
|
@@ -610,17 +610,9 @@ function messageExistedAtRunCompletion(message, completedAtMs) {
|
|
|
610
610
|
const messageTimestampMs = conversationMessageTimestampMs(message);
|
|
611
611
|
return messageTimestampMs !== void 0 && messageTimestampMs <= completedAtMs;
|
|
612
612
|
}
|
|
613
|
-
async function loadConversationContextTranscriptEntries(record,
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
if (source.visibility === "private") {
|
|
617
|
-
return [];
|
|
618
|
-
}
|
|
619
|
-
break;
|
|
620
|
-
case "web":
|
|
621
|
-
case "local":
|
|
622
|
-
case "resource_event":
|
|
623
|
-
return [];
|
|
613
|
+
async function loadConversationContextTranscriptEntries(record, location, visibility, runActor) {
|
|
614
|
+
if (location?.provider !== "slack" || visibility !== "public") {
|
|
615
|
+
return [];
|
|
624
616
|
}
|
|
625
617
|
const state = await getPersistedThreadState(record.conversationId);
|
|
626
618
|
const conversation = coerceThreadConversationState(state);
|
|
@@ -640,7 +632,7 @@ async function loadConversationContextTranscriptEntries(record, source, runActor
|
|
|
640
632
|
if (!text) {
|
|
641
633
|
continue;
|
|
642
634
|
}
|
|
643
|
-
const author = slackContextAuthor(
|
|
635
|
+
const author = slackContextAuthor(location, message);
|
|
644
636
|
entries.push({
|
|
645
637
|
type: "message",
|
|
646
638
|
role: "user",
|
|
@@ -678,7 +670,21 @@ async function loadPluginRun(params) {
|
|
|
678
670
|
if (record.state !== "completed") {
|
|
679
671
|
throw new Error("Completed plugin task session record is not completed");
|
|
680
672
|
}
|
|
681
|
-
const
|
|
673
|
+
const conversationStore = getConversationStore();
|
|
674
|
+
const routing = await resolveConversationRouting({
|
|
675
|
+
conversationId: params.conversationId,
|
|
676
|
+
conversationStore
|
|
677
|
+
});
|
|
678
|
+
if (!routing) {
|
|
679
|
+
throw new Error(
|
|
680
|
+
`Conversation ${params.conversationId} is missing durable routing metadata`
|
|
681
|
+
);
|
|
682
|
+
}
|
|
683
|
+
const source = record.source ?? routing.source;
|
|
684
|
+
if (!source) {
|
|
685
|
+
throw new Error("Completed plugin task session record is missing Source");
|
|
686
|
+
}
|
|
687
|
+
const conversation = await conversationStore.get({
|
|
682
688
|
conversationId: params.conversationId
|
|
683
689
|
});
|
|
684
690
|
const runActor = record.actor ?? record.actors[0] ?? (record.dispatchId ? (await getDispatchRecord(record.dispatchId))?.actor : void 0);
|
|
@@ -691,7 +697,8 @@ async function loadPluginRun(params) {
|
|
|
691
697
|
);
|
|
692
698
|
const contextEntries = (await loadConversationContextTranscriptEntries(
|
|
693
699
|
record,
|
|
694
|
-
|
|
700
|
+
conversation?.location,
|
|
701
|
+
conversation?.visibility,
|
|
695
702
|
runActor
|
|
696
703
|
)).filter(
|
|
697
704
|
(entry) => entry.type !== "message" || !runMessageTexts.has(entry.text)
|
|
@@ -707,7 +714,7 @@ async function loadPluginRun(params) {
|
|
|
707
714
|
actors: record.actors,
|
|
708
715
|
...runActor ? { actor: runActor } : void 0,
|
|
709
716
|
runId: record.turnId,
|
|
710
|
-
source
|
|
717
|
+
source,
|
|
711
718
|
transcript: [...contextEntries, ...runEntries]
|
|
712
719
|
});
|
|
713
720
|
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
AgentRunError,
|
|
6
6
|
executeTurn
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DVU734PI.js";
|
|
8
8
|
import {
|
|
9
9
|
buildDeliveredTurnStatePatch,
|
|
10
10
|
finalizeFailedTurnReplyWithEvent,
|
|
@@ -15,14 +15,14 @@ import {
|
|
|
15
15
|
getTurnUserSlackMessageTs,
|
|
16
16
|
persistAuthPauseTurnState,
|
|
17
17
|
requireTurnFailureEventId
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-GTXQHZ2O.js";
|
|
19
19
|
import {
|
|
20
20
|
resolveTurnSessionRouting,
|
|
21
21
|
scheduleSessionCompletedPluginTasks
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-4UA5C7AM.js";
|
|
23
23
|
import {
|
|
24
24
|
getTurnLifecycle
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-WH5VV2RW.js";
|
|
26
26
|
import {
|
|
27
27
|
coerceThreadConversationState,
|
|
28
28
|
configValueSchema,
|
|
@@ -30,11 +30,11 @@ import {
|
|
|
30
30
|
getPersistedSandboxState,
|
|
31
31
|
getPersistedThreadState,
|
|
32
32
|
persistThreadStateById
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-S5HS6WRH.js";
|
|
34
34
|
import {
|
|
35
35
|
buildSentryConversationUrl,
|
|
36
36
|
deleteWebAuthorization
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-THYNA2QN.js";
|
|
38
38
|
import {
|
|
39
39
|
createUserTokenStore,
|
|
40
40
|
deleteMcpAuthSession,
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
lookupSlackUserProfile,
|
|
46
46
|
putMcpStoredOAuthCredentials,
|
|
47
47
|
resolvePluginOAuthAccount
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-D4XQZOHB.js";
|
|
49
49
|
import {
|
|
50
50
|
RetryableDeliveryError,
|
|
51
51
|
addReactionToMessage,
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
removeReactionFromMessage,
|
|
60
60
|
resolveBaseUrl,
|
|
61
61
|
truncateStatusText
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-COCVPDWX.js";
|
|
63
63
|
import {
|
|
64
64
|
CooperativeTurnYieldError,
|
|
65
65
|
clearPendingAuth,
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
isCooperativeTurnYieldError,
|
|
69
69
|
isPendingAuthLatestRequest,
|
|
70
70
|
markTurnFailed
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-K47OVEO4.js";
|
|
72
72
|
import {
|
|
73
73
|
TurnSliceLimitExceededError,
|
|
74
74
|
abandonTurnRecord,
|
|
@@ -88,20 +88,20 @@ import {
|
|
|
88
88
|
recordTurnSummary,
|
|
89
89
|
saveTurnCheckpoint,
|
|
90
90
|
turnHasReply
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-ZFPEPWOO.js";
|
|
92
92
|
import {
|
|
93
93
|
parseSlackThreadId,
|
|
94
94
|
readSlackRawMessageContext,
|
|
95
95
|
resolveSlackChannelIdFromMessage,
|
|
96
96
|
resolveSlackChannelIdFromThreadId
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-HMBTX5RK.js";
|
|
98
98
|
import {
|
|
99
99
|
ensureConversationWake,
|
|
100
100
|
requestConversationWork
|
|
101
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-5LEVZYXF.js";
|
|
102
102
|
import {
|
|
103
103
|
getTurnRequestDeadline
|
|
104
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-IQCL5JGL.js";
|
|
105
105
|
import {
|
|
106
106
|
getVercelConversationWorkQueue
|
|
107
107
|
} from "./chunk-DKIJ2RP5.js";
|
|
@@ -113,39 +113,39 @@ import {
|
|
|
113
113
|
getSlackClient,
|
|
114
114
|
isDmChannel,
|
|
115
115
|
normalizeSlackConversationId
|
|
116
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-FQ5HFSFR.js";
|
|
117
117
|
import {
|
|
118
118
|
getConversationStore,
|
|
119
119
|
getSqlExecutor,
|
|
120
120
|
requireSlackDestination,
|
|
121
121
|
upsertIdentity,
|
|
122
122
|
upsertLinkedIdentity
|
|
123
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-2CYWEVOP.js";
|
|
124
124
|
import {
|
|
125
125
|
acquireActiveLock,
|
|
126
126
|
getStateAdapter
|
|
127
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-IOUUS6H4.js";
|
|
128
128
|
import {
|
|
129
129
|
botConfig,
|
|
130
130
|
escapeXml,
|
|
131
131
|
getChatConfig,
|
|
132
132
|
getRuntimeMetadata,
|
|
133
133
|
normalizeSlackEmojiName
|
|
134
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-WJJDQLVL.js";
|
|
135
135
|
import {
|
|
136
136
|
defaultModelId
|
|
137
137
|
} from "./chunk-D4YV5TDV.js";
|
|
138
138
|
import {
|
|
139
139
|
discoverSkills
|
|
140
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-3YZ2Q6AW.js";
|
|
141
141
|
import {
|
|
142
142
|
pluginCatalogRuntime
|
|
143
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-DXFUYLHX.js";
|
|
144
144
|
import {
|
|
145
145
|
buildOAuthTokenRequest,
|
|
146
146
|
hasRequiredOAuthScope,
|
|
147
147
|
parseOAuthTokenResponse
|
|
148
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-QWY4KI2V.js";
|
|
149
149
|
import {
|
|
150
150
|
createSlackResumeActor,
|
|
151
151
|
isUserActor,
|
|
@@ -164,7 +164,7 @@ import {
|
|
|
164
164
|
setTags,
|
|
165
165
|
toOptionalString,
|
|
166
166
|
withLogContext
|
|
167
|
-
} from "./chunk-
|
|
167
|
+
} from "./chunk-QY2IU47O.js";
|
|
168
168
|
|
|
169
169
|
// src/chat/slack/assistant-thread/status-render.ts
|
|
170
170
|
var DEFAULT_STATUS_CONTEXTS = {
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
getConversationStore,
|
|
9
9
|
parseDestination,
|
|
10
10
|
sameDestination
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-2CYWEVOP.js";
|
|
12
12
|
import {
|
|
13
13
|
getDefaultRedisStateAdapterFor,
|
|
14
14
|
getStateAdapter
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-IOUUS6H4.js";
|
|
16
16
|
import {
|
|
17
17
|
getChatConfig
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-WJJDQLVL.js";
|
|
19
19
|
import {
|
|
20
20
|
parseStoredSlackActor
|
|
21
21
|
} from "./chunk-N7TMSOZH.js";
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
isRecord,
|
|
24
24
|
toOptionalNumber,
|
|
25
25
|
toOptionalString
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-QY2IU47O.js";
|
|
27
27
|
|
|
28
28
|
// src/chat/task-execution/state.ts
|
|
29
29
|
import { randomUUID } from "crypto";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentRunError,
|
|
3
3
|
executeTurn
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DVU734PI.js";
|
|
5
5
|
import {
|
|
6
6
|
ConversationTurnLifecycleService
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WH5VV2RW.js";
|
|
8
8
|
import {
|
|
9
9
|
getPersistedSandboxState,
|
|
10
10
|
getPersistedThreadState,
|
|
11
11
|
persistThreadStateById
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-S5HS6WRH.js";
|
|
13
13
|
import {
|
|
14
14
|
AgentInvocationBusyError,
|
|
15
15
|
AgentInvocationLimitError,
|
|
@@ -18,32 +18,32 @@ import {
|
|
|
18
18
|
agentBindingSchema,
|
|
19
19
|
agentInvocationSchema,
|
|
20
20
|
createAgentInvocationSchema
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-LXRTHE43.js";
|
|
22
22
|
import {
|
|
23
23
|
TurnInputCommitLostError,
|
|
24
24
|
getAssistantReplyText,
|
|
25
25
|
getConversationTurnBoundaryError,
|
|
26
26
|
isTurnInputCommitLostError
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-K47OVEO4.js";
|
|
28
28
|
import {
|
|
29
29
|
failTurnRecord,
|
|
30
30
|
getTerminalAssistantMessages,
|
|
31
31
|
getTurnRecord,
|
|
32
32
|
openConversationProjection,
|
|
33
33
|
saveTurnCheckpoint
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-ZFPEPWOO.js";
|
|
35
35
|
import {
|
|
36
36
|
appendAndEnqueueInboundMessage
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-5LEVZYXF.js";
|
|
38
38
|
import {
|
|
39
39
|
getConversationEventStore,
|
|
40
40
|
getConversationStore,
|
|
41
41
|
getSqlExecutor
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-2CYWEVOP.js";
|
|
43
43
|
import {
|
|
44
44
|
juniorAgentBindings,
|
|
45
45
|
juniorAgentInvocations
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-5S6AQFNG.js";
|
|
47
47
|
|
|
48
48
|
// src/chat/agent-invocations/work.ts
|
|
49
49
|
import { z } from "zod";
|
|
@@ -111,7 +111,7 @@ function invocationFromRow(row) {
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
function sameCreateInput(invocation, input) {
|
|
114
|
-
return invocation.parentConversationId === input.parentConversationId && invocation.agentName === input.agentName && invocation.input === input.input && invocation.reasoningLevel === input.reasoningLevel && JSON.stringify(invocation.actor) === JSON.stringify(input.actor) && JSON.stringify(invocation.credentialContext) === JSON.stringify(input.credentialContext) && JSON.stringify(invocation.destination) === JSON.stringify(input.destination)
|
|
114
|
+
return invocation.parentConversationId === input.parentConversationId && invocation.agentName === input.agentName && invocation.input === input.input && invocation.reasoningLevel === input.reasoningLevel && JSON.stringify(invocation.actor) === JSON.stringify(input.actor) && JSON.stringify(invocation.credentialContext) === JSON.stringify(input.credentialContext) && JSON.stringify(invocation.destination) === JSON.stringify(input.destination);
|
|
115
115
|
}
|
|
116
116
|
async function getAgentBinding(args) {
|
|
117
117
|
const rows = await getSqlExecutor().db().select().from(juniorAgentBindings).where(
|
|
@@ -223,7 +223,7 @@ async function createAgentInvocation(rawInput, nowMs = Date.now()) {
|
|
|
223
223
|
input: input.input,
|
|
224
224
|
actor: input.actor,
|
|
225
225
|
credentialContext: input.credentialContext ?? null,
|
|
226
|
-
source:
|
|
226
|
+
source: { kind: "agent_invocation" },
|
|
227
227
|
destination: input.destination,
|
|
228
228
|
reasoningLevel: input.reasoningLevel ?? null,
|
|
229
229
|
status: "pending",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ToolInputError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-D5YQPCEG.js";
|
|
4
4
|
import {
|
|
5
5
|
getPlugins
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FQ5HFSFR.js";
|
|
7
7
|
import {
|
|
8
8
|
getDb
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-2CYWEVOP.js";
|
|
10
10
|
import {
|
|
11
11
|
juniorAttachments,
|
|
12
12
|
juniorConversations,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
juniorSchedulerRuns,
|
|
15
15
|
juniorSchedulerTasks,
|
|
16
16
|
juniorStats
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-5S6AQFNG.js";
|
|
18
18
|
import {
|
|
19
19
|
juniorDestinations
|
|
20
20
|
} from "./chunk-VFUK3X5B.js";
|
|
@@ -560,13 +560,17 @@ function requireEventTaskSlackContext(context) {
|
|
|
560
560
|
function eventTaskMatchesDestination(task, destination) {
|
|
561
561
|
return task.destination.teamId === destination.teamId && task.destination.channelId === destination.channelId;
|
|
562
562
|
}
|
|
563
|
+
function eventTaskIsWritableFrom(task, destination) {
|
|
564
|
+
if (task.destination.teamId !== destination.teamId) {
|
|
565
|
+
return false;
|
|
566
|
+
}
|
|
567
|
+
return task.destination.channelId === destination.channelId || task.destinationVisibility === "public";
|
|
568
|
+
}
|
|
563
569
|
async function writableEventTask(context, id) {
|
|
564
570
|
const { destination } = requireEventTaskSlackContext(context);
|
|
565
571
|
const task = await getEventTask(getDb(), id);
|
|
566
|
-
if (!task || !
|
|
567
|
-
throw new ToolInputError(
|
|
568
|
-
"Event task was not found in this Slack channel or DM."
|
|
569
|
-
);
|
|
572
|
+
if (!task || !eventTaskIsWritableFrom(task, destination)) {
|
|
573
|
+
throw new ToolInputError("Event task was not found.");
|
|
570
574
|
}
|
|
571
575
|
return task;
|
|
572
576
|
}
|
|
@@ -8,19 +8,19 @@ import {
|
|
|
8
8
|
isDmChannel,
|
|
9
9
|
normalizeSlackConversationId,
|
|
10
10
|
withSlackRetries
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FQ5HFSFR.js";
|
|
12
12
|
import {
|
|
13
13
|
parseDestination
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-2CYWEVOP.js";
|
|
15
15
|
import {
|
|
16
16
|
getStateAdapter
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-IOUUS6H4.js";
|
|
18
18
|
import {
|
|
19
19
|
normalizeSlackEmojiName
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-WJJDQLVL.js";
|
|
21
21
|
import {
|
|
22
22
|
pluginCatalogRuntime
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-DXFUYLHX.js";
|
|
24
24
|
import {
|
|
25
25
|
parseSlackMessageTs,
|
|
26
26
|
parseSlackUserId
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
isRecord,
|
|
30
30
|
logInfo,
|
|
31
31
|
logWarn
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-QY2IU47O.js";
|
|
33
33
|
|
|
34
34
|
// src/chat/agent/types.ts
|
|
35
35
|
var RetryableDeliveryError = class extends Error {
|
|
@@ -109,7 +109,11 @@ function assertRunConsistency(run) {
|
|
|
109
109
|
break;
|
|
110
110
|
}
|
|
111
111
|
case "resource_event":
|
|
112
|
-
|
|
112
|
+
case "scheduled_task":
|
|
113
|
+
case "event_task":
|
|
114
|
+
case "plugin_dispatch":
|
|
115
|
+
case "agent_invocation":
|
|
116
|
+
return;
|
|
113
117
|
}
|
|
114
118
|
const actor = run.dispatch?.actor ?? run.actor;
|
|
115
119
|
if (!actor || actor.platform === "system") {
|