@inkeep/agents-work-apps 0.0.0-dev-20260224030137 → 0.0.0-dev-20260224032024
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/env.d.ts +2 -2
- package/dist/github/index.d.ts +3 -3
- package/dist/github/mcp/auth.d.ts +2 -2
- package/dist/github/mcp/index.d.ts +2 -2
- package/dist/github/routes/setup.d.ts +2 -2
- package/dist/github/routes/tokenExchange.d.ts +2 -2
- package/dist/github/routes/webhooks.d.ts +2 -2
- package/dist/slack/dispatcher.js +1 -1
- package/dist/slack/services/agent-resolution.js +66 -18
- package/dist/slack/services/blocks/index.d.ts +1 -0
- package/dist/slack/services/blocks/index.js +1 -4
- package/dist/slack/services/commands/index.js +1 -1
- package/dist/slack/services/events/app-mention.js +1 -1
- package/dist/slack/services/events/block-actions.js +1 -1
- package/dist/slack/services/events/modal-submission.js +14 -7
- package/dist/slack/services/events/streaming.js +1 -1
- package/dist/slack/services/events/utils.d.ts +1 -1
- package/dist/slack/services/index.js +1 -1
- package/dist/slack/services/modals.d.ts +1 -0
- package/dist/slack/services/modals.js +4 -2
- package/package.json +2 -2
package/dist/env.d.ts
CHANGED
|
@@ -14,11 +14,11 @@ declare const envSchema: z.ZodObject<{
|
|
|
14
14
|
pentest: "pentest";
|
|
15
15
|
}>>;
|
|
16
16
|
LOG_LEVEL: z.ZodDefault<z.ZodEnum<{
|
|
17
|
-
error: "error";
|
|
18
17
|
trace: "trace";
|
|
19
18
|
debug: "debug";
|
|
20
19
|
info: "info";
|
|
21
20
|
warn: "warn";
|
|
21
|
+
error: "error";
|
|
22
22
|
}>>;
|
|
23
23
|
INKEEP_AGENTS_RUN_DATABASE_URL: z.ZodOptional<z.ZodString>;
|
|
24
24
|
INKEEP_AGENTS_MANAGE_UI_URL: z.ZodOptional<z.ZodString>;
|
|
@@ -44,7 +44,7 @@ declare const envSchema: z.ZodObject<{
|
|
|
44
44
|
declare const env: {
|
|
45
45
|
NODE_ENV: "development" | "production" | "test";
|
|
46
46
|
ENVIRONMENT: "development" | "production" | "test" | "pentest";
|
|
47
|
-
LOG_LEVEL: "
|
|
47
|
+
LOG_LEVEL: "trace" | "debug" | "info" | "warn" | "error";
|
|
48
48
|
INKEEP_AGENTS_RUN_DATABASE_URL?: string | undefined;
|
|
49
49
|
INKEEP_AGENTS_MANAGE_UI_URL?: string | undefined;
|
|
50
50
|
GITHUB_APP_ID?: string | undefined;
|
package/dist/github/index.d.ts
CHANGED
|
@@ -4,10 +4,10 @@ import "./routes/setup.js";
|
|
|
4
4
|
import "./routes/tokenExchange.js";
|
|
5
5
|
import { WebhookVerificationResult, verifyWebhookSignature } from "./routes/webhooks.js";
|
|
6
6
|
import { Hono } from "hono";
|
|
7
|
-
import * as
|
|
7
|
+
import * as hono_types1 from "hono/types";
|
|
8
8
|
|
|
9
9
|
//#region src/github/index.d.ts
|
|
10
|
-
declare function createGithubRoutes(): Hono<
|
|
11
|
-
declare const githubRoutes: Hono<
|
|
10
|
+
declare function createGithubRoutes(): Hono<hono_types1.BlankEnv, hono_types1.BlankSchema, "/">;
|
|
11
|
+
declare const githubRoutes: Hono<hono_types1.BlankEnv, hono_types1.BlankSchema, "/">;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { GenerateInstallationAccessTokenResult, GenerateTokenError, GenerateTokenResult, GitHubAppConfig, InstallationAccessToken, InstallationInfo, LookupInstallationError, LookupInstallationForRepoResult, LookupInstallationResult, WebhookVerificationResult, clearConfigCache, createAppJwt, createGithubRoutes, determineStatus, fetchInstallationDetails, fetchInstallationRepositories, generateInstallationAccessToken, getGitHubAppConfig, getGitHubAppName, getStateSigningSecret, getWebhookSecret, githubRoutes, isGitHubAppConfigured, isGitHubAppNameConfigured, isStateSigningConfigured, isWebhookConfigured, lookupInstallationForRepo, validateGitHubAppConfigOnStartup, validateGitHubInstallFlowConfigOnStartup, validateGitHubWebhookConfigOnStartup, verifyWebhookSignature };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as hono0 from "hono";
|
|
2
2
|
|
|
3
3
|
//#region src/github/mcp/auth.d.ts
|
|
4
|
-
declare const githubMcpAuth: () =>
|
|
4
|
+
declare const githubMcpAuth: () => hono0.MiddlewareHandler<{
|
|
5
5
|
Variables: {
|
|
6
6
|
toolId: string;
|
|
7
7
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types5 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/github/mcp/index.d.ts
|
|
5
5
|
declare const app: Hono<{
|
|
6
6
|
Variables: {
|
|
7
7
|
toolId: string;
|
|
8
8
|
};
|
|
9
|
-
},
|
|
9
|
+
}, hono_types5.BlankSchema, "/">;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { app as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types8 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/github/routes/setup.d.ts
|
|
5
|
-
declare const app: Hono<
|
|
5
|
+
declare const app: Hono<hono_types8.BlankEnv, hono_types8.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types0 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/github/routes/tokenExchange.d.ts
|
|
5
|
-
declare const app: Hono<
|
|
5
|
+
declare const app: Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types6 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/github/routes/webhooks.d.ts
|
|
5
5
|
interface WebhookVerificationResult {
|
|
@@ -7,6 +7,6 @@ interface WebhookVerificationResult {
|
|
|
7
7
|
error?: string;
|
|
8
8
|
}
|
|
9
9
|
declare function verifyWebhookSignature(payload: string, signature: string | undefined, secret: string): WebhookVerificationResult;
|
|
10
|
-
declare const app: Hono<
|
|
10
|
+
declare const app: Hono<hono_types6.BlankEnv, hono_types6.BlankSchema, "/">;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { WebhookVerificationResult, app as default, verifyWebhookSignature };
|
package/dist/slack/dispatcher.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getLogger } from "../logger.js";
|
|
2
2
|
import { findWorkspaceConnectionByTeamId } from "./services/nango.js";
|
|
3
|
-
import { getSlackClient } from "./services/client.js";
|
|
4
3
|
import { sendResponseUrlMessage } from "./services/events/utils.js";
|
|
4
|
+
import { getSlackClient } from "./services/client.js";
|
|
5
5
|
import { SLACK_SPAN_KEYS } from "./tracer.js";
|
|
6
6
|
import { handleAppMention } from "./services/events/app-mention.js";
|
|
7
7
|
import { handleMessageShortcut, handleOpenAgentSelectorModal, handleOpenFollowUpModal, handleToolApproval } from "./services/events/block-actions.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getLogger } from "../../logger.js";
|
|
2
2
|
import runDbClient_default from "../../db/runDbClient.js";
|
|
3
3
|
import { getWorkspaceDefaultAgentFromNango } from "./nango.js";
|
|
4
|
+
import { fetchAgentsForProject } from "./events/utils.js";
|
|
4
5
|
import { findWorkAppSlackChannelAgentConfig } from "@inkeep/agents-core";
|
|
5
6
|
|
|
6
7
|
//#region src/slack/services/agent-resolution.ts
|
|
@@ -11,6 +12,35 @@ import { findWorkAppSlackChannelAgentConfig } from "@inkeep/agents-core";
|
|
|
11
12
|
* Priority: Channel default > Workspace default (all admin-controlled)
|
|
12
13
|
*/
|
|
13
14
|
const logger = getLogger("slack-agent-resolution");
|
|
15
|
+
const AGENT_NAME_CACHE_TTL_MS = 300 * 1e3;
|
|
16
|
+
const AGENT_NAME_CACHE_MAX_SIZE = 500;
|
|
17
|
+
const agentNameCache = /* @__PURE__ */ new Map();
|
|
18
|
+
async function lookupAgentName(tenantId, projectId, agentId) {
|
|
19
|
+
const cacheKey = `${tenantId}:${projectId}:${agentId}`;
|
|
20
|
+
const cached = agentNameCache.get(cacheKey);
|
|
21
|
+
if (cached && cached.expiresAt > Date.now()) return cached.name || void 0;
|
|
22
|
+
const agents = await fetchAgentsForProject(tenantId, projectId);
|
|
23
|
+
for (const agent of agents) {
|
|
24
|
+
const key = `${tenantId}:${projectId}:${agent.id}`;
|
|
25
|
+
agentNameCache.set(key, {
|
|
26
|
+
name: agent.name || null,
|
|
27
|
+
expiresAt: Date.now() + AGENT_NAME_CACHE_TTL_MS
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (agentNameCache.size > AGENT_NAME_CACHE_MAX_SIZE) {
|
|
31
|
+
const now = Date.now();
|
|
32
|
+
for (const [key, entry] of agentNameCache) if (entry.expiresAt <= now) agentNameCache.delete(key);
|
|
33
|
+
if (agentNameCache.size > AGENT_NAME_CACHE_MAX_SIZE) {
|
|
34
|
+
const excess = agentNameCache.size - AGENT_NAME_CACHE_MAX_SIZE;
|
|
35
|
+
const keys = agentNameCache.keys();
|
|
36
|
+
for (let i = 0; i < excess; i++) {
|
|
37
|
+
const { value } = keys.next();
|
|
38
|
+
if (value) agentNameCache.delete(value);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return agents.find((a) => a.id === agentId)?.name || void 0;
|
|
43
|
+
}
|
|
14
44
|
/**
|
|
15
45
|
* Resolve the effective agent configuration.
|
|
16
46
|
* Priority: Channel default > Workspace default
|
|
@@ -25,6 +55,7 @@ async function resolveEffectiveAgent(params) {
|
|
|
25
55
|
teamId,
|
|
26
56
|
channelId
|
|
27
57
|
}, "Resolving effective agent");
|
|
58
|
+
let result = null;
|
|
28
59
|
if (channelId) {
|
|
29
60
|
const channelConfig = await findWorkAppSlackChannelAgentConfig(runDbClient_default)(tenantId, teamId, channelId);
|
|
30
61
|
if (channelConfig?.enabled) {
|
|
@@ -33,7 +64,7 @@ async function resolveEffectiveAgent(params) {
|
|
|
33
64
|
agentId: channelConfig.agentId,
|
|
34
65
|
source: "channel"
|
|
35
66
|
}, "Resolved agent from channel config");
|
|
36
|
-
|
|
67
|
+
result = {
|
|
37
68
|
projectId: channelConfig.projectId,
|
|
38
69
|
agentId: channelConfig.agentId,
|
|
39
70
|
agentName: channelConfig.agentName || void 0,
|
|
@@ -42,27 +73,39 @@ async function resolveEffectiveAgent(params) {
|
|
|
42
73
|
};
|
|
43
74
|
}
|
|
44
75
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
76
|
+
if (!result) {
|
|
77
|
+
const workspaceConfig = await getWorkspaceDefaultAgentFromNango(teamId);
|
|
78
|
+
if (workspaceConfig?.agentId && workspaceConfig.projectId) {
|
|
79
|
+
logger.info({
|
|
80
|
+
teamId,
|
|
81
|
+
agentId: workspaceConfig.agentId,
|
|
82
|
+
source: "workspace"
|
|
83
|
+
}, "Resolved agent from workspace config");
|
|
84
|
+
result = {
|
|
85
|
+
projectId: workspaceConfig.projectId,
|
|
86
|
+
agentId: workspaceConfig.agentId,
|
|
87
|
+
agentName: workspaceConfig.agentName,
|
|
88
|
+
source: "workspace",
|
|
89
|
+
grantAccessToMembers: workspaceConfig.grantAccessToMembers ?? true
|
|
90
|
+
};
|
|
91
|
+
}
|
|
59
92
|
}
|
|
60
|
-
|
|
93
|
+
if (result && (!result.agentName || result.agentName === result.agentId)) {
|
|
94
|
+
const name = await lookupAgentName(tenantId, result.projectId, result.agentId);
|
|
95
|
+
if (name) {
|
|
96
|
+
result.agentName = name;
|
|
97
|
+
logger.debug({
|
|
98
|
+
agentId: result.agentId,
|
|
99
|
+
agentName: name
|
|
100
|
+
}, "Enriched agent config with name from manage API");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (!result) logger.debug({
|
|
61
104
|
tenantId,
|
|
62
105
|
teamId,
|
|
63
106
|
channelId
|
|
64
107
|
}, "No agent configuration found");
|
|
65
|
-
return
|
|
108
|
+
return result;
|
|
66
109
|
}
|
|
67
110
|
/**
|
|
68
111
|
* Get all agent configuration sources for display purposes.
|
|
@@ -92,10 +135,15 @@ async function getAgentConfigSources(params) {
|
|
|
92
135
|
source: "workspace",
|
|
93
136
|
grantAccessToMembers: wsConfig.grantAccessToMembers ?? true
|
|
94
137
|
};
|
|
138
|
+
const effective = channelConfig || workspaceConfig;
|
|
139
|
+
if (effective && (!effective.agentName || effective.agentName === effective.agentId)) {
|
|
140
|
+
const name = await lookupAgentName(tenantId, effective.projectId, effective.agentId);
|
|
141
|
+
if (name) effective.agentName = name;
|
|
142
|
+
}
|
|
95
143
|
return {
|
|
96
144
|
channelConfig,
|
|
97
145
|
workspaceConfig,
|
|
98
|
-
effective
|
|
146
|
+
effective
|
|
99
147
|
};
|
|
100
148
|
}
|
|
101
149
|
|
|
@@ -44,10 +44,7 @@ function buildConversationResponseBlocks(params) {
|
|
|
44
44
|
}
|
|
45
45
|
}];
|
|
46
46
|
if (!isError) {
|
|
47
|
-
const contextBlock = createContextBlock({
|
|
48
|
-
agentName,
|
|
49
|
-
isPrivate: true
|
|
50
|
-
});
|
|
47
|
+
const contextBlock = createContextBlock({ agentName });
|
|
51
48
|
blocks.push(contextBlock);
|
|
52
49
|
blocks.push({
|
|
53
50
|
type: "actions",
|
|
@@ -2,11 +2,11 @@ import { env } from "../../../env.js";
|
|
|
2
2
|
import { getLogger } from "../../../logger.js";
|
|
3
3
|
import runDbClient_default from "../../../db/runDbClient.js";
|
|
4
4
|
import { findWorkspaceConnectionByTeamId } from "../nango.js";
|
|
5
|
+
import { extractApiErrorMessage, fetchAgentsForProject, fetchProjectsForTenant, getChannelAgentConfig, sendResponseUrlMessage } from "../events/utils.js";
|
|
5
6
|
import { resolveEffectiveAgent } from "../agent-resolution.js";
|
|
6
7
|
import { SlackStrings } from "../../i18n/strings.js";
|
|
7
8
|
import { createAlreadyLinkedMessage, createContextBlock, createCreateInkeepAccountMessage, createErrorMessage, createJwtLinkMessage, createNotLinkedMessage, createStatusMessage, createUnlinkSuccessMessage, createUpdatedHelpMessage } from "../blocks/index.js";
|
|
8
9
|
import { getSlackClient } from "../client.js";
|
|
9
|
-
import { extractApiErrorMessage, fetchAgentsForProject, fetchProjectsForTenant, getChannelAgentConfig, sendResponseUrlMessage } from "../events/utils.js";
|
|
10
10
|
import { buildAgentSelectorModal } from "../modals.js";
|
|
11
11
|
import { createInvitationInDb, deleteWorkAppSlackUserMapping, findWorkAppSlackUserMapping, findWorkAppSlackUserMappingBySlackUser, findWorkAppSlackWorkspaceByTeamId, flushTraces, getInProcessFetch, getOrganizationMemberByEmail, getPendingInvitationsByEmail, getWaitUntil, signSlackLinkToken, signSlackUserToken } from "@inkeep/agents-core";
|
|
12
12
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { env } from "../../../env.js";
|
|
2
2
|
import { getLogger } from "../../../logger.js";
|
|
3
3
|
import { findWorkspaceConnectionByTeamId } from "../nango.js";
|
|
4
|
+
import { checkIfBotThread, classifyError, findCachedUserMapping, formatChannelContext, generateSlackConversationId, getThreadContext, getUserFriendlyErrorMessage, timedOp } from "./utils.js";
|
|
4
5
|
import { resolveEffectiveAgent } from "../agent-resolution.js";
|
|
5
6
|
import { SlackStrings } from "../../i18n/strings.js";
|
|
6
7
|
import { getSlackChannelInfo, getSlackClient, getSlackUserInfo, postMessageInThread } from "../client.js";
|
|
7
|
-
import { checkIfBotThread, classifyError, findCachedUserMapping, formatChannelContext, generateSlackConversationId, getThreadContext, getUserFriendlyErrorMessage, timedOp } from "./utils.js";
|
|
8
8
|
import { SLACK_SPAN_KEYS, SLACK_SPAN_NAMES, setSpanWithError, tracer } from "../../tracer.js";
|
|
9
9
|
import { streamAgentResponse } from "./streaming.js";
|
|
10
10
|
import { signSlackUserToken } from "@inkeep/agents-core";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { env } from "../../../env.js";
|
|
2
2
|
import { getLogger } from "../../../logger.js";
|
|
3
3
|
import { findWorkspaceConnectionByTeamId } from "../nango.js";
|
|
4
|
+
import { fetchAgentsForProject, fetchProjectsForTenant, findCachedUserMapping, getChannelAgentConfig, sendResponseUrlMessage } from "./utils.js";
|
|
4
5
|
import { SlackStrings } from "../../i18n/strings.js";
|
|
5
6
|
import { ToolApprovalButtonValueSchema, buildToolApprovalDoneBlocks } from "../blocks/index.js";
|
|
6
7
|
import { getSlackClient } from "../client.js";
|
|
7
|
-
import { fetchAgentsForProject, fetchProjectsForTenant, findCachedUserMapping, getChannelAgentConfig, sendResponseUrlMessage } from "./utils.js";
|
|
8
8
|
import { buildAgentSelectorModal, buildFollowUpModal, buildMessageShortcutModal } from "../modals.js";
|
|
9
9
|
import { SLACK_SPAN_KEYS, SLACK_SPAN_NAMES, setSpanWithError, tracer } from "../../tracer.js";
|
|
10
10
|
import { getInProcessFetch, signSlackUserToken } from "@inkeep/agents-core";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { env } from "../../../env.js";
|
|
2
2
|
import { getLogger } from "../../../logger.js";
|
|
3
3
|
import { findWorkspaceConnectionByTeamId } from "../nango.js";
|
|
4
|
+
import { classifyError, extractApiErrorMessage, findCachedUserMapping, generateSlackConversationId, getThreadContext, getUserFriendlyErrorMessage, markdownToMrkdwn, sendResponseUrlMessage } from "./utils.js";
|
|
4
5
|
import { SlackStrings } from "../../i18n/strings.js";
|
|
5
6
|
import { buildConversationResponseBlocks } from "../blocks/index.js";
|
|
6
7
|
import { getSlackClient } from "../client.js";
|
|
7
|
-
import { classifyError, extractApiErrorMessage, findCachedUserMapping, generateSlackConversationId, getThreadContext, getUserFriendlyErrorMessage, markdownToMrkdwn, sendResponseUrlMessage } from "./utils.js";
|
|
8
8
|
import { SLACK_SPAN_KEYS, SLACK_SPAN_NAMES, setSpanWithError, tracer } from "../../tracer.js";
|
|
9
9
|
import { getInProcessFetch, signSlackUserToken } from "@inkeep/agents-core";
|
|
10
10
|
|
|
@@ -36,13 +36,16 @@ async function handleModalSubmission(view) {
|
|
|
36
36
|
const includeContext = includeContextValue?.selected_options?.some((o) => o.value === "include_context") ?? true;
|
|
37
37
|
let agentId = metadata.selectedAgentId;
|
|
38
38
|
let projectId = metadata.selectedProjectId;
|
|
39
|
+
let agentName = null;
|
|
39
40
|
if (agentSelectValue?.selected_option?.value) try {
|
|
40
41
|
const parsed = JSON.parse(agentSelectValue.selected_option.value);
|
|
41
42
|
agentId = parsed.agentId;
|
|
42
43
|
projectId = parsed.projectId;
|
|
44
|
+
agentName = parsed.agentName || null;
|
|
43
45
|
} catch {
|
|
44
46
|
logger.warn({ value: agentSelectValue.selected_option.value }, "Failed to parse agent select value");
|
|
45
47
|
}
|
|
48
|
+
const agentDisplayName = agentName || agentId || "Agent";
|
|
46
49
|
if (!agentId || !projectId) {
|
|
47
50
|
logger.error({ metadata }, "Missing agent or project ID in modal submission");
|
|
48
51
|
if (metadata.buttonResponseUrl) await sendResponseUrlMessage(metadata.buttonResponseUrl, {
|
|
@@ -112,7 +115,7 @@ async function handleModalSubmission(view) {
|
|
|
112
115
|
});
|
|
113
116
|
span.setAttribute(SLACK_SPAN_KEYS.CONVERSATION_ID, conversationId);
|
|
114
117
|
const apiBaseUrl = env.INKEEP_AGENTS_API_URL || "http://localhost:3002";
|
|
115
|
-
const thinkingText = SlackStrings.status.thinking(
|
|
118
|
+
const thinkingText = SlackStrings.status.thinking(agentDisplayName);
|
|
116
119
|
if (metadata.buttonResponseUrl) await sendResponseUrlMessage(metadata.buttonResponseUrl, {
|
|
117
120
|
text: thinkingText,
|
|
118
121
|
response_type: "ephemeral",
|
|
@@ -139,6 +142,7 @@ async function handleModalSubmission(view) {
|
|
|
139
142
|
slackClient,
|
|
140
143
|
metadata,
|
|
141
144
|
agentId,
|
|
145
|
+
agentDisplayName,
|
|
142
146
|
projectId,
|
|
143
147
|
tenantId,
|
|
144
148
|
conversationId,
|
|
@@ -194,7 +198,8 @@ async function handleFollowUpSubmission(view) {
|
|
|
194
198
|
span.end();
|
|
195
199
|
return;
|
|
196
200
|
}
|
|
197
|
-
const { conversationId, agentId, projectId, tenantId, teamId, slackUserId, channel } = metadata;
|
|
201
|
+
const { conversationId, agentId, agentName, projectId, tenantId, teamId, slackUserId, channel } = metadata;
|
|
202
|
+
const agentDisplayName = agentName || agentId || "Agent";
|
|
198
203
|
span.setAttribute(SLACK_SPAN_KEYS.TEAM_ID, teamId);
|
|
199
204
|
span.setAttribute(SLACK_SPAN_KEYS.CHANNEL_ID, channel);
|
|
200
205
|
span.setAttribute(SLACK_SPAN_KEYS.USER_ID, slackUserId);
|
|
@@ -234,7 +239,7 @@ async function handleFollowUpSubmission(view) {
|
|
|
234
239
|
await slackClient.chat.postEphemeral({
|
|
235
240
|
channel,
|
|
236
241
|
user: slackUserId,
|
|
237
|
-
text: SlackStrings.status.thinking(
|
|
242
|
+
text: SlackStrings.status.thinking(agentDisplayName)
|
|
238
243
|
});
|
|
239
244
|
const responseText = await callAgentApi({
|
|
240
245
|
apiBaseUrl,
|
|
@@ -247,11 +252,12 @@ async function handleFollowUpSubmission(view) {
|
|
|
247
252
|
const responseBlocks = buildConversationResponseBlocks({
|
|
248
253
|
userMessage: question,
|
|
249
254
|
responseText: responseText.text,
|
|
250
|
-
agentName:
|
|
255
|
+
agentName: agentDisplayName,
|
|
251
256
|
isError: responseText.isError,
|
|
252
257
|
followUpParams: {
|
|
253
258
|
conversationId,
|
|
254
259
|
agentId,
|
|
260
|
+
agentName: agentDisplayName,
|
|
255
261
|
projectId,
|
|
256
262
|
tenantId,
|
|
257
263
|
teamId,
|
|
@@ -370,15 +376,16 @@ async function callAgentApi(params) {
|
|
|
370
376
|
});
|
|
371
377
|
}
|
|
372
378
|
async function postPrivateResponse(params) {
|
|
373
|
-
const { slackClient, metadata, agentId, projectId, tenantId, conversationId, userMessage, responseText, isError } = params;
|
|
379
|
+
const { slackClient, metadata, agentId, agentDisplayName, projectId, tenantId, conversationId, userMessage, responseText, isError } = params;
|
|
374
380
|
const responseBlocks = buildConversationResponseBlocks({
|
|
375
381
|
userMessage,
|
|
376
382
|
responseText,
|
|
377
|
-
agentName:
|
|
383
|
+
agentName: agentDisplayName,
|
|
378
384
|
isError,
|
|
379
385
|
followUpParams: {
|
|
380
386
|
conversationId,
|
|
381
387
|
agentId,
|
|
388
|
+
agentName: agentDisplayName,
|
|
382
389
|
projectId,
|
|
383
390
|
tenantId,
|
|
384
391
|
teamId: metadata.teamId,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { env } from "../../../env.js";
|
|
2
2
|
import { getLogger } from "../../../logger.js";
|
|
3
|
-
import { buildCitationsBlock, buildDataArtifactBlocks, buildDataComponentBlocks, buildSummaryBreadcrumbBlock, buildToolApprovalBlocks, buildToolApprovalExpiredBlocks, buildToolOutputErrorBlock, createContextBlock } from "../blocks/index.js";
|
|
4
3
|
import { SlackErrorType, classifyError, extractApiErrorMessage, getUserFriendlyErrorMessage } from "./utils.js";
|
|
4
|
+
import { buildCitationsBlock, buildDataArtifactBlocks, buildDataComponentBlocks, buildSummaryBreadcrumbBlock, buildToolApprovalBlocks, buildToolApprovalExpiredBlocks, buildToolOutputErrorBlock, createContextBlock } from "../blocks/index.js";
|
|
5
5
|
import { SLACK_SPAN_KEYS, SLACK_SPAN_NAMES, setSpanWithError, tracer } from "../../tracer.js";
|
|
6
6
|
import { getInProcessFetch, retryWithBackoff } from "@inkeep/agents-core";
|
|
7
7
|
|
|
@@ -8,10 +8,10 @@ import { AgentOption } from "../modals.js";
|
|
|
8
8
|
* Called on every @mention and /inkeep command — caching avoids redundant DB queries.
|
|
9
9
|
*/
|
|
10
10
|
declare function findCachedUserMapping(tenantId: string, slackUserId: string, teamId: string, clientId?: string): Promise<{
|
|
11
|
+
slackUserId: string;
|
|
11
12
|
id: string;
|
|
12
13
|
createdAt: string;
|
|
13
14
|
updatedAt: string;
|
|
14
|
-
slackUserId: string;
|
|
15
15
|
tenantId: string;
|
|
16
16
|
clientId: string;
|
|
17
17
|
slackTeamId: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { clearWorkspaceConnectionCache, computeWorkspaceConnectionId, createConnectSession, deleteWorkspaceInstallation, findWorkspaceConnectionByTeamId, getConnectionAccessToken, getSlackIntegrationId, getSlackNango, getWorkspaceDefaultAgentFromNango, listWorkspaceInstallations, setWorkspaceDefaultAgent, storeWorkspaceInstallation, updateConnectionMetadata } from "./nango.js";
|
|
2
|
+
import { SlackErrorType, checkIfBotThread, classifyError, extractApiErrorMessage, fetchAgentsForProject, fetchProjectsForTenant, findCachedUserMapping, generateSlackConversationId, getChannelAgentConfig, getThreadContext, getUserFriendlyErrorMessage, getWorkspaceDefaultAgent, markdownToMrkdwn, sendResponseUrlMessage } from "./events/utils.js";
|
|
2
3
|
import { getAgentConfigSources, resolveEffectiveAgent } from "./agent-resolution.js";
|
|
3
4
|
import { ToolApprovalButtonValueSchema, buildCitationsBlock, buildConversationResponseBlocks, buildDataArtifactBlocks, buildDataComponentBlocks, buildFollowUpButton, buildSummaryBreadcrumbBlock, buildToolApprovalBlocks, buildToolApprovalDoneBlocks, buildToolApprovalExpiredBlocks, buildToolOutputErrorBlock, createAlreadyLinkedMessage, createContextBlock, createCreateInkeepAccountMessage, createErrorMessage, createJwtLinkMessage, createNotLinkedMessage, createStatusMessage, createUnlinkSuccessMessage, createUpdatedHelpMessage } from "./blocks/index.js";
|
|
4
5
|
import { checkUserIsChannelMember, getSlackChannelInfo, getSlackChannels, getSlackClient, getSlackTeamInfo, getSlackUserInfo, postMessage, postMessageInThread, revokeSlackToken } from "./client.js";
|
|
5
|
-
import { SlackErrorType, checkIfBotThread, classifyError, extractApiErrorMessage, fetchAgentsForProject, fetchProjectsForTenant, findCachedUserMapping, generateSlackConversationId, getChannelAgentConfig, getThreadContext, getUserFriendlyErrorMessage, getWorkspaceDefaultAgent, markdownToMrkdwn, sendResponseUrlMessage } from "./events/utils.js";
|
|
6
6
|
import { buildAgentSelectorModal, buildFollowUpModal, buildMessageShortcutModal } from "./modals.js";
|
|
7
7
|
import { handleAgentPickerCommand, handleCommand, handleHelpCommand, handleLinkCommand, handleQuestionCommand, handleStatusCommand, handleUnlinkCommand } from "./commands/index.js";
|
|
8
8
|
import { streamAgentResponse } from "./events/streaming.js";
|
|
@@ -34,7 +34,8 @@ function buildAgentSelectorModal(params) {
|
|
|
34
34
|
},
|
|
35
35
|
value: JSON.stringify({
|
|
36
36
|
agentId: agent.id,
|
|
37
|
-
projectId: agent.projectId
|
|
37
|
+
projectId: agent.projectId,
|
|
38
|
+
agentName: agent.name
|
|
38
39
|
})
|
|
39
40
|
})) : [{
|
|
40
41
|
text: {
|
|
@@ -239,7 +240,8 @@ function buildMessageShortcutModal(params) {
|
|
|
239
240
|
},
|
|
240
241
|
value: JSON.stringify({
|
|
241
242
|
agentId: agent.id,
|
|
242
|
-
projectId: agent.projectId
|
|
243
|
+
projectId: agent.projectId,
|
|
244
|
+
agentName: agent.name
|
|
243
245
|
})
|
|
244
246
|
})) : [{
|
|
245
247
|
text: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-work-apps",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260224032024",
|
|
4
4
|
"description": "First party integrations for Inkeep Agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"jose": "^6.1.0",
|
|
34
34
|
"minimatch": "^10.1.1",
|
|
35
35
|
"slack-block-builder": "^2.8.0",
|
|
36
|
-
"@inkeep/agents-core": "0.0.0-dev-
|
|
36
|
+
"@inkeep/agents-core": "0.0.0-dev-20260224032024"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@hono/zod-openapi": "^1.1.5",
|