@sentry/junior 0.97.1 → 0.98.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-XSUIVRQS.js → agent-hooks-OSW6C3CJ.js} +2 -2
- package/dist/api/conversations/detail.d.ts +1 -1
- package/dist/api/conversations/detail.query.d.ts +1 -1
- package/dist/api/conversations/projection.d.ts +0 -1
- package/dist/api/conversations/schema.d.ts +31 -8
- package/dist/api/people/schema.d.ts +0 -11
- package/dist/api/people/shared.d.ts +2 -4
- package/dist/api/schema.d.ts +1 -1
- package/dist/api/schema.js +2 -2
- package/dist/api-reference.d.ts +1 -1
- package/dist/api.js +10 -10
- package/dist/app.js +39 -28
- package/dist/chat/conversations/search.d.ts +24 -0
- package/dist/chat/conversations/sql/search.d.ts +4 -0
- package/dist/chat/db.d.ts +3 -0
- package/dist/chat/runtime/report-progress.d.ts +3 -0
- package/dist/chat/runtime/slack-resume.d.ts +2 -0
- package/dist/chat/slack/assistant-thread/status-scheduler.d.ts +4 -3
- package/dist/chat/slack/outbound.d.ts +6 -0
- package/dist/chat/slack/tools/conversation-search.d.ts +71 -0
- package/dist/chat/state/turn-session.d.ts +2 -0
- package/dist/chat/tool-support/zod-tool.d.ts +1 -1
- package/dist/chunk-6DTVCPLO.js +146 -0
- package/dist/{chunk-AUUCAFDE.js → chunk-6HHEZENZ.js} +126 -11
- package/dist/{chunk-VFH4ZKZT.js → chunk-CRQVIHDI.js} +1 -3
- package/dist/{chunk-6U26PYI5.js → chunk-CV22LUIV.js} +7 -17
- package/dist/{chunk-GUAP3H7O.js → chunk-DHHU2WSG.js} +2 -2
- package/dist/{chunk-XIRPQQVE.js → chunk-DPHWDS6I.js} +297 -171
- package/dist/{chunk-T533JLM3.js → chunk-ER45IV77.js} +8 -6
- package/dist/{chunk-LUAE4MGW.js → chunk-EUZ44ROE.js} +21 -4
- package/dist/{chunk-5HLDPVYS.js → chunk-FTTFV6DC.js} +1 -1
- package/dist/{chunk-3F4OPKGF.js → chunk-IO65E4ZD.js} +2 -2
- package/dist/{chunk-ON6YKIQ7.js → chunk-KJHAW6VE.js} +4 -10
- package/dist/{chunk-FBHZJFHI.js → chunk-NJEDJFK4.js} +1 -1
- package/dist/{chunk-35BNLDOJ.js → chunk-OGHXZ4KQ.js} +134 -57
- package/dist/{chunk-WJOSZOON.js → chunk-OL6XQ23W.js} +11 -150
- package/dist/{chunk-WGXMTFNU.js → chunk-WJ7STXT6.js} +5 -3
- package/dist/cli/chat.js +11 -10
- package/dist/cli/plugins.js +2 -2
- package/dist/cli/upgrade.js +9 -7
- package/dist/{db-BWXYIKFQ.js → db-GFSCDAHS.js} +3 -1
- package/dist/detail-W4ZSD45K.js +67 -0
- package/dist/{legacy-import-3NQJVGQL.js → legacy-import-6WWXMALY.js} +2 -2
- package/dist/{list-UXJI5Q5X.js → list-3KZNG3SJ.js} +3 -3
- package/dist/{list-A3WFRIYX.js → list-M5BRWW3D.js} +5 -6
- package/dist/{plugin-conversations-DDNGC35A.js → plugin-conversations-ZYRWZYEA.js} +2 -2
- package/dist/{profile-4RYDXWTF.js → profile-UEIRSVT3.js} +5 -5
- package/dist/{runner-JALSYH2P.js → runner-267ZRLZD.js} +8 -7
- package/dist/{stats-XKXH3PTY.js → stats-L62E4O4U.js} +7 -17
- package/dist/{subagent-TZ55XY37.js → subagent-5HZPQC7V.js} +6 -6
- package/migrations/0002_conversation_message_search.sql +1 -0
- package/migrations/meta/0002_snapshot.json +987 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +6 -6
- package/dist/detail-GA6NXWQJ.js +0 -43
|
@@ -10,12 +10,14 @@ import {
|
|
|
10
10
|
persistRunningSessionRecord,
|
|
11
11
|
persistTimeoutSessionRecord,
|
|
12
12
|
persistYieldSessionRecord
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WJ7STXT6.js";
|
|
14
|
+
import {
|
|
15
|
+
JUNIOR_THREAD_STATE_TTL_MS
|
|
16
|
+
} from "./chunk-6DTVCPLO.js";
|
|
14
17
|
import {
|
|
15
|
-
JUNIOR_THREAD_STATE_TTL_MS,
|
|
16
18
|
addAgentTurnUsage,
|
|
17
19
|
hasAgentTurnUsage
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-OL6XQ23W.js";
|
|
19
21
|
import {
|
|
20
22
|
loadConnectedMcpProviders,
|
|
21
23
|
loadConversationProjection,
|
|
@@ -23,12 +25,12 @@ import {
|
|
|
23
25
|
recordAuthorizationRequested,
|
|
24
26
|
recordMcpProviderConnected,
|
|
25
27
|
recordToolExecutionStarted
|
|
26
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-DHHU2WSG.js";
|
|
27
29
|
import {
|
|
28
30
|
estimateTextTokens,
|
|
29
31
|
getAgentContextCompactionTriggerTokens,
|
|
30
32
|
updateConversationStats
|
|
31
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-IO65E4ZD.js";
|
|
32
34
|
import {
|
|
33
35
|
buildNonInteractiveShellScript,
|
|
34
36
|
createSandboxInstance,
|
|
@@ -50,7 +52,7 @@ import {
|
|
|
50
52
|
getPlugins,
|
|
51
53
|
getSlackToolContext,
|
|
52
54
|
resolveChannelCapabilities
|
|
53
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-FTTFV6DC.js";
|
|
54
56
|
import {
|
|
55
57
|
SlackActionError,
|
|
56
58
|
downloadPrivateSlackFile,
|
|
@@ -67,11 +69,12 @@ import {
|
|
|
67
69
|
import {
|
|
68
70
|
contextProvenance,
|
|
69
71
|
getAgentStepStore,
|
|
72
|
+
getConversationSearchStore,
|
|
70
73
|
getConversationStore,
|
|
71
74
|
getDb,
|
|
72
75
|
instructionActors,
|
|
73
76
|
instructionProvenanceFor
|
|
74
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-OGHXZ4KQ.js";
|
|
75
78
|
import {
|
|
76
79
|
SANDBOX_DATA_ROOT,
|
|
77
80
|
SANDBOX_SKILLS_ROOT,
|
|
@@ -6332,6 +6335,9 @@ function createSlackChannelListMessagesTool(context) {
|
|
|
6332
6335
|
});
|
|
6333
6336
|
}
|
|
6334
6337
|
|
|
6338
|
+
// src/chat/slack/tools/conversation-search.ts
|
|
6339
|
+
import { z as z19 } from "zod";
|
|
6340
|
+
|
|
6335
6341
|
// src/chat/slack/outbound.ts
|
|
6336
6342
|
var MAX_SLACK_MESSAGE_TEXT_CHARS = 4e4;
|
|
6337
6343
|
function requireSlackConversationId(channelId, action) {
|
|
@@ -6366,7 +6372,7 @@ function requireSlackMessageText(text, action) {
|
|
|
6366
6372
|
}
|
|
6367
6373
|
return text;
|
|
6368
6374
|
}
|
|
6369
|
-
async function
|
|
6375
|
+
async function getSlackMessagePermalink(args) {
|
|
6370
6376
|
try {
|
|
6371
6377
|
const response = await withSlackRetries(
|
|
6372
6378
|
() => getSlackClient().chat.getPermalink({
|
|
@@ -6423,7 +6429,7 @@ async function postSlackMessage(input) {
|
|
|
6423
6429
|
return {
|
|
6424
6430
|
ts: messageTs,
|
|
6425
6431
|
...input.includePermalink ? {
|
|
6426
|
-
permalink: await
|
|
6432
|
+
permalink: await getSlackMessagePermalink({
|
|
6427
6433
|
channelId,
|
|
6428
6434
|
messageTs
|
|
6429
6435
|
})
|
|
@@ -6591,8 +6597,82 @@ async function removeReactionFromMessage(input) {
|
|
|
6591
6597
|
return { ok: true };
|
|
6592
6598
|
}
|
|
6593
6599
|
|
|
6600
|
+
// src/chat/slack/tools/conversation-search.ts
|
|
6601
|
+
var DEFAULT_LIMIT = 5;
|
|
6602
|
+
var conversationSearchOutputSchema = juniorToolResultSchema.extend({
|
|
6603
|
+
query: z19.string(),
|
|
6604
|
+
count: z19.number().int().nonnegative(),
|
|
6605
|
+
threads: z19.array(
|
|
6606
|
+
z19.object({
|
|
6607
|
+
conversation_id: z19.string().min(1),
|
|
6608
|
+
thread_ts: z19.string().min(1),
|
|
6609
|
+
message_id: z19.string().min(1),
|
|
6610
|
+
message_role: z19.enum(["assistant", "user"]),
|
|
6611
|
+
message_timestamp: z19.string().datetime(),
|
|
6612
|
+
excerpt: z19.string(),
|
|
6613
|
+
permalink: z19.string().url().optional()
|
|
6614
|
+
}).strict()
|
|
6615
|
+
)
|
|
6616
|
+
});
|
|
6617
|
+
function createSlackConversationSearchTool(scope, currentConversationId, deps = {}) {
|
|
6618
|
+
return zodTool({
|
|
6619
|
+
description: "Search prior public Junior conversation threads across the current Slack workspace. Use when the user refers to an earlier public discussion, decision, or answer that is not in the current thread. Searches retained visible user and assistant messages only.",
|
|
6620
|
+
exposure: "deferred",
|
|
6621
|
+
source: {
|
|
6622
|
+
id: "conversation-history",
|
|
6623
|
+
description: "Search retained public Junior conversation threads in the current Slack workspace."
|
|
6624
|
+
},
|
|
6625
|
+
annotations: { readOnlyHint: true, destructiveHint: false },
|
|
6626
|
+
inputSchema: z19.object({
|
|
6627
|
+
query: z19.string().trim().min(1).max(200).describe("Words or a short phrase to find in prior conversations."),
|
|
6628
|
+
limit: z19.number().int().min(1).max(10).describe("Maximum number of prior conversation threads to return.").nullable().optional()
|
|
6629
|
+
}),
|
|
6630
|
+
outputSchema: conversationSearchOutputSchema,
|
|
6631
|
+
execute: async ({ query, limit }) => {
|
|
6632
|
+
const store = deps.store ?? getConversationSearchStore();
|
|
6633
|
+
const matches = await store.search({
|
|
6634
|
+
currentConversationId,
|
|
6635
|
+
limit: limit ?? DEFAULT_LIMIT,
|
|
6636
|
+
query,
|
|
6637
|
+
scope
|
|
6638
|
+
});
|
|
6639
|
+
const getPermalink = deps.getPermalink ?? getSlackMessagePermalink;
|
|
6640
|
+
const threads = await Promise.all(
|
|
6641
|
+
matches.map(async (match) => {
|
|
6642
|
+
const reference = parseSlackThreadId(match.conversationId);
|
|
6643
|
+
if (!reference || reference.channelId !== match.providerDestinationId) {
|
|
6644
|
+
throw new Error(
|
|
6645
|
+
"Stored Slack conversation search returned an invalid destination"
|
|
6646
|
+
);
|
|
6647
|
+
}
|
|
6648
|
+
const permalink = await getPermalink({
|
|
6649
|
+
channelId: reference.channelId,
|
|
6650
|
+
messageTs: reference.threadTs
|
|
6651
|
+
});
|
|
6652
|
+
return {
|
|
6653
|
+
conversation_id: match.conversationId,
|
|
6654
|
+
thread_ts: reference.threadTs,
|
|
6655
|
+
message_id: match.messageId,
|
|
6656
|
+
message_role: match.role,
|
|
6657
|
+
message_timestamp: new Date(match.messageCreatedAtMs).toISOString(),
|
|
6658
|
+
excerpt: match.excerpt,
|
|
6659
|
+
...permalink ? { permalink } : {}
|
|
6660
|
+
};
|
|
6661
|
+
})
|
|
6662
|
+
);
|
|
6663
|
+
return {
|
|
6664
|
+
ok: true,
|
|
6665
|
+
status: "success",
|
|
6666
|
+
query,
|
|
6667
|
+
count: threads.length,
|
|
6668
|
+
threads
|
|
6669
|
+
};
|
|
6670
|
+
}
|
|
6671
|
+
});
|
|
6672
|
+
}
|
|
6673
|
+
|
|
6594
6674
|
// src/chat/slack/tools/message-add-reaction.ts
|
|
6595
|
-
import { z as
|
|
6675
|
+
import { z as z20 } from "zod";
|
|
6596
6676
|
|
|
6597
6677
|
// src/chat/tools/idempotency.ts
|
|
6598
6678
|
function stableSerialize(value) {
|
|
@@ -6614,8 +6694,8 @@ function createOperationKey(toolName, input) {
|
|
|
6614
6694
|
function createSlackMessageAddReactionTool(context, state) {
|
|
6615
6695
|
return zodTool({
|
|
6616
6696
|
description: "Add an emoji reaction to the current inbound Slack message. Use when the user asks for a reaction on the current message without another target. Provide a Slack emoji alias name (for example `thumbsup`, `white_check_mark`, or `thumbsup::skin-tone-6`), not a unicode emoji glyph. The target message is injected by runtime context; do not use this for arbitrary historical messages.",
|
|
6617
|
-
inputSchema:
|
|
6618
|
-
emoji:
|
|
6697
|
+
inputSchema: z20.object({
|
|
6698
|
+
emoji: z20.string().min(1).max(64).describe(
|
|
6619
6699
|
"Slack emoji alias name to react with (for example `thumbsup`, `white_check_mark`, or `thumbsup::skin-tone-6`). Optional surrounding colons are allowed."
|
|
6620
6700
|
)
|
|
6621
6701
|
}),
|
|
@@ -6666,15 +6746,15 @@ function createSlackMessageAddReactionTool(context, state) {
|
|
|
6666
6746
|
|
|
6667
6747
|
// src/chat/slack/tools/send-message.ts
|
|
6668
6748
|
import { createHash as createHash2 } from "crypto";
|
|
6669
|
-
import { z as
|
|
6670
|
-
var fileInputSchema =
|
|
6671
|
-
path:
|
|
6749
|
+
import { z as z21 } from "zod";
|
|
6750
|
+
var fileInputSchema = z21.object({
|
|
6751
|
+
path: z21.string().min(1).describe(
|
|
6672
6752
|
"Sandbox file path to include in the message. Absolute paths and workspace-relative paths are supported."
|
|
6673
6753
|
),
|
|
6674
|
-
filename:
|
|
6754
|
+
filename: z21.string().min(1).nullable().optional().describe(
|
|
6675
6755
|
"Optional filename override shown in Slack. Null is treated as omitted."
|
|
6676
6756
|
),
|
|
6677
|
-
mimeType:
|
|
6757
|
+
mimeType: z21.string().min(1).nullable().optional().describe("Optional MIME type override. Null is treated as omitted.")
|
|
6678
6758
|
});
|
|
6679
6759
|
function hasText(text) {
|
|
6680
6760
|
return typeof text === "string" && text.trim().length > 0;
|
|
@@ -6701,9 +6781,9 @@ function fileOperationInput(files) {
|
|
|
6701
6781
|
function createSendMessageTool(context, state, materializeFile) {
|
|
6702
6782
|
return zodTool({
|
|
6703
6783
|
description: "Send a Slack message with optional files into the active Slack conversation. Use when the user asks to attach, send, or share files here, in this conversation, or in this thread. The message can contain text, files, or both; file-only messages are allowed. Do not use for top-level channel posts, other named channels, inline @mentions, or pinging mentioned users.",
|
|
6704
|
-
inputSchema:
|
|
6705
|
-
text:
|
|
6706
|
-
files:
|
|
6784
|
+
inputSchema: z21.object({
|
|
6785
|
+
text: z21.string().max(4e4).nullable().optional().describe("Slack mrkdwn text to send. Null is treated as omitted."),
|
|
6786
|
+
files: z21.array(fileInputSchema).min(1).nullable().optional().describe(
|
|
6707
6787
|
"Sandbox files to include in the message. Null is treated as omitted."
|
|
6708
6788
|
)
|
|
6709
6789
|
}),
|
|
@@ -7031,13 +7111,13 @@ function storedCanvasUrl(state, canvasId) {
|
|
|
7031
7111
|
}
|
|
7032
7112
|
|
|
7033
7113
|
// src/chat/slack/tools/canvas/create.ts
|
|
7034
|
-
import { z as
|
|
7114
|
+
import { z as z22 } from "zod";
|
|
7035
7115
|
function createSlackCanvasCreateTool(context, state) {
|
|
7036
7116
|
return zodTool({
|
|
7037
7117
|
description: "Create a Slack canvas for long-form output in the active assistant context channel. Use when the answer is better as a reusable document than a thread reply: long-form research, timelines, bios/profiles, structured notes, plans, comparisons, or anything likely to exceed one compact Slack reply. After creating it, reply with one or two short sentences plus the canvas link; do not recap the canvas contents. Do not use for short answers that fit cleanly in one normal thread reply.",
|
|
7038
|
-
inputSchema:
|
|
7039
|
-
title:
|
|
7040
|
-
markdown:
|
|
7118
|
+
inputSchema: z22.object({
|
|
7119
|
+
title: z22.string().min(1).max(160).describe("Canvas title."),
|
|
7120
|
+
markdown: z22.string().min(1).describe("Canvas markdown body content.")
|
|
7041
7121
|
}),
|
|
7042
7122
|
outputSchema: juniorToolResultSchema,
|
|
7043
7123
|
execute: async ({ title, markdown }) => {
|
|
@@ -7100,35 +7180,35 @@ function createSlackCanvasCreateTool(context, state) {
|
|
|
7100
7180
|
}
|
|
7101
7181
|
|
|
7102
7182
|
// src/chat/slack/tools/canvas/edit.ts
|
|
7103
|
-
import { z as
|
|
7183
|
+
import { z as z23 } from "zod";
|
|
7104
7184
|
function prepareCanvasEditArguments(input) {
|
|
7105
7185
|
return prepareTextReplacementArguments(input);
|
|
7106
7186
|
}
|
|
7107
|
-
var editReplacementSchema2 =
|
|
7108
|
-
oldText:
|
|
7187
|
+
var editReplacementSchema2 = z23.object({
|
|
7188
|
+
oldText: z23.string().min(1).describe(
|
|
7109
7189
|
"Exact Canvas markdown to replace. It must be unique in the current Canvas body and must not overlap another edit."
|
|
7110
7190
|
),
|
|
7111
|
-
newText:
|
|
7191
|
+
newText: z23.string().describe("Replacement Canvas markdown for this edit.")
|
|
7112
7192
|
});
|
|
7113
7193
|
var slackCanvasEditOutputSchema = juniorToolResultSchema.extend({
|
|
7114
|
-
canvas_id:
|
|
7115
|
-
title:
|
|
7116
|
-
permalink:
|
|
7117
|
-
diff:
|
|
7118
|
-
first_changed_line:
|
|
7119
|
-
replacements:
|
|
7120
|
-
normalized_heading_count:
|
|
7121
|
-
summary:
|
|
7122
|
-
deduplicated:
|
|
7194
|
+
canvas_id: z23.string().optional(),
|
|
7195
|
+
title: z23.string().optional(),
|
|
7196
|
+
permalink: z23.string().optional(),
|
|
7197
|
+
diff: z23.string().optional(),
|
|
7198
|
+
first_changed_line: z23.number().int().positive().optional(),
|
|
7199
|
+
replacements: z23.number().int().nonnegative().optional(),
|
|
7200
|
+
normalized_heading_count: z23.number().int().nonnegative().optional(),
|
|
7201
|
+
summary: z23.string().optional(),
|
|
7202
|
+
deduplicated: z23.boolean().optional()
|
|
7123
7203
|
}).strict();
|
|
7124
7204
|
function createSlackCanvasEditTool(state) {
|
|
7125
7205
|
return zodTool({
|
|
7126
7206
|
description: "Edit one Slack canvas with exact markdown replacements. Use for precise changes to existing Canvas content; prefer this over slackCanvasWrite for targeted changes. Each oldText must match exactly, be unique, and not overlap another edit. Returns a diff. Multiple changes to the same canvas: use one edits[] call.",
|
|
7127
7207
|
prepareArguments: prepareCanvasEditArguments,
|
|
7128
7208
|
executionMode: "sequential",
|
|
7129
|
-
inputSchema:
|
|
7130
|
-
canvas:
|
|
7131
|
-
edits:
|
|
7209
|
+
inputSchema: z23.object({
|
|
7210
|
+
canvas: z23.string().min(1).describe("Canvas/file ID (e.g. `F0ABCDEF`) or Slack canvas/docs URL."),
|
|
7211
|
+
edits: z23.array(editReplacementSchema2).min(1).describe(
|
|
7132
7212
|
"Exact replacements matched against the current Canvas body, not incrementally."
|
|
7133
7213
|
)
|
|
7134
7214
|
}),
|
|
@@ -7206,29 +7286,29 @@ function createSlackCanvasEditTool(state) {
|
|
|
7206
7286
|
}
|
|
7207
7287
|
|
|
7208
7288
|
// src/chat/slack/tools/canvas/read.ts
|
|
7209
|
-
import { z as
|
|
7289
|
+
import { z as z24 } from "zod";
|
|
7210
7290
|
var slackCanvasReadOutputSchema = juniorToolResultSchema.extend({
|
|
7211
|
-
canvas_id:
|
|
7212
|
-
title:
|
|
7213
|
-
permalink:
|
|
7214
|
-
mimetype:
|
|
7215
|
-
filetype:
|
|
7216
|
-
original_byte_length:
|
|
7217
|
-
content:
|
|
7218
|
-
start_line:
|
|
7219
|
-
end_line:
|
|
7220
|
-
total_lines:
|
|
7291
|
+
canvas_id: z24.string().optional(),
|
|
7292
|
+
title: z24.string().optional(),
|
|
7293
|
+
permalink: z24.string().optional(),
|
|
7294
|
+
mimetype: z24.string().optional(),
|
|
7295
|
+
filetype: z24.string().optional(),
|
|
7296
|
+
original_byte_length: z24.number().int().nonnegative().optional(),
|
|
7297
|
+
content: z24.string().optional(),
|
|
7298
|
+
start_line: z24.number().int().positive().optional(),
|
|
7299
|
+
end_line: z24.number().int().nonnegative().optional(),
|
|
7300
|
+
total_lines: z24.number().int().nonnegative().optional()
|
|
7221
7301
|
}).strict();
|
|
7222
7302
|
function createSlackCanvasReadTool() {
|
|
7223
7303
|
return zodTool({
|
|
7224
7304
|
description: "Read a bounded line range from a Slack canvas as markdown. Use when you need exact Canvas contents to verify facts or make edits safely. Do not use for generic web pages \u2014 use webFetch for those.",
|
|
7225
7305
|
annotations: { readOnlyHint: true, destructiveHint: false },
|
|
7226
|
-
inputSchema:
|
|
7227
|
-
canvas:
|
|
7306
|
+
inputSchema: z24.object({
|
|
7307
|
+
canvas: z24.string().min(1).describe(
|
|
7228
7308
|
"Canvas/file ID (e.g. `F0ABCDEF`) or Slack canvas/docs URL (e.g. `https://team.slack.com/docs/T.../F...`)."
|
|
7229
7309
|
),
|
|
7230
|
-
offset:
|
|
7231
|
-
limit:
|
|
7310
|
+
offset: z24.coerce.number().int().min(1).describe("1-indexed line number to start reading from.").optional(),
|
|
7311
|
+
limit: z24.coerce.number().int().min(1).describe("Maximum number of lines to read. Defaults to 1000.").optional()
|
|
7232
7312
|
}),
|
|
7233
7313
|
outputSchema: slackCanvasReadOutputSchema,
|
|
7234
7314
|
execute: async ({ canvas, offset, limit }) => {
|
|
@@ -7285,14 +7365,14 @@ function createSlackCanvasReadTool() {
|
|
|
7285
7365
|
}
|
|
7286
7366
|
|
|
7287
7367
|
// src/chat/slack/tools/canvas/write.ts
|
|
7288
|
-
import { z as
|
|
7368
|
+
import { z as z25 } from "zod";
|
|
7289
7369
|
function createSlackCanvasWriteTool(state) {
|
|
7290
7370
|
return zodTool({
|
|
7291
7371
|
description: "Write UTF-8 markdown content to a Slack canvas. Use for deliberate full-Canvas replacement after validation; use slackCanvasEdit for targeted changes to existing canvas content.",
|
|
7292
7372
|
executionMode: "sequential",
|
|
7293
|
-
inputSchema:
|
|
7294
|
-
canvas:
|
|
7295
|
-
content:
|
|
7373
|
+
inputSchema: z25.object({
|
|
7374
|
+
canvas: z25.string().min(1).describe("Canvas/file ID (e.g. `F0ABCDEF`) or Slack canvas/docs URL."),
|
|
7375
|
+
content: z25.string().describe("UTF-8 markdown content to write.")
|
|
7296
7376
|
}),
|
|
7297
7377
|
outputSchema: juniorToolResultSchema,
|
|
7298
7378
|
execute: async ({ canvas, content }) => {
|
|
@@ -7528,12 +7608,12 @@ async function updateListItem(input) {
|
|
|
7528
7608
|
}
|
|
7529
7609
|
|
|
7530
7610
|
// src/chat/slack/id-param.ts
|
|
7531
|
-
import { z as
|
|
7611
|
+
import { z as z26 } from "zod";
|
|
7532
7612
|
function slackChannelIdParam(description) {
|
|
7533
|
-
return
|
|
7613
|
+
return z26.string().min(1).describe(description);
|
|
7534
7614
|
}
|
|
7535
7615
|
function slackUserIdParam(description) {
|
|
7536
|
-
return
|
|
7616
|
+
return z26.string().min(1).describe(description);
|
|
7537
7617
|
}
|
|
7538
7618
|
function parseRequiredSlackChannelIdParam(field, value) {
|
|
7539
7619
|
const channelId = parseSlackChannelId(value);
|
|
@@ -7557,16 +7637,16 @@ function parseRequiredSlackUserIdParam(field, value) {
|
|
|
7557
7637
|
}
|
|
7558
7638
|
|
|
7559
7639
|
// src/chat/slack/tools/list/add-items.ts
|
|
7560
|
-
import { z as
|
|
7640
|
+
import { z as z27 } from "zod";
|
|
7561
7641
|
function createSlackListAddItemsTool(state) {
|
|
7562
7642
|
return zodTool({
|
|
7563
7643
|
description: "Add tasks to the active Slack list tracked in artifact context. Use when the user wants actionable items recorded in the current thread list. Do not use when no list exists and list creation was not requested.",
|
|
7564
|
-
inputSchema:
|
|
7565
|
-
items:
|
|
7644
|
+
inputSchema: z27.object({
|
|
7645
|
+
items: z27.array(z27.string().min(1)).min(1).max(25).describe("List item titles to create."),
|
|
7566
7646
|
assignee_user_id: slackUserIdParam(
|
|
7567
7647
|
"Optional Slack user ID assigned to all created items."
|
|
7568
7648
|
).optional(),
|
|
7569
|
-
due_date:
|
|
7649
|
+
due_date: z27.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe("Optional due date in YYYY-MM-DD format.").optional()
|
|
7570
7650
|
}),
|
|
7571
7651
|
outputSchema: juniorToolResultSchema,
|
|
7572
7652
|
execute: async ({ items, assignee_user_id, due_date }) => {
|
|
@@ -7620,12 +7700,12 @@ function createSlackListAddItemsTool(state) {
|
|
|
7620
7700
|
}
|
|
7621
7701
|
|
|
7622
7702
|
// src/chat/slack/tools/list/create.ts
|
|
7623
|
-
import { z as
|
|
7703
|
+
import { z as z28 } from "zod";
|
|
7624
7704
|
function createSlackListCreateTool(state) {
|
|
7625
7705
|
return zodTool({
|
|
7626
7706
|
description: "Create a Slack todo list for action tracking. Use when the user needs structured tasks with ownership/completion tracking. Do not use for one-off notes without task management needs.",
|
|
7627
|
-
inputSchema:
|
|
7628
|
-
name:
|
|
7707
|
+
inputSchema: z28.object({
|
|
7708
|
+
name: z28.string().min(1).max(160).describe("Name for the new Slack list.")
|
|
7629
7709
|
}),
|
|
7630
7710
|
outputSchema: juniorToolResultSchema,
|
|
7631
7711
|
execute: async ({ name }) => {
|
|
@@ -7657,13 +7737,13 @@ function createSlackListCreateTool(state) {
|
|
|
7657
7737
|
}
|
|
7658
7738
|
|
|
7659
7739
|
// src/chat/slack/tools/list/get-items.ts
|
|
7660
|
-
import { z as
|
|
7740
|
+
import { z as z29 } from "zod";
|
|
7661
7741
|
function createSlackListGetItemsTool(state) {
|
|
7662
7742
|
return zodTool({
|
|
7663
7743
|
description: "Read items from the active Slack list tracked in artifact context. Use when the user asks for task status, open items, or list contents. Do not use when list state is already known from the immediately prior result.",
|
|
7664
7744
|
annotations: { readOnlyHint: true, destructiveHint: false },
|
|
7665
|
-
inputSchema:
|
|
7666
|
-
limit:
|
|
7745
|
+
inputSchema: z29.object({
|
|
7746
|
+
limit: z29.coerce.number().int().min(1).max(200).describe("Maximum number of list items to return.").optional()
|
|
7667
7747
|
}),
|
|
7668
7748
|
outputSchema: juniorToolResultSchema,
|
|
7669
7749
|
execute: async ({ limit }) => {
|
|
@@ -7688,21 +7768,21 @@ function createSlackListGetItemsTool(state) {
|
|
|
7688
7768
|
}
|
|
7689
7769
|
|
|
7690
7770
|
// src/chat/slack/tools/list/update-item.ts
|
|
7691
|
-
import { z as
|
|
7692
|
-
var booleanInput3 = (description) =>
|
|
7771
|
+
import { z as z30 } from "zod";
|
|
7772
|
+
var booleanInput3 = (description) => z30.preprocess(
|
|
7693
7773
|
(value) => value === "true" ? true : value === "false" ? false : value,
|
|
7694
|
-
|
|
7774
|
+
z30.boolean()
|
|
7695
7775
|
).describe(description);
|
|
7696
|
-
var updateListItemInputSchema =
|
|
7697
|
-
|
|
7698
|
-
item_id:
|
|
7776
|
+
var updateListItemInputSchema = z30.union([
|
|
7777
|
+
z30.object({
|
|
7778
|
+
item_id: z30.string().min(1).describe("ID of the Slack list item to update."),
|
|
7699
7779
|
completed: booleanInput3("Optional completion status update."),
|
|
7700
|
-
title:
|
|
7780
|
+
title: z30.string().min(1).describe("Optional new item title.").optional()
|
|
7701
7781
|
}),
|
|
7702
|
-
|
|
7703
|
-
item_id:
|
|
7782
|
+
z30.object({
|
|
7783
|
+
item_id: z30.string().min(1).describe("ID of the Slack list item to update."),
|
|
7704
7784
|
completed: booleanInput3("Optional completion status update.").optional(),
|
|
7705
|
-
title:
|
|
7785
|
+
title: z30.string().min(1).describe("Optional new item title.")
|
|
7706
7786
|
})
|
|
7707
7787
|
]);
|
|
7708
7788
|
function createSlackListUpdateItemTool(state) {
|
|
@@ -7778,7 +7858,7 @@ async function checkSlackChannelReadAccess(args) {
|
|
|
7778
7858
|
}
|
|
7779
7859
|
|
|
7780
7860
|
// src/chat/slack/tools/thread-read.ts
|
|
7781
|
-
import { z as
|
|
7861
|
+
import { z as z31 } from "zod";
|
|
7782
7862
|
|
|
7783
7863
|
// src/chat/slack/tools/slack-message-url.ts
|
|
7784
7864
|
var SLACK_HOST_PATTERN = /^[a-z0-9-]+\.slack(?:-gov)?\.com$/;
|
|
@@ -7951,8 +8031,8 @@ function createSlackThreadReadTool(context, deps = {}) {
|
|
|
7951
8031
|
return zodTool({
|
|
7952
8032
|
description: "Read a Slack thread from a shared Slack message archive URL or explicit channel + timestamp. Use when the user shares a Slack message link (https://*.slack.com/archives/...) and you need the referenced message and its thread context. Only the current conversation and public channels Junior has seen in this workspace are readable.",
|
|
7953
8033
|
annotations: { readOnlyHint: true, destructiveHint: false },
|
|
7954
|
-
inputSchema:
|
|
7955
|
-
url:
|
|
8034
|
+
inputSchema: z31.object({
|
|
8035
|
+
url: z31.string().min(1).describe(
|
|
7956
8036
|
"Slack message archive URL, e.g. https://workspace.slack.com/archives/C123/p1700000000123456"
|
|
7957
8037
|
).optional(),
|
|
7958
8038
|
channel_id: slackChannelIdParam(
|
|
@@ -7961,8 +8041,8 @@ function createSlackThreadReadTool(context, deps = {}) {
|
|
|
7961
8041
|
ts: slackTimestampParam(
|
|
7962
8042
|
"Slack message timestamp (e.g. 1700000000.123456). May be the thread root or any message in the thread."
|
|
7963
8043
|
).optional(),
|
|
7964
|
-
limit:
|
|
7965
|
-
max_pages:
|
|
8044
|
+
limit: z31.coerce.number().int().min(1).max(1e3).describe("Maximum number of thread messages to fetch.").optional(),
|
|
8045
|
+
max_pages: z31.coerce.number().int().min(1).max(10).describe("Maximum number of Slack API pages to traverse.").optional()
|
|
7966
8046
|
}),
|
|
7967
8047
|
outputSchema: juniorToolResultSchema,
|
|
7968
8048
|
execute: async ({ url, channel_id, ts, limit, max_pages }) => {
|
|
@@ -8218,29 +8298,29 @@ async function searchSlackUsers(options) {
|
|
|
8218
8298
|
}
|
|
8219
8299
|
|
|
8220
8300
|
// src/chat/slack/tools/user-lookup.ts
|
|
8221
|
-
import { z as
|
|
8222
|
-
var booleanInput4 = (description) =>
|
|
8301
|
+
import { z as z32 } from "zod";
|
|
8302
|
+
var booleanInput4 = (description) => z32.preprocess(
|
|
8223
8303
|
(value) => value === "true" ? true : value === "false" ? false : value,
|
|
8224
|
-
|
|
8304
|
+
z32.boolean()
|
|
8225
8305
|
).describe(description);
|
|
8226
8306
|
function createSlackUserLookupTool() {
|
|
8227
8307
|
return zodTool({
|
|
8228
8308
|
description: "Look up Slack user profiles by user ID, email, or name search. Use when you need to identify a user, resolve cross-platform identity, or look up profile details like title or status. Returns profile fields including custom fields. For user ID lookup, pass a Slack user ID (e.g. U039RR91S). For search, pass a name query.",
|
|
8229
8309
|
annotations: { readOnlyHint: true, destructiveHint: false },
|
|
8230
|
-
inputSchema:
|
|
8310
|
+
inputSchema: z32.object({
|
|
8231
8311
|
user_id: slackUserIdParam(
|
|
8232
8312
|
"Slack user ID to look up (e.g. U039RR91S). Mutually exclusive with email and query."
|
|
8233
8313
|
).optional(),
|
|
8234
|
-
email:
|
|
8314
|
+
email: z32.string().min(3).describe(
|
|
8235
8315
|
"Email address to look up. Mutually exclusive with user_id and query."
|
|
8236
8316
|
).optional(),
|
|
8237
|
-
query:
|
|
8317
|
+
query: z32.string().min(2).describe(
|
|
8238
8318
|
"Name to search for (matches against username, display name, real name). Mutually exclusive with user_id and email."
|
|
8239
8319
|
).optional(),
|
|
8240
|
-
limit:
|
|
8320
|
+
limit: z32.coerce.number().int().min(1).max(20).describe(
|
|
8241
8321
|
"Maximum number of results to return for name search. Defaults to 10."
|
|
8242
8322
|
).optional(),
|
|
8243
|
-
max_pages:
|
|
8323
|
+
max_pages: z32.coerce.number().int().min(1).max(5).describe(
|
|
8244
8324
|
"Maximum number of Slack API pages to scan for name search. Defaults to 3."
|
|
8245
8325
|
).optional(),
|
|
8246
8326
|
include_bots: booleanInput4(
|
|
@@ -8344,18 +8424,18 @@ function createSlackUserLookupTool() {
|
|
|
8344
8424
|
}
|
|
8345
8425
|
|
|
8346
8426
|
// src/chat/tools/system-time.ts
|
|
8347
|
-
import { z as
|
|
8427
|
+
import { z as z33 } from "zod";
|
|
8348
8428
|
var systemTimeOutputSchema = juniorToolResultSchema.extend({
|
|
8349
|
-
unix_ms:
|
|
8350
|
-
iso_utc:
|
|
8351
|
-
iso_local:
|
|
8352
|
-
timezone_offset_minutes:
|
|
8429
|
+
unix_ms: z33.number(),
|
|
8430
|
+
iso_utc: z33.string(),
|
|
8431
|
+
iso_local: z33.string(),
|
|
8432
|
+
timezone_offset_minutes: z33.number()
|
|
8353
8433
|
});
|
|
8354
8434
|
function createSystemTimeTool() {
|
|
8355
8435
|
return zodTool({
|
|
8356
8436
|
description: "Return current system time in UTC and local ISO formats. Use when the user asks for current time/date context. Do not use as a substitute for historical or timezone-conversion research.",
|
|
8357
8437
|
annotations: { readOnlyHint: true, destructiveHint: false },
|
|
8358
|
-
inputSchema:
|
|
8438
|
+
inputSchema: z33.object({}),
|
|
8359
8439
|
outputSchema: systemTimeOutputSchema,
|
|
8360
8440
|
privateTraceResult: (result) => ({
|
|
8361
8441
|
ok: result.ok,
|
|
@@ -8384,10 +8464,10 @@ function createSystemTimeTool() {
|
|
|
8384
8464
|
}
|
|
8385
8465
|
|
|
8386
8466
|
// src/chat/tools/handoff/tool.ts
|
|
8387
|
-
import { z as
|
|
8467
|
+
import { z as z34 } from "zod";
|
|
8388
8468
|
var HANDOFF_TOOL_NAME = "handoff";
|
|
8389
8469
|
function createHandoffTool(handoff) {
|
|
8390
|
-
const profileSchema =
|
|
8470
|
+
const profileSchema = z34.enum(handoff.profiles);
|
|
8391
8471
|
const defaultProfile = handoff.profiles[0];
|
|
8392
8472
|
const handoffResultSchema = juniorToolResultSchema.extend({
|
|
8393
8473
|
model_profile: profileSchema
|
|
@@ -8396,7 +8476,7 @@ function createHandoffTool(handoff) {
|
|
|
8396
8476
|
return zodTool({
|
|
8397
8477
|
description: `Permanently switch this conversation to a more capable model profile, replace prior context with a continuation summary, and continue the same task with the same workspace and all other normal tools. Available profiles: ${profileNames}. Omit profile to use \`${defaultProfile}\`. Call it as the only tool in the assistant message when the system tool policy requires a model upgrade.`,
|
|
8398
8478
|
executionMode: "sequential",
|
|
8399
|
-
inputSchema:
|
|
8479
|
+
inputSchema: z34.object({
|
|
8400
8480
|
profile: profileSchema.nullish().describe(
|
|
8401
8481
|
"Named model profile to use for the rest of the conversation; omit or pass null for the default"
|
|
8402
8482
|
)
|
|
@@ -8415,7 +8495,7 @@ function createHandoffTool(handoff) {
|
|
|
8415
8495
|
}
|
|
8416
8496
|
|
|
8417
8497
|
// src/chat/tools/web/fetch-tool.ts
|
|
8418
|
-
import { z as
|
|
8498
|
+
import { z as z35 } from "zod";
|
|
8419
8499
|
|
|
8420
8500
|
// src/chat/tools/web/constants.ts
|
|
8421
8501
|
var USER_AGENT = "junior-bot/0.1";
|
|
@@ -8862,9 +8942,9 @@ function createWebFetchTool(hooks, options = {}) {
|
|
|
8862
8942
|
destructiveHint: false,
|
|
8863
8943
|
openWorldHint: true
|
|
8864
8944
|
},
|
|
8865
|
-
inputSchema:
|
|
8866
|
-
url:
|
|
8867
|
-
max_chars:
|
|
8945
|
+
inputSchema: z35.object({
|
|
8946
|
+
url: z35.string().min(1).describe("HTTP(S) URL to fetch."),
|
|
8947
|
+
max_chars: z35.coerce.number().int().min(500).max(MAX_FETCH_CHARS).describe("Optional maximum number of extracted characters to return.").optional()
|
|
8868
8948
|
}),
|
|
8869
8949
|
outputSchema: juniorToolResultSchema,
|
|
8870
8950
|
execute: async ({ url, max_chars }) => {
|
|
@@ -8931,7 +9011,7 @@ function createWebFetchTool(hooks, options = {}) {
|
|
|
8931
9011
|
}
|
|
8932
9012
|
|
|
8933
9013
|
// src/chat/tools/web/search.ts
|
|
8934
|
-
import { z as
|
|
9014
|
+
import { z as z36 } from "zod";
|
|
8935
9015
|
import { generateText } from "ai";
|
|
8936
9016
|
import { createGatewayProvider } from "@ai-sdk/gateway";
|
|
8937
9017
|
import { getModel } from "@earendil-works/pi-ai/compat";
|
|
@@ -8982,9 +9062,9 @@ function createWebSearchTool(override) {
|
|
|
8982
9062
|
destructiveHint: false,
|
|
8983
9063
|
openWorldHint: true
|
|
8984
9064
|
},
|
|
8985
|
-
inputSchema:
|
|
8986
|
-
query:
|
|
8987
|
-
max_results:
|
|
9065
|
+
inputSchema: z36.object({
|
|
9066
|
+
query: z36.string().min(1).max(500).describe("Search query."),
|
|
9067
|
+
max_results: z36.coerce.number().int().min(1).max(MAX_RESULTS2).describe("Max results to return.").optional()
|
|
8988
9068
|
}),
|
|
8989
9069
|
outputSchema: juniorToolResultSchema,
|
|
8990
9070
|
execute: async ({ query, max_results }) => {
|
|
@@ -9054,14 +9134,14 @@ function createWebSearchTool(override) {
|
|
|
9054
9134
|
}
|
|
9055
9135
|
|
|
9056
9136
|
// src/chat/tools/sandbox/write-file.ts
|
|
9057
|
-
import { z as
|
|
9137
|
+
import { z as z37 } from "zod";
|
|
9058
9138
|
function createWriteFileTool() {
|
|
9059
9139
|
return zodTool({
|
|
9060
9140
|
description: "Write UTF-8 content to a file in the sandbox workspace. Use for intentional file creation or deliberate full-file replacement after validation; use editFile instead for targeted changes to existing files. Do not use for exploratory analysis-only turns.",
|
|
9061
9141
|
executionMode: "sequential",
|
|
9062
|
-
inputSchema:
|
|
9063
|
-
path:
|
|
9064
|
-
content:
|
|
9142
|
+
inputSchema: z37.object({
|
|
9143
|
+
path: z37.string().min(1).describe("Path to write in the sandbox workspace."),
|
|
9144
|
+
content: z37.string().describe("UTF-8 file content to write.")
|
|
9065
9145
|
}),
|
|
9066
9146
|
outputSchema: juniorToolResultSchema,
|
|
9067
9147
|
execute: async () => {
|
|
@@ -9154,6 +9234,16 @@ function createTools(availableSkills, hooks = {}, context) {
|
|
|
9154
9234
|
tools.slackCanvasEdit = createSlackCanvasEditTool(state);
|
|
9155
9235
|
tools.slackCanvasWrite = createSlackCanvasWriteTool(state);
|
|
9156
9236
|
tools.slackThreadRead = createSlackThreadReadTool(slackContext);
|
|
9237
|
+
if (context.conversationId && slackContext.source.type === "pub") {
|
|
9238
|
+
tools.searchConversationHistory = createSlackConversationSearchTool(
|
|
9239
|
+
{
|
|
9240
|
+
kind: "public_provider_tenant",
|
|
9241
|
+
provider: "slack",
|
|
9242
|
+
providerTenantId: slackContext.teamId
|
|
9243
|
+
},
|
|
9244
|
+
context.conversationId
|
|
9245
|
+
);
|
|
9246
|
+
}
|
|
9157
9247
|
tools.slackUserLookup = createSlackUserLookupTool();
|
|
9158
9248
|
tools.slackListCreate = createSlackListCreateTool(state);
|
|
9159
9249
|
tools.slackListAddItems = createSlackListAddItemsTool(state);
|
|
@@ -9211,6 +9301,29 @@ function buildReportedProgressStatus(input) {
|
|
|
9211
9301
|
}
|
|
9212
9302
|
return { text };
|
|
9213
9303
|
}
|
|
9304
|
+
function latestReportedProgress(messages) {
|
|
9305
|
+
for (let messageIndex = messages.length - 1; messageIndex >= 0; messageIndex -= 1) {
|
|
9306
|
+
const message = messages[messageIndex];
|
|
9307
|
+
if (message.role !== "assistant" || !Array.isArray(message.content)) {
|
|
9308
|
+
continue;
|
|
9309
|
+
}
|
|
9310
|
+
for (let partIndex = message.content.length - 1; partIndex >= 0; partIndex -= 1) {
|
|
9311
|
+
const part = message.content[partIndex];
|
|
9312
|
+
if (!part || typeof part !== "object") {
|
|
9313
|
+
continue;
|
|
9314
|
+
}
|
|
9315
|
+
const toolCall = part;
|
|
9316
|
+
if (toolCall.type !== "toolCall" || toolCall.name !== "reportProgress") {
|
|
9317
|
+
continue;
|
|
9318
|
+
}
|
|
9319
|
+
const status = buildReportedProgressStatus(toolCall.arguments);
|
|
9320
|
+
if (status) {
|
|
9321
|
+
return status;
|
|
9322
|
+
}
|
|
9323
|
+
}
|
|
9324
|
+
}
|
|
9325
|
+
return void 0;
|
|
9326
|
+
}
|
|
9214
9327
|
|
|
9215
9328
|
// src/chat/tool-support/catalog-tool-call.ts
|
|
9216
9329
|
import { Value } from "@sinclair/typebox/value";
|
|
@@ -9743,59 +9856,59 @@ async function startOAuthFlow(provider, input) {
|
|
|
9743
9856
|
}
|
|
9744
9857
|
|
|
9745
9858
|
// src/chat/sandbox/egress/schemas.ts
|
|
9746
|
-
import { z as
|
|
9859
|
+
import { z as z38 } from "zod";
|
|
9747
9860
|
import {
|
|
9748
9861
|
pluginAuthorizationSchema,
|
|
9749
9862
|
pluginCredentialHeaderTransformSchema,
|
|
9750
9863
|
pluginGrantSchema,
|
|
9751
9864
|
pluginProviderAccountSchema
|
|
9752
9865
|
} from "@sentry/junior-plugin-api";
|
|
9753
|
-
var finiteNumberSchema =
|
|
9754
|
-
var httpStatusSchema =
|
|
9755
|
-
var providerNameSchema =
|
|
9756
|
-
var credentialSignalKindSchema =
|
|
9866
|
+
var finiteNumberSchema = z38.number().refine(Number.isFinite);
|
|
9867
|
+
var httpStatusSchema = z38.number().int().min(100).max(599);
|
|
9868
|
+
var providerNameSchema = z38.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
9869
|
+
var credentialSignalKindSchema = z38.enum(["auth_required", "unavailable"]);
|
|
9757
9870
|
var sandboxEgressGrantSchema = pluginGrantSchema;
|
|
9758
|
-
var sandboxEgressCredentialContextSchema =
|
|
9871
|
+
var sandboxEgressCredentialContextSchema = z38.object({
|
|
9759
9872
|
credentials: credentialContextSchema,
|
|
9760
|
-
egressId:
|
|
9873
|
+
egressId: z38.string().min(1),
|
|
9761
9874
|
expiresAtMs: finiteNumberSchema,
|
|
9762
|
-
contextId:
|
|
9875
|
+
contextId: z38.string().min(1)
|
|
9763
9876
|
}).strict();
|
|
9764
|
-
var sandboxEgressCredentialLeaseSchema =
|
|
9877
|
+
var sandboxEgressCredentialLeaseSchema = z38.object({
|
|
9765
9878
|
account: pluginProviderAccountSchema.optional(),
|
|
9766
9879
|
authorization: pluginAuthorizationSchema.optional(),
|
|
9767
9880
|
grant: sandboxEgressGrantSchema,
|
|
9768
9881
|
provider: providerNameSchema,
|
|
9769
|
-
expiresAt:
|
|
9770
|
-
headerTransforms:
|
|
9882
|
+
expiresAt: z38.string().min(1),
|
|
9883
|
+
headerTransforms: z38.array(pluginCredentialHeaderTransformSchema).min(1)
|
|
9771
9884
|
}).strict();
|
|
9772
|
-
var sandboxEgressAuthRequiredSignalSchema =
|
|
9885
|
+
var sandboxEgressAuthRequiredSignalSchema = z38.object({
|
|
9773
9886
|
authorization: pluginAuthorizationSchema.optional(),
|
|
9774
9887
|
grant: sandboxEgressGrantSchema,
|
|
9775
9888
|
kind: credentialSignalKindSchema.default("auth_required"),
|
|
9776
9889
|
provider: providerNameSchema,
|
|
9777
|
-
message:
|
|
9890
|
+
message: z38.string().optional(),
|
|
9778
9891
|
createdAtMs: finiteNumberSchema
|
|
9779
9892
|
}).strict().superRefine((signal, ctx) => {
|
|
9780
9893
|
if (signal.authorization && signal.authorization.provider !== signal.provider) {
|
|
9781
9894
|
ctx.addIssue({
|
|
9782
|
-
code:
|
|
9895
|
+
code: z38.ZodIssueCode.custom,
|
|
9783
9896
|
message: "Auth signal authorization provider must match provider",
|
|
9784
9897
|
path: ["authorization", "provider"]
|
|
9785
9898
|
});
|
|
9786
9899
|
}
|
|
9787
9900
|
});
|
|
9788
|
-
var sandboxEgressPermissionDeniedSignalSchema =
|
|
9901
|
+
var sandboxEgressPermissionDeniedSignalSchema = z38.object({
|
|
9789
9902
|
account: pluginProviderAccountSchema.optional(),
|
|
9790
|
-
acceptedPermissions:
|
|
9903
|
+
acceptedPermissions: z38.string().optional(),
|
|
9791
9904
|
grant: sandboxEgressGrantSchema,
|
|
9792
|
-
message:
|
|
9905
|
+
message: z38.string().min(1),
|
|
9793
9906
|
provider: providerNameSchema,
|
|
9794
|
-
source:
|
|
9795
|
-
sso:
|
|
9907
|
+
source: z38.literal("upstream"),
|
|
9908
|
+
sso: z38.string().optional(),
|
|
9796
9909
|
status: httpStatusSchema,
|
|
9797
|
-
upstreamHost:
|
|
9798
|
-
upstreamPath:
|
|
9910
|
+
upstreamHost: z38.string().min(1),
|
|
9911
|
+
upstreamPath: z38.string().min(1),
|
|
9799
9912
|
createdAtMs: finiteNumberSchema
|
|
9800
9913
|
}).strict();
|
|
9801
9914
|
function parseSandboxEgressAuthRequiredSignal(value) {
|
|
@@ -10053,15 +10166,15 @@ function handleToolExecutionError(error, toolName, toolCallId, shouldTrace, trac
|
|
|
10053
10166
|
}
|
|
10054
10167
|
|
|
10055
10168
|
// src/chat/tools/execute-tool.ts
|
|
10056
|
-
import { z as
|
|
10169
|
+
import { z as z39 } from "zod";
|
|
10057
10170
|
var EXECUTE_TOOL_NAME = "executeTool";
|
|
10058
10171
|
function createExecuteToolTool() {
|
|
10059
10172
|
return zodTool({
|
|
10060
10173
|
description: "Execute any catalog tool by exact tool_name from searchTools. Put tool-specific parameters inside arguments.",
|
|
10061
10174
|
executionMode: "sequential",
|
|
10062
|
-
inputSchema:
|
|
10063
|
-
tool_name:
|
|
10064
|
-
arguments:
|
|
10175
|
+
inputSchema: z39.object({
|
|
10176
|
+
tool_name: z39.string().min(1).describe("Exact catalog tool_name returned by searchTools."),
|
|
10177
|
+
arguments: z39.record(z39.string(), z39.unknown()).describe(
|
|
10065
10178
|
'Arguments matching the selected catalog tool schema, for example { "query": "..." }.'
|
|
10066
10179
|
).optional()
|
|
10067
10180
|
}).strict(),
|
|
@@ -10101,42 +10214,42 @@ function planToolExposure(tools) {
|
|
|
10101
10214
|
}
|
|
10102
10215
|
|
|
10103
10216
|
// src/chat/tools/search-tools.ts
|
|
10104
|
-
import { z as
|
|
10217
|
+
import { z as z40 } from "zod";
|
|
10105
10218
|
var SEARCH_TOOLS_NAME = "searchTools";
|
|
10106
10219
|
var DEFAULT_MAX_RESULTS2 = 5;
|
|
10107
10220
|
var MAX_RESULTS3 = 20;
|
|
10108
10221
|
var MODEL_VISIBLE_DESCRIPTION_CAP = 180;
|
|
10109
|
-
var searchToolsSourceSchema =
|
|
10110
|
-
id:
|
|
10111
|
-
description:
|
|
10222
|
+
var searchToolsSourceSchema = z40.object({
|
|
10223
|
+
id: z40.string(),
|
|
10224
|
+
description: z40.string()
|
|
10112
10225
|
}).strict();
|
|
10113
|
-
var toolCallExampleSchema =
|
|
10114
|
-
tool_name:
|
|
10115
|
-
arguments:
|
|
10226
|
+
var toolCallExampleSchema = z40.object({
|
|
10227
|
+
tool_name: z40.string(),
|
|
10228
|
+
arguments: z40.record(z40.string(), z40.string())
|
|
10116
10229
|
}).strict();
|
|
10117
|
-
var searchToolsToolSchema =
|
|
10118
|
-
tool_name:
|
|
10119
|
-
description:
|
|
10120
|
-
exposure:
|
|
10121
|
-
source:
|
|
10122
|
-
signature:
|
|
10230
|
+
var searchToolsToolSchema = z40.object({
|
|
10231
|
+
tool_name: z40.string(),
|
|
10232
|
+
description: z40.string(),
|
|
10233
|
+
exposure: z40.enum(["direct", "deferred", "modelOnly", "hidden"]),
|
|
10234
|
+
source: z40.string().optional(),
|
|
10235
|
+
signature: z40.string(),
|
|
10123
10236
|
call: toolCallExampleSchema,
|
|
10124
|
-
input_schema:
|
|
10125
|
-
input_schema_summary:
|
|
10126
|
-
call_notes:
|
|
10127
|
-
annotations:
|
|
10237
|
+
input_schema: z40.unknown(),
|
|
10238
|
+
input_schema_summary: z40.string(),
|
|
10239
|
+
call_notes: z40.array(z40.string()),
|
|
10240
|
+
annotations: z40.record(z40.string(), z40.unknown())
|
|
10128
10241
|
}).strict();
|
|
10129
10242
|
var searchToolsOutputSchema = juniorToolResultSchema.extend({
|
|
10130
|
-
query:
|
|
10131
|
-
source:
|
|
10132
|
-
sources:
|
|
10133
|
-
total_catalog_tools:
|
|
10134
|
-
total_eligible_tools:
|
|
10135
|
-
total_matches:
|
|
10136
|
-
returned_tools:
|
|
10137
|
-
execution_tool:
|
|
10243
|
+
query: z40.string().nullable(),
|
|
10244
|
+
source: z40.string().nullable(),
|
|
10245
|
+
sources: z40.array(searchToolsSourceSchema),
|
|
10246
|
+
total_catalog_tools: z40.number().int().nonnegative(),
|
|
10247
|
+
total_eligible_tools: z40.number().int().nonnegative(),
|
|
10248
|
+
total_matches: z40.number().int().nonnegative(),
|
|
10249
|
+
returned_tools: z40.number().int().nonnegative(),
|
|
10250
|
+
execution_tool: z40.literal("executeTool"),
|
|
10138
10251
|
execution_example: toolCallExampleSchema,
|
|
10139
|
-
tools:
|
|
10252
|
+
tools: z40.array(searchToolsToolSchema)
|
|
10140
10253
|
}).strict();
|
|
10141
10254
|
function normalize2(value) {
|
|
10142
10255
|
return value.toLowerCase().replace(/[^a-z0-9_]+/g, " ").trim();
|
|
@@ -10328,14 +10441,14 @@ function createSearchToolsTool(catalogTools) {
|
|
|
10328
10441
|
return zodTool({
|
|
10329
10442
|
description: renderSearchToolsDescription(knownSources),
|
|
10330
10443
|
annotations: { readOnlyHint: true, destructiveHint: false },
|
|
10331
|
-
inputSchema:
|
|
10332
|
-
query:
|
|
10444
|
+
inputSchema: z40.object({
|
|
10445
|
+
query: z40.string().nullable().describe(
|
|
10333
10446
|
"Optional search terms describing the tool, owner, action, or arguments needed. Empty string lists catalog tools."
|
|
10334
10447
|
).optional(),
|
|
10335
|
-
source:
|
|
10448
|
+
source: z40.string().nullable().describe(
|
|
10336
10449
|
"Optional source id to search within, such as a plugin source returned in sources."
|
|
10337
10450
|
).optional(),
|
|
10338
|
-
max_results:
|
|
10451
|
+
max_results: z40.number().int().min(1).max(MAX_RESULTS3).nullable().describe("Maximum matching catalog tool descriptors to return.").optional()
|
|
10339
10452
|
}).strict(),
|
|
10340
10453
|
outputSchema: searchToolsOutputSchema,
|
|
10341
10454
|
privateTraceResult: (result) => ({
|
|
@@ -15319,6 +15432,18 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy) {
|
|
|
15319
15432
|
const handoffThinkingLevel = toAgentThinkingLevel(
|
|
15320
15433
|
thinkingSelection.thinkingLevel
|
|
15321
15434
|
);
|
|
15435
|
+
void (async () => {
|
|
15436
|
+
await observers.onStatus?.({ text: "Switching models" });
|
|
15437
|
+
})().catch((error) => {
|
|
15438
|
+
logWarn(
|
|
15439
|
+
"assistant_status_observer_failed",
|
|
15440
|
+
{},
|
|
15441
|
+
{
|
|
15442
|
+
"exception.message": error instanceof Error ? error.message : String(error)
|
|
15443
|
+
},
|
|
15444
|
+
"Failed to report assistant status"
|
|
15445
|
+
);
|
|
15446
|
+
});
|
|
15322
15447
|
const handoffMessages = await compactContextForHandoff(
|
|
15323
15448
|
{
|
|
15324
15449
|
conversationContext: input.conversationContext,
|
|
@@ -15954,6 +16079,7 @@ export {
|
|
|
15954
16079
|
removeReactionFromMessage,
|
|
15955
16080
|
renderSlackLegacyAttachmentText,
|
|
15956
16081
|
appendSlackLegacyAttachmentText,
|
|
16082
|
+
latestReportedProgress,
|
|
15957
16083
|
parseOAuthStatePayload,
|
|
15958
16084
|
formatProviderLabel,
|
|
15959
16085
|
resolveBaseUrl,
|