@sentry/junior 0.88.0 → 0.90.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/README.md +16 -5
- package/dist/{agent-hooks-RIJ5TSWP.js → agent-hooks-MXAF7RQL.js} +10 -10
- package/dist/api/people/list.js +8 -8
- package/dist/api/people/profile.js +8 -8
- package/dist/api-reference.d.ts +1 -1
- package/dist/app.js +716 -732
- package/dist/{catalog-runtime-MW7XERSU.js → catalog-runtime-DXE6NXHT.js} +5 -5
- package/dist/chat/agent/index.d.ts +4 -0
- package/dist/chat/agent/prompt.d.ts +78 -0
- package/dist/chat/{respond.d.ts → agent/request.d.ts} +98 -55
- package/dist/chat/agent/resume.d.ts +65 -0
- package/dist/chat/agent/sandbox.d.ts +15 -0
- package/dist/chat/agent/session.d.ts +20 -0
- package/dist/chat/agent/skills.d.ts +26 -0
- package/dist/chat/agent/tools.d.ts +78 -0
- package/dist/chat/agent-dispatch/runner.d.ts +3 -5
- package/dist/chat/app/production.d.ts +3 -1
- package/dist/chat/app/services.d.ts +1 -4
- package/dist/chat/logging.d.ts +2 -0
- package/dist/chat/mcp/tool-manager.d.ts +1 -6
- package/dist/chat/pi/messages.d.ts +18 -2
- package/dist/chat/pi/transcript.d.ts +31 -0
- package/dist/chat/plugins/agent-hooks.d.ts +2 -2
- package/dist/chat/prompt.d.ts +1 -1
- package/dist/chat/runtime/agent-continue-runner.d.ts +5 -5
- package/dist/chat/runtime/agent-run-outcome.d.ts +21 -0
- package/dist/chat/runtime/agent-runner.d.ts +11 -0
- package/dist/chat/runtime/delivered-turn-state.d.ts +2 -2
- package/dist/chat/runtime/generated-artifacts.d.ts +16 -0
- package/dist/chat/runtime/reply-executor.d.ts +2 -2
- package/dist/chat/runtime/slack-resume.d.ts +21 -12
- package/dist/chat/runtime/turn.d.ts +5 -39
- package/dist/chat/services/reply-delivery-plan.d.ts +0 -8
- package/dist/chat/services/turn-failure-response.d.ts +4 -4
- package/dist/chat/services/turn-result.d.ts +4 -7
- package/dist/chat/slack/channel.d.ts +9 -5
- package/dist/chat/slack/client.d.ts +3 -1
- package/dist/chat/slack/context.d.ts +17 -5
- package/dist/chat/slack/id-param.d.ts +25 -0
- package/dist/chat/slack/ids.d.ts +18 -4
- package/dist/chat/slack/outbound.d.ts +16 -0
- package/dist/chat/slack/output.d.ts +3 -3
- package/dist/chat/slack/reply.d.ts +4 -7
- package/dist/chat/slack/timestamp-param.d.ts +25 -0
- package/dist/chat/slack/tools/canvas/context.d.ts +18 -0
- package/dist/chat/slack/tools/canvas/create.d.ts +4 -0
- package/dist/chat/slack/tools/canvas/edit.d.ts +3 -0
- package/dist/chat/slack/tools/canvas/read.d.ts +6 -0
- package/dist/chat/slack/tools/canvas/write.d.ts +3 -0
- package/dist/chat/{tools/slack → slack/tools}/channel-access.d.ts +4 -3
- package/dist/chat/{tools → slack/tools}/channel-capabilities.d.ts +2 -0
- package/dist/chat/slack/tools/channel-list-messages.d.ts +3 -0
- package/dist/chat/{tools/slack → slack/tools}/context.d.ts +5 -4
- package/dist/chat/slack/tools/list/add-items.d.ts +3 -0
- package/dist/chat/{tools/slack/lists.d.ts → slack/tools/list/api.d.ts} +2 -1
- package/dist/chat/slack/tools/list/create.d.ts +3 -0
- package/dist/chat/slack/tools/list/get-items.d.ts +3 -0
- package/dist/chat/slack/tools/list/update-item.d.ts +3 -0
- package/dist/chat/slack/tools/message-add-reaction.d.ts +4 -0
- package/dist/chat/slack/tools/send-message.d.ts +11 -0
- package/dist/chat/{tools/slack → slack/tools}/slack-message-url.d.ts +5 -5
- package/dist/chat/slack/tools/thread-read.d.ts +6 -0
- package/dist/chat/slack/tools/user-lookup.d.ts +2 -0
- package/dist/chat/slack/users.d.ts +2 -1
- package/dist/chat/{services → slack}/vision-context.d.ts +4 -2
- package/dist/chat/state/session-log.d.ts +1 -1
- package/dist/chat/tool-exposure.d.ts +10 -0
- package/dist/chat/tool-support/catalog-tool-call.d.ts +10 -0
- package/dist/chat/{tools/execution → tool-support}/normalize-result.d.ts +4 -1
- package/dist/chat/{tools/agent-tools.d.ts → tool-support/pi-tool-adapter.d.ts} +3 -9
- package/dist/chat/tool-support/schema-summary.d.ts +2 -0
- package/dist/chat/{tools → tool-support}/skill/mcp-tool-summary.d.ts +0 -6
- package/dist/chat/tool-support/structured-result.d.ts +73 -0
- package/dist/chat/tool-support/text-range-result.d.ts +58 -0
- package/dist/chat/tool-support/tool-execution-report.d.ts +7 -0
- package/dist/chat/tool-support/zod-tool.d.ts +27 -0
- package/dist/chat/tools/advisor/tool.d.ts +9 -18
- package/dist/chat/tools/definition.d.ts +56 -9
- package/dist/chat/tools/execute-tool.d.ts +3 -0
- package/dist/chat/tools/index.d.ts +3 -2
- package/dist/chat/tools/resource-events.d.ts +3 -13
- package/dist/chat/tools/runtime/report-progress.d.ts +1 -3
- package/dist/chat/tools/sandbox/bash.d.ts +1 -4
- package/dist/chat/tools/sandbox/edit-file.d.ts +25 -7
- package/dist/chat/tools/sandbox/file-uploads.d.ts +30 -0
- package/dist/chat/tools/sandbox/file-utils.d.ts +10 -1
- package/dist/chat/tools/sandbox/find-files.d.ts +12 -11
- package/dist/chat/tools/sandbox/grep.d.ts +18 -12
- package/dist/chat/tools/sandbox/list-dir.d.ts +15 -7
- package/dist/chat/tools/sandbox/read-file.d.ts +2 -31
- package/dist/chat/tools/sandbox/write-file.d.ts +1 -4
- package/dist/chat/tools/search-tools.d.ts +4 -0
- package/dist/chat/tools/skill/call-mcp-tool.d.ts +1 -4
- package/dist/chat/tools/skill/load-skill.d.ts +4 -5
- package/dist/chat/tools/skill/search-mcp-tools.d.ts +1 -5
- package/dist/chat/tools/system-time.d.ts +1 -1
- package/dist/chat/tools/types.d.ts +15 -5
- package/dist/chat/tools/web/fetch-content.d.ts +4 -2
- package/dist/chat/tools/web/fetch-tool.d.ts +4 -4
- package/dist/chat/tools/web/image-generate.d.ts +4 -3
- package/dist/chat/tools/web/search.d.ts +1 -4
- package/dist/{chunk-4IXHIV37.js → chunk-2S7M37HY.js} +6 -8
- package/dist/{chunk-L7OHKDOX.js → chunk-3MPOMK3K.js} +58 -7
- package/dist/{chunk-V6XDCS3X.js → chunk-5GBUZI6M.js} +4 -4
- package/dist/{chunk-7ES37H6U.js → chunk-AN2437E3.js} +4 -4
- package/dist/chunk-AOISHLSF.js +747 -0
- package/dist/{chunk-NYJLQI42.js → chunk-BKSZL4QO.js} +11257 -11957
- package/dist/{chunk-XS6NLQPA.js → chunk-DACFZ5CI.js} +474 -33
- package/dist/chunk-GCWD2VHP.js +1216 -0
- package/dist/chunk-GHGPTPBL.js +53 -0
- package/dist/{chunk-S35CPNPT.js → chunk-HXL2ZV74.js} +40 -216
- package/dist/{chunk-PBV4ZIVM.js → chunk-IRRMABQD.js} +1 -1
- package/dist/{chunk-2DPZRS3B.js → chunk-IX76WFJV.js} +8 -8
- package/dist/{chunk-66NX7MNW.js → chunk-KC42JAAQ.js} +1 -1
- package/dist/chunk-LFLTJQVR.js +90 -0
- package/dist/{chunk-IATAYWFU.js → chunk-NW7AXDA5.js} +2 -2
- package/dist/{chunk-F22AM3OW.js → chunk-NYWPISSO.js} +1 -1
- package/dist/chunk-OB42YVAE.js +16 -0
- package/dist/chunk-ONFOWI2D.js +955 -0
- package/dist/chunk-PHZHJTCK.js +1062 -0
- package/dist/{chunk-6UPQ5GTJ.js → chunk-QCKGI74V.js} +7 -7
- package/dist/{chunk-YPAE5RH3.js → chunk-RS6ANWVT.js} +1 -1
- package/dist/{chunk-C5NCV3OB.js → chunk-TYUXD3FN.js} +1 -1
- package/dist/{chunk-KBFQXJL4.js → chunk-XP7F4LYB.js} +5 -7
- package/dist/{chunk-VMBZFPZM.js → chunk-ZUK7BL63.js} +187 -9
- package/dist/cli/chat.js +55 -40
- package/dist/cli/check.js +6 -6
- package/dist/cli/init.js +30 -36
- package/dist/cli/plugins.js +16 -16
- package/dist/cli/snapshot-warmup.js +9 -9
- package/dist/cli/upgrade.js +21 -21
- package/dist/db-CXI7PR5U.js +18 -0
- package/dist/handlers/agent-dispatch.d.ts +3 -3
- package/dist/handlers/mcp-oauth-callback.d.ts +3 -3
- package/dist/handlers/oauth-callback.d.ts +3 -3
- package/dist/instrumentation.js +6 -5
- package/dist/nitro.js +3 -7
- package/dist/reporting.js +23 -25
- package/dist/{runner-BCRF2FCI.js → runner-FKL3RAHA.js} +89 -77
- package/dist/{validation-FMJO3L5P.js → validation-I7GD2YWS.js} +6 -6
- package/package.json +6 -6
- package/dist/chat/respond-helpers.d.ts +0 -82
- package/dist/chat/services/attachment-claims.d.ts +0 -2
- package/dist/chat/services/channel-intent.d.ts +0 -2
- package/dist/chat/tools/sandbox/attach-file.d.ts +0 -7
- package/dist/chat/tools/slack/canvas-tools.d.ts +0 -30
- package/dist/chat/tools/slack/channel-list-messages.d.ts +0 -9
- package/dist/chat/tools/slack/channel-post-message.d.ts +0 -5
- package/dist/chat/tools/slack/list-tools.d.ts +0 -21
- package/dist/chat/tools/slack/message-add-reaction.d.ts +0 -5
- package/dist/chat/tools/slack/thread-read.d.ts +0 -12
- package/dist/chat/tools/slack/user-lookup.d.ts +0 -8
- package/dist/chunk-AHLSXMOU.js +0 -506
- package/dist/chunk-FTMXFBDC.js +0 -49
- package/dist/chunk-KBSLCOGE.js +0 -2226
- package/dist/chunk-KQKIA4CU.js +0 -186
- package/dist/db-37HOGLI7.js +0 -18
- /package/dist/chat/{tools/slack/canvases.d.ts → slack/tools/canvas/api.d.ts} +0 -0
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { SlackToolContext } from "@/chat/tools/slack/context";
|
|
2
|
-
import type { ToolState } from "@/chat/tools/types";
|
|
3
|
-
/** Create a tool that provisions a new Slack canvas in the active channel. */
|
|
4
|
-
export declare function createSlackCanvasCreateTool(context: SlackToolContext, state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
5
|
-
title: import("@sinclair/typebox").TString;
|
|
6
|
-
markdown: import("@sinclair/typebox").TString;
|
|
7
|
-
}>>;
|
|
8
|
-
/**
|
|
9
|
-
* Create a tool that reads a Slack canvas the bot has access to. Accepts
|
|
10
|
-
* either a canvas/file ID (`F...`) or a Slack canvas/docs URL and returns the
|
|
11
|
-
* canvas body downloaded via the bot's file access.
|
|
12
|
-
*/
|
|
13
|
-
export declare function createSlackCanvasReadTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
14
|
-
canvas: import("@sinclair/typebox").TString;
|
|
15
|
-
offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
16
|
-
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
17
|
-
}>>;
|
|
18
|
-
/** Create a tool that edits a Slack canvas like a markdown file. */
|
|
19
|
-
export declare function createSlackCanvasEditTool(state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
20
|
-
canvas: import("@sinclair/typebox").TString;
|
|
21
|
-
edits: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
22
|
-
oldText: import("@sinclair/typebox").TString;
|
|
23
|
-
newText: import("@sinclair/typebox").TString;
|
|
24
|
-
}>>;
|
|
25
|
-
}>>;
|
|
26
|
-
/** Create a tool that deliberately replaces a Slack canvas body. */
|
|
27
|
-
export declare function createSlackCanvasWriteTool(state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
28
|
-
canvas: import("@sinclair/typebox").TString;
|
|
29
|
-
content: import("@sinclair/typebox").TString;
|
|
30
|
-
}>>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { SlackToolContext } from "@/chat/tools/slack/context";
|
|
2
|
-
export declare function createSlackChannelListMessagesTool(context: SlackToolContext): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
3
|
-
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
4
|
-
cursor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
5
|
-
oldest: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
6
|
-
latest: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
7
|
-
inclusive: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
8
|
-
max_pages: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
9
|
-
}>>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { SlackToolContext } from "@/chat/tools/slack/context";
|
|
2
|
-
import type { ToolState } from "@/chat/tools/types";
|
|
3
|
-
export declare function createSlackChannelPostMessageTool(context: SlackToolContext, state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
4
|
-
text: import("@sinclair/typebox").TString;
|
|
5
|
-
}>>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ToolState } from "@/chat/tools/types";
|
|
2
|
-
/** Create a tool that provisions a new Slack todo list. */
|
|
3
|
-
export declare function createSlackListCreateTool(state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
4
|
-
name: import("@sinclair/typebox").TString;
|
|
5
|
-
}>>;
|
|
6
|
-
/** Create a tool that appends items to the active Slack list. */
|
|
7
|
-
export declare function createSlackListAddItemsTool(state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
8
|
-
items: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
9
|
-
assignee_user_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
10
|
-
due_date: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
11
|
-
}>>;
|
|
12
|
-
/** Create a tool that reads items from the active Slack list. */
|
|
13
|
-
export declare function createSlackListGetItemsTool(state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
14
|
-
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
15
|
-
}>>;
|
|
16
|
-
/** Create a tool that updates an item in the active Slack list. */
|
|
17
|
-
export declare function createSlackListUpdateItemTool(state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
18
|
-
item_id: import("@sinclair/typebox").TString;
|
|
19
|
-
completed: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
20
|
-
title: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
21
|
-
}>>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { SlackToolContext } from "@/chat/tools/slack/context";
|
|
2
|
-
import type { ToolState } from "@/chat/tools/types";
|
|
3
|
-
export declare function createSlackMessageAddReactionTool(context: SlackToolContext, state: ToolState): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
4
|
-
emoji: import("@sinclair/typebox").TString;
|
|
5
|
-
}>>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type DestinationVisibilityReader } from "@/chat/tools/slack/channel-access";
|
|
2
|
-
import type { SlackToolContext } from "@/chat/tools/slack/context";
|
|
3
|
-
/** Create a tool that reads a Slack thread from a shared message URL or explicit coordinates. */
|
|
4
|
-
export declare function createSlackThreadReadTool(context: SlackToolContext, deps?: {
|
|
5
|
-
visibilityStore?: DestinationVisibilityReader;
|
|
6
|
-
}): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
7
|
-
url: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
8
|
-
channel_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
9
|
-
ts: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
10
|
-
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
11
|
-
max_pages: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
12
|
-
}>>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare function createSlackUserLookupTool(): import("@/chat/tools/definition").ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
2
|
-
user_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
3
|
-
email: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
4
|
-
query: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
5
|
-
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
6
|
-
max_pages: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
7
|
-
include_bots: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
8
|
-
}>>;
|
package/dist/chunk-AHLSXMOU.js
DELETED
|
@@ -1,506 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getSlackBotToken
|
|
3
|
-
} from "./chunk-S35CPNPT.js";
|
|
4
|
-
import {
|
|
5
|
-
isSlackConversationId,
|
|
6
|
-
isSlackTeamId,
|
|
7
|
-
logWarn,
|
|
8
|
-
setSpanAttributes,
|
|
9
|
-
setSpanStatus,
|
|
10
|
-
withSpan
|
|
11
|
-
} from "./chunk-VMBZFPZM.js";
|
|
12
|
-
|
|
13
|
-
// src/chat/slack/client.ts
|
|
14
|
-
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
15
|
-
import { WebClient } from "@slack/web-api";
|
|
16
|
-
|
|
17
|
-
// src/chat/slack/workspace-context.ts
|
|
18
|
-
import { AsyncLocalStorage } from "async_hooks";
|
|
19
|
-
var workspaceTeamIdStorage = new AsyncLocalStorage();
|
|
20
|
-
function runWithWorkspaceTeamId(teamId, fn) {
|
|
21
|
-
if (!teamId) return fn();
|
|
22
|
-
return workspaceTeamIdStorage.run(teamId, fn);
|
|
23
|
-
}
|
|
24
|
-
function getWorkspaceTeamId() {
|
|
25
|
-
return workspaceTeamIdStorage.getStore();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// src/chat/slack/client.ts
|
|
29
|
-
var SlackActionError = class extends Error {
|
|
30
|
-
code;
|
|
31
|
-
apiError;
|
|
32
|
-
needed;
|
|
33
|
-
provided;
|
|
34
|
-
statusCode;
|
|
35
|
-
requestId;
|
|
36
|
-
errorData;
|
|
37
|
-
retryAfterSeconds;
|
|
38
|
-
detail;
|
|
39
|
-
detailLine;
|
|
40
|
-
detailRule;
|
|
41
|
-
constructor(message, code, options = {}) {
|
|
42
|
-
super(message);
|
|
43
|
-
this.name = "SlackActionError";
|
|
44
|
-
this.code = code;
|
|
45
|
-
this.apiError = options.apiError;
|
|
46
|
-
this.needed = options.needed;
|
|
47
|
-
this.provided = options.provided;
|
|
48
|
-
this.statusCode = options.statusCode;
|
|
49
|
-
this.requestId = options.requestId;
|
|
50
|
-
this.errorData = options.errorData;
|
|
51
|
-
this.retryAfterSeconds = options.retryAfterSeconds;
|
|
52
|
-
this.detail = options.detail;
|
|
53
|
-
this.detailLine = options.detailLine;
|
|
54
|
-
this.detailRule = options.detailRule;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
function serializeSlackErrorData(data) {
|
|
58
|
-
if (!data || typeof data !== "object") {
|
|
59
|
-
return void 0;
|
|
60
|
-
}
|
|
61
|
-
const filtered = Object.fromEntries(
|
|
62
|
-
Object.entries(data).filter(
|
|
63
|
-
([key]) => key !== "error"
|
|
64
|
-
)
|
|
65
|
-
);
|
|
66
|
-
if (Object.keys(filtered).length === 0) {
|
|
67
|
-
return void 0;
|
|
68
|
-
}
|
|
69
|
-
try {
|
|
70
|
-
const serialized = JSON.stringify(filtered);
|
|
71
|
-
return serialized.length <= 600 ? serialized : `${serialized.slice(0, 597)}...`;
|
|
72
|
-
} catch {
|
|
73
|
-
return void 0;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
function getHeaderString(headers, name) {
|
|
77
|
-
if (!headers || typeof headers !== "object") {
|
|
78
|
-
return void 0;
|
|
79
|
-
}
|
|
80
|
-
const key = name.toLowerCase();
|
|
81
|
-
const entries = headers;
|
|
82
|
-
for (const [entryKey, value] of Object.entries(entries)) {
|
|
83
|
-
if (entryKey.toLowerCase() !== key) continue;
|
|
84
|
-
if (typeof value === "string") return value;
|
|
85
|
-
if (Array.isArray(value)) {
|
|
86
|
-
const first = value.find((entry) => typeof entry === "string");
|
|
87
|
-
return typeof first === "string" ? first : void 0;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return void 0;
|
|
91
|
-
}
|
|
92
|
-
function parseSlackCanvasDetail(detail) {
|
|
93
|
-
if (typeof detail !== "string") {
|
|
94
|
-
return {};
|
|
95
|
-
}
|
|
96
|
-
const trimmed = detail.trim();
|
|
97
|
-
if (!trimmed) {
|
|
98
|
-
return {};
|
|
99
|
-
}
|
|
100
|
-
const parsed = {
|
|
101
|
-
detail: trimmed
|
|
102
|
-
};
|
|
103
|
-
const lineMatch = trimmed.match(/line\s+(\d+):/i);
|
|
104
|
-
if (lineMatch) {
|
|
105
|
-
const line = Number.parseInt(lineMatch[1] ?? "", 10);
|
|
106
|
-
if (Number.isFinite(line)) {
|
|
107
|
-
parsed.detailLine = line;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (/unsupported heading depth/i.test(trimmed)) {
|
|
111
|
-
parsed.detailRule = "unsupported_heading_depth";
|
|
112
|
-
}
|
|
113
|
-
return parsed;
|
|
114
|
-
}
|
|
115
|
-
var installationTokenStorage = new AsyncLocalStorage2();
|
|
116
|
-
var clientsByToken = /* @__PURE__ */ new Map();
|
|
117
|
-
function runWithSlackInstallationToken(token, fn) {
|
|
118
|
-
const trimmed = token.trim();
|
|
119
|
-
if (!trimmed) {
|
|
120
|
-
throw new SlackActionError(
|
|
121
|
-
"Slack installation token binding requires a non-empty token",
|
|
122
|
-
"missing_token"
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
return installationTokenStorage.run({ token: trimmed }, fn);
|
|
126
|
-
}
|
|
127
|
-
function resolveSlackToken() {
|
|
128
|
-
const ambientToken = installationTokenStorage.getStore()?.token;
|
|
129
|
-
if (ambientToken) {
|
|
130
|
-
return ambientToken;
|
|
131
|
-
}
|
|
132
|
-
const envToken = getSlackBotToken();
|
|
133
|
-
if (envToken) {
|
|
134
|
-
return envToken;
|
|
135
|
-
}
|
|
136
|
-
const teamId = getWorkspaceTeamId();
|
|
137
|
-
if (teamId) {
|
|
138
|
-
throw new SlackActionError(
|
|
139
|
-
`Slack call is scoped to workspace ${teamId} but no installation token is bound and no default bot token is configured`,
|
|
140
|
-
"missing_token"
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
throw new SlackActionError(
|
|
144
|
-
"SLACK_BOT_TOKEN (or SLACK_BOT_USER_TOKEN) is required for Slack Web API actions in this service",
|
|
145
|
-
"missing_token"
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
function normalizeSlackConversationId(channelId) {
|
|
149
|
-
if (!channelId) return void 0;
|
|
150
|
-
const trimmed = channelId.trim();
|
|
151
|
-
if (!trimmed) return void 0;
|
|
152
|
-
if (!trimmed.startsWith("slack:")) {
|
|
153
|
-
return trimmed;
|
|
154
|
-
}
|
|
155
|
-
const parts = trimmed.split(":");
|
|
156
|
-
return parts[1]?.trim() || void 0;
|
|
157
|
-
}
|
|
158
|
-
function getClient() {
|
|
159
|
-
const token = resolveSlackToken();
|
|
160
|
-
let cached = clientsByToken.get(token);
|
|
161
|
-
if (!cached) {
|
|
162
|
-
cached = new WebClient(token, {
|
|
163
|
-
retryConfig: { retries: 0 },
|
|
164
|
-
rejectRateLimitedCalls: true
|
|
165
|
-
});
|
|
166
|
-
clientsByToken.set(token, cached);
|
|
167
|
-
}
|
|
168
|
-
return cached;
|
|
169
|
-
}
|
|
170
|
-
function mapSlackError(error) {
|
|
171
|
-
if (error instanceof SlackActionError) {
|
|
172
|
-
return error;
|
|
173
|
-
}
|
|
174
|
-
const candidate = error;
|
|
175
|
-
const apiError = candidate.data?.error;
|
|
176
|
-
const message = candidate.message ?? "Slack action failed";
|
|
177
|
-
const baseOptions = {
|
|
178
|
-
apiError,
|
|
179
|
-
statusCode: candidate.statusCode,
|
|
180
|
-
requestId: getHeaderString(candidate.headers, "x-slack-req-id"),
|
|
181
|
-
errorData: serializeSlackErrorData(candidate.data),
|
|
182
|
-
...parseSlackCanvasDetail(candidate.data?.detail)
|
|
183
|
-
};
|
|
184
|
-
if (apiError === "missing_scope") {
|
|
185
|
-
return new SlackActionError(message, "missing_scope", {
|
|
186
|
-
...baseOptions,
|
|
187
|
-
needed: candidate.data?.needed,
|
|
188
|
-
provided: candidate.data?.provided
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
if (apiError === "not_in_channel") {
|
|
192
|
-
return new SlackActionError(message, "not_in_channel", baseOptions);
|
|
193
|
-
}
|
|
194
|
-
if (apiError === "restricted_action_read_only_channel") {
|
|
195
|
-
return new SlackActionError(message, "read_only_channel", baseOptions);
|
|
196
|
-
}
|
|
197
|
-
if (apiError === "already_reacted") {
|
|
198
|
-
return new SlackActionError(message, "already_reacted", baseOptions);
|
|
199
|
-
}
|
|
200
|
-
if (apiError === "no_reaction") {
|
|
201
|
-
return new SlackActionError(message, "no_reaction", baseOptions);
|
|
202
|
-
}
|
|
203
|
-
if (apiError === "invalid_arguments") {
|
|
204
|
-
return new SlackActionError(message, "invalid_arguments", baseOptions);
|
|
205
|
-
}
|
|
206
|
-
if (apiError === "invalid_cursor") {
|
|
207
|
-
return new SlackActionError(message, "invalid_arguments", baseOptions);
|
|
208
|
-
}
|
|
209
|
-
if (apiError === "invalid_name") {
|
|
210
|
-
return new SlackActionError(message, "invalid_arguments", baseOptions);
|
|
211
|
-
}
|
|
212
|
-
if (apiError === "not_found" || apiError === "channel_not_found" || apiError === "message_not_found") {
|
|
213
|
-
return new SlackActionError(message, "not_found", baseOptions);
|
|
214
|
-
}
|
|
215
|
-
if (apiError === "feature_not_enabled" || apiError === "not_allowed_token_type") {
|
|
216
|
-
return new SlackActionError(message, "feature_unavailable", baseOptions);
|
|
217
|
-
}
|
|
218
|
-
if (apiError === "canvas_creation_failed") {
|
|
219
|
-
return new SlackActionError(message, "canvas_creation_failed", baseOptions);
|
|
220
|
-
}
|
|
221
|
-
if (apiError === "canvas_editing_failed") {
|
|
222
|
-
return new SlackActionError(message, "canvas_editing_failed", baseOptions);
|
|
223
|
-
}
|
|
224
|
-
if (candidate.code === "slack_webapi_rate_limited_error" || candidate.statusCode === 429) {
|
|
225
|
-
return new SlackActionError(message, "rate_limited", {
|
|
226
|
-
...baseOptions,
|
|
227
|
-
retryAfterSeconds: candidate.retryAfter
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
return new SlackActionError(message, "internal_error", baseOptions);
|
|
231
|
-
}
|
|
232
|
-
function sleep(ms) {
|
|
233
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
234
|
-
}
|
|
235
|
-
var MAX_RETRY_DELAY_MS = 1e4;
|
|
236
|
-
var MAX_TOTAL_RETRY_DELAY_MS = 2e4;
|
|
237
|
-
var CONNECTION_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
238
|
-
"ECONNREFUSED",
|
|
239
|
-
"ECONNRESET",
|
|
240
|
-
"ENOTFOUND",
|
|
241
|
-
"EAI_AGAIN"
|
|
242
|
-
]);
|
|
243
|
-
var TIMEOUT_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
244
|
-
"ETIMEDOUT",
|
|
245
|
-
"ECONNABORTED",
|
|
246
|
-
"ESOCKETTIMEDOUT"
|
|
247
|
-
]);
|
|
248
|
-
function findNetworkErrorCode(error, depth = 0) {
|
|
249
|
-
if (!error || typeof error !== "object" || depth > 4) {
|
|
250
|
-
return void 0;
|
|
251
|
-
}
|
|
252
|
-
const candidate = error;
|
|
253
|
-
if (typeof candidate.code === "string" && (CONNECTION_ERROR_CODES.has(candidate.code) || TIMEOUT_ERROR_CODES.has(candidate.code))) {
|
|
254
|
-
return candidate.code;
|
|
255
|
-
}
|
|
256
|
-
return findNetworkErrorCode(candidate.original, depth + 1) ?? findNetworkErrorCode(candidate.cause, depth + 1);
|
|
257
|
-
}
|
|
258
|
-
function hasSocketHangUpMessage(error) {
|
|
259
|
-
return error instanceof Error && error.message.toLowerCase().includes("socket hang up");
|
|
260
|
-
}
|
|
261
|
-
function classifySlackRetry(raw, mapped) {
|
|
262
|
-
if (mapped.code === "rate_limited") {
|
|
263
|
-
return "rate_limited";
|
|
264
|
-
}
|
|
265
|
-
if (mapped.statusCode !== void 0 && mapped.statusCode >= 500) {
|
|
266
|
-
return "server_error";
|
|
267
|
-
}
|
|
268
|
-
const networkCode = findNetworkErrorCode(raw);
|
|
269
|
-
if (networkCode && CONNECTION_ERROR_CODES.has(networkCode)) {
|
|
270
|
-
return "connection";
|
|
271
|
-
}
|
|
272
|
-
if (networkCode && TIMEOUT_ERROR_CODES.has(networkCode)) {
|
|
273
|
-
return "timeout";
|
|
274
|
-
}
|
|
275
|
-
if (hasSocketHangUpMessage(raw)) {
|
|
276
|
-
return "connection";
|
|
277
|
-
}
|
|
278
|
-
return "none";
|
|
279
|
-
}
|
|
280
|
-
async function withSlackRetries(task, maxAttempts = 3, context = {}) {
|
|
281
|
-
let attempt = 0;
|
|
282
|
-
let totalDelayMs = 0;
|
|
283
|
-
const action = context.action ?? "unknown";
|
|
284
|
-
while (attempt < maxAttempts) {
|
|
285
|
-
attempt += 1;
|
|
286
|
-
const attemptNumber = attempt;
|
|
287
|
-
try {
|
|
288
|
-
return await withSpan(
|
|
289
|
-
`POST slack.com/api/${action}`,
|
|
290
|
-
"http.client",
|
|
291
|
-
{},
|
|
292
|
-
async () => {
|
|
293
|
-
try {
|
|
294
|
-
return await task();
|
|
295
|
-
} catch (error) {
|
|
296
|
-
const mapped = mapSlackError(error);
|
|
297
|
-
const errorAttrs = {
|
|
298
|
-
"error.type": mapped.code
|
|
299
|
-
};
|
|
300
|
-
if (mapped.apiError) {
|
|
301
|
-
errorAttrs["app.slack.api_error_code"] = mapped.apiError;
|
|
302
|
-
}
|
|
303
|
-
if (mapped.code === "rate_limited") {
|
|
304
|
-
errorAttrs["http.response.status_code"] = 429;
|
|
305
|
-
if (mapped.retryAfterSeconds) {
|
|
306
|
-
errorAttrs["app.slack.retry_after_ms"] = mapped.retryAfterSeconds * 1e3;
|
|
307
|
-
}
|
|
308
|
-
} else if (mapped.statusCode != null) {
|
|
309
|
-
errorAttrs["http.response.status_code"] = mapped.statusCode;
|
|
310
|
-
}
|
|
311
|
-
setSpanAttributes(errorAttrs);
|
|
312
|
-
setSpanStatus("error");
|
|
313
|
-
throw error;
|
|
314
|
-
}
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
"http.request.method": "POST",
|
|
318
|
-
"server.address": "slack.com",
|
|
319
|
-
"url.scheme": "https",
|
|
320
|
-
"url.path": `/api/${action}`,
|
|
321
|
-
"app.slack.method": action,
|
|
322
|
-
"app.retry.max_attempts": maxAttempts,
|
|
323
|
-
...attemptNumber > 1 ? { "http.resend_count": attemptNumber - 1 } : {},
|
|
324
|
-
...context.attributes ?? {},
|
|
325
|
-
...context.spanAttributes ?? {}
|
|
326
|
-
}
|
|
327
|
-
);
|
|
328
|
-
} catch (error) {
|
|
329
|
-
const mapped = mapSlackError(error);
|
|
330
|
-
const retryClass = classifySlackRetry(error, mapped);
|
|
331
|
-
const isRetryable = retryClass === "rate_limited" || retryClass === "connection" || retryClass === "server_error" || retryClass === "timeout" && context.idempotent === true;
|
|
332
|
-
const remainingDelayBudgetMs = MAX_TOTAL_RETRY_DELAY_MS - totalDelayMs;
|
|
333
|
-
const baseLogAttributes = {
|
|
334
|
-
"app.slack.action": action,
|
|
335
|
-
"app.slack.error_code": mapped.code,
|
|
336
|
-
...mapped.apiError ? { "app.slack.api_error": mapped.apiError } : {},
|
|
337
|
-
...mapped.detail ? { "app.slack.detail": mapped.detail } : {},
|
|
338
|
-
...mapped.detailLine !== void 0 ? { "app.slack.detail_line": mapped.detailLine } : {},
|
|
339
|
-
...mapped.detailRule ? { "app.slack.detail_rule": mapped.detailRule } : {},
|
|
340
|
-
...mapped.requestId ? { "app.slack.request_id": mapped.requestId } : {},
|
|
341
|
-
...mapped.statusCode !== void 0 ? { "http.response.status_code": mapped.statusCode } : {},
|
|
342
|
-
...context.attributes ?? {}
|
|
343
|
-
};
|
|
344
|
-
if (!isRetryable || attempt >= maxAttempts || remainingDelayBudgetMs <= 0) {
|
|
345
|
-
logWarn(
|
|
346
|
-
"slack_action_failed",
|
|
347
|
-
{},
|
|
348
|
-
{
|
|
349
|
-
...baseLogAttributes,
|
|
350
|
-
...mapped.errorData ? { "app.slack.error_data": mapped.errorData } : {}
|
|
351
|
-
},
|
|
352
|
-
"Slack action failed"
|
|
353
|
-
);
|
|
354
|
-
throw mapped;
|
|
355
|
-
}
|
|
356
|
-
logWarn(
|
|
357
|
-
"slack_action_retrying",
|
|
358
|
-
{},
|
|
359
|
-
{
|
|
360
|
-
...baseLogAttributes,
|
|
361
|
-
"app.slack.retry_attempt": attempt,
|
|
362
|
-
"app.slack.retry_class": retryClass
|
|
363
|
-
},
|
|
364
|
-
"Retrying Slack action after transient failure"
|
|
365
|
-
);
|
|
366
|
-
const retryAfterMs = retryClass === "rate_limited" && mapped.retryAfterSeconds && mapped.retryAfterSeconds > 0 ? mapped.retryAfterSeconds * 1e3 : void 0;
|
|
367
|
-
const backoffMs = Math.min(2e3, 250 * 2 ** (attempt - 1));
|
|
368
|
-
const delayMs = Math.min(
|
|
369
|
-
retryAfterMs ?? backoffMs,
|
|
370
|
-
MAX_RETRY_DELAY_MS,
|
|
371
|
-
remainingDelayBudgetMs
|
|
372
|
-
);
|
|
373
|
-
totalDelayMs += delayMs;
|
|
374
|
-
await sleep(delayMs);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
throw new SlackActionError(
|
|
378
|
-
"Slack action exhausted retries",
|
|
379
|
-
"internal_error"
|
|
380
|
-
);
|
|
381
|
-
}
|
|
382
|
-
function getSlackClient() {
|
|
383
|
-
return getClient();
|
|
384
|
-
}
|
|
385
|
-
function isDmChannel(channelId) {
|
|
386
|
-
const normalized = normalizeSlackConversationId(channelId);
|
|
387
|
-
return Boolean(normalized && normalized.startsWith("D"));
|
|
388
|
-
}
|
|
389
|
-
function isConversationScopedChannel(channelId) {
|
|
390
|
-
const normalized = normalizeSlackConversationId(channelId);
|
|
391
|
-
if (!normalized) return false;
|
|
392
|
-
return normalized.startsWith("C") || normalized.startsWith("G") || normalized.startsWith("D");
|
|
393
|
-
}
|
|
394
|
-
function isConversationChannel(channelId) {
|
|
395
|
-
const normalized = normalizeSlackConversationId(channelId);
|
|
396
|
-
if (!normalized) return false;
|
|
397
|
-
return normalized.startsWith("C") || normalized.startsWith("G");
|
|
398
|
-
}
|
|
399
|
-
async function getFilePermalink(fileId) {
|
|
400
|
-
const client = getClient();
|
|
401
|
-
const response = await withSlackRetries(
|
|
402
|
-
() => client.files.info({
|
|
403
|
-
file: fileId
|
|
404
|
-
}),
|
|
405
|
-
3,
|
|
406
|
-
{
|
|
407
|
-
action: "files.info",
|
|
408
|
-
idempotent: true,
|
|
409
|
-
spanAttributes: { "app.slack.file_id": fileId }
|
|
410
|
-
}
|
|
411
|
-
);
|
|
412
|
-
return response.file?.permalink;
|
|
413
|
-
}
|
|
414
|
-
async function downloadPrivateSlackFile(url) {
|
|
415
|
-
const token = resolveSlackToken();
|
|
416
|
-
return withSpan(
|
|
417
|
-
"GET files.slack.com",
|
|
418
|
-
"http.client",
|
|
419
|
-
{},
|
|
420
|
-
async () => {
|
|
421
|
-
const response = await fetch(url, {
|
|
422
|
-
headers: {
|
|
423
|
-
Authorization: `Bearer ${token}`
|
|
424
|
-
}
|
|
425
|
-
});
|
|
426
|
-
setSpanAttributes({ "http.response.status_code": response.status });
|
|
427
|
-
if (!response.ok) {
|
|
428
|
-
setSpanAttributes({ "error.type": String(response.status) });
|
|
429
|
-
setSpanStatus("error");
|
|
430
|
-
throw new Error(`Slack file download failed: ${response.status}`);
|
|
431
|
-
}
|
|
432
|
-
return Buffer.from(await response.arrayBuffer());
|
|
433
|
-
},
|
|
434
|
-
{
|
|
435
|
-
"http.request.method": "GET",
|
|
436
|
-
"server.address": "files.slack.com",
|
|
437
|
-
"url.scheme": "https",
|
|
438
|
-
"app.slack.method": "files.download"
|
|
439
|
-
}
|
|
440
|
-
);
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
// src/chat/destination.ts
|
|
444
|
-
import {
|
|
445
|
-
destinationSchema
|
|
446
|
-
} from "@sentry/junior-plugin-api";
|
|
447
|
-
function createSlackDestination(input) {
|
|
448
|
-
const channelId = normalizeSlackConversationId(input.channelId);
|
|
449
|
-
const teamId = input.teamId?.trim();
|
|
450
|
-
if (!channelId || !teamId) {
|
|
451
|
-
return void 0;
|
|
452
|
-
}
|
|
453
|
-
if (!isSlackConversationId(channelId) || !isSlackTeamId(teamId)) {
|
|
454
|
-
return void 0;
|
|
455
|
-
}
|
|
456
|
-
return { platform: "slack", teamId, channelId };
|
|
457
|
-
}
|
|
458
|
-
function parseDestination(value) {
|
|
459
|
-
const parsed = destinationSchema.safeParse(value);
|
|
460
|
-
return parsed.success ? parsed.data : void 0;
|
|
461
|
-
}
|
|
462
|
-
function requireSlackDestination(destination, action) {
|
|
463
|
-
if (destination?.platform === "slack") {
|
|
464
|
-
return destination;
|
|
465
|
-
}
|
|
466
|
-
throw new Error(`${action} requires a Slack destination`);
|
|
467
|
-
}
|
|
468
|
-
function sameDestination(left, right) {
|
|
469
|
-
if (left.platform !== right.platform) {
|
|
470
|
-
return false;
|
|
471
|
-
}
|
|
472
|
-
if (left.platform === "local" && right.platform === "local") {
|
|
473
|
-
return left.conversationId === right.conversationId;
|
|
474
|
-
}
|
|
475
|
-
if (left.platform === "slack" && right.platform === "slack") {
|
|
476
|
-
return left.teamId === right.teamId && left.channelId === right.channelId;
|
|
477
|
-
}
|
|
478
|
-
return false;
|
|
479
|
-
}
|
|
480
|
-
function destinationKey(destination) {
|
|
481
|
-
if (destination.platform === "local") {
|
|
482
|
-
return destination.conversationId;
|
|
483
|
-
}
|
|
484
|
-
return `slack:${destination.teamId}:${destination.channelId}`;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
export {
|
|
488
|
-
runWithWorkspaceTeamId,
|
|
489
|
-
getWorkspaceTeamId,
|
|
490
|
-
SlackActionError,
|
|
491
|
-
getHeaderString,
|
|
492
|
-
runWithSlackInstallationToken,
|
|
493
|
-
normalizeSlackConversationId,
|
|
494
|
-
withSlackRetries,
|
|
495
|
-
getSlackClient,
|
|
496
|
-
isDmChannel,
|
|
497
|
-
isConversationScopedChannel,
|
|
498
|
-
isConversationChannel,
|
|
499
|
-
getFilePermalink,
|
|
500
|
-
downloadPrivateSlackFile,
|
|
501
|
-
createSlackDestination,
|
|
502
|
-
parseDestination,
|
|
503
|
-
requireSlackDestination,
|
|
504
|
-
sameDestination,
|
|
505
|
-
destinationKey
|
|
506
|
-
};
|
package/dist/chunk-FTMXFBDC.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// src/deployment.ts
|
|
2
|
-
var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
|
|
3
|
-
var JUNIOR_HEARTBEAT_CRON_SCHEDULE = "* * * * *";
|
|
4
|
-
var JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE = "/api/internal/agent/continue";
|
|
5
|
-
var JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE = "/api/internal/plugin/tasks";
|
|
6
|
-
var LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION = "api/internal/agent/continue.ts";
|
|
7
|
-
function toOptionalTrimmed(value) {
|
|
8
|
-
const trimmed = value?.trim();
|
|
9
|
-
return trimmed ? trimmed : void 0;
|
|
10
|
-
}
|
|
11
|
-
function getDeploymentServiceVersion() {
|
|
12
|
-
return toOptionalTrimmed(process.env.SENTRY_RELEASE) ?? toOptionalTrimmed(process.env.VERCEL_GIT_COMMIT_SHA);
|
|
13
|
-
}
|
|
14
|
-
function getDeploymentTelemetryAttributes() {
|
|
15
|
-
const attributes = {};
|
|
16
|
-
const serviceVersion = getDeploymentServiceVersion();
|
|
17
|
-
const deploymentId = toOptionalTrimmed(process.env.VERCEL_DEPLOYMENT_ID);
|
|
18
|
-
if (serviceVersion) {
|
|
19
|
-
attributes["service.version"] = serviceVersion;
|
|
20
|
-
}
|
|
21
|
-
if (deploymentId) {
|
|
22
|
-
attributes["deployment.id"] = deploymentId;
|
|
23
|
-
}
|
|
24
|
-
return attributes;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// src/chat/coerce.ts
|
|
28
|
-
function toOptionalString(value) {
|
|
29
|
-
return typeof value === "string" && value.trim() ? value : void 0;
|
|
30
|
-
}
|
|
31
|
-
function toOptionalNumber(value) {
|
|
32
|
-
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
33
|
-
}
|
|
34
|
-
function isRecord(value) {
|
|
35
|
-
return typeof value === "object" && value !== null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export {
|
|
39
|
-
toOptionalString,
|
|
40
|
-
toOptionalNumber,
|
|
41
|
-
isRecord,
|
|
42
|
-
JUNIOR_HEARTBEAT_ROUTE,
|
|
43
|
-
JUNIOR_HEARTBEAT_CRON_SCHEDULE,
|
|
44
|
-
JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
|
|
45
|
-
JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE,
|
|
46
|
-
LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION,
|
|
47
|
-
getDeploymentServiceVersion,
|
|
48
|
-
getDeploymentTelemetryAttributes
|
|
49
|
-
};
|