@inkeep/agents-work-apps 0.0.0-dev-20260224031202 → 0.0.0-dev-20260224034342

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.
@@ -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 hono_types5 from "hono/types";
7
+ import * as hono_types4 from "hono/types";
8
8
 
9
9
  //#region src/github/index.d.ts
10
- declare function createGithubRoutes(): Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
11
- declare const githubRoutes: Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
10
+ declare function createGithubRoutes(): Hono<hono_types4.BlankEnv, hono_types4.BlankSchema, "/">;
11
+ declare const githubRoutes: Hono<hono_types4.BlankEnv, hono_types4.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,11 +1,11 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types9 from "hono/types";
2
+ import * as hono_types3 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
- }, hono_types9.BlankSchema, "/">;
9
+ }, hono_types3.BlankSchema, "/">;
10
10
  //#endregion
11
11
  export { app as default };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types1 from "hono/types";
2
+ import * as hono_types8 from "hono/types";
3
3
 
4
4
  //#region src/github/routes/setup.d.ts
5
- declare const app: Hono<hono_types1.BlankEnv, hono_types1.BlankSchema, "/">;
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 hono_types0 from "hono/types";
2
+ import * as hono_types1 from "hono/types";
3
3
 
4
4
  //#region src/github/routes/tokenExchange.d.ts
5
- declare const app: Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
5
+ declare const app: Hono<hono_types1.BlankEnv, hono_types1.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,5 +1,5 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types3 from "hono/types";
2
+ import * as hono_types0 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<hono_types3.BlankEnv, hono_types3.BlankSchema, "/">;
10
+ declare const app: Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
11
11
  //#endregion
12
12
  export { WebhookVerificationResult, app as default, verifyWebhookSignature };
@@ -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";
@@ -35,6 +35,15 @@ async function dispatchSlackEvent(eventType, payload, options, span) {
35
35
  }, "Ignoring bot message");
36
36
  return { outcome };
37
37
  }
38
+ if (event?.edited) {
39
+ outcome = "ignored_edited_message";
40
+ span.setAttribute(SLACK_SPAN_KEYS.OUTCOME, outcome);
41
+ logger.info({
42
+ teamId,
43
+ innerEventType
44
+ }, "Ignoring edited message");
45
+ return { outcome };
46
+ }
38
47
  if (event?.type === "app_mention" && event.channel && event.user && teamId) {
39
48
  outcome = "handled";
40
49
  span.setAttribute(SLACK_SPAN_KEYS.OUTCOME, outcome);
@@ -1,8 +1,8 @@
1
- import { env } from "../../env.js";
2
1
  import { getLogger } from "../../logger.js";
3
2
  import runDbClient_default from "../../db/runDbClient.js";
4
3
  import { getWorkspaceDefaultAgentFromNango } from "./nango.js";
5
- import { InternalServices, findWorkAppSlackChannelAgentConfig, generateInternalServiceToken, getInProcessFetch } from "@inkeep/agents-core";
4
+ import { fetchAgentsForProject } from "./events/utils.js";
5
+ import { findWorkAppSlackChannelAgentConfig } from "@inkeep/agents-core";
6
6
 
7
7
  //#region src/slack/services/agent-resolution.ts
8
8
  /**
@@ -19,67 +19,27 @@ async function lookupAgentName(tenantId, projectId, agentId) {
19
19
  const cacheKey = `${tenantId}:${projectId}:${agentId}`;
20
20
  const cached = agentNameCache.get(cacheKey);
21
21
  if (cached && cached.expiresAt > Date.now()) return cached.name || void 0;
22
- try {
23
- const apiUrl = env.INKEEP_AGENTS_API_URL || "http://localhost:3002";
24
- const token = await generateInternalServiceToken({
25
- serviceId: InternalServices.INKEEP_AGENTS_MANAGE_API,
26
- tenantId,
27
- projectId
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
28
  });
29
- const controller = new AbortController();
30
- const timeout = setTimeout(() => controller.abort(), 5e3);
31
- try {
32
- const response = await getInProcessFetch()(`${apiUrl}/manage/tenants/${tenantId}/projects/${projectId}/agents?limit=50`, {
33
- method: "GET",
34
- headers: {
35
- Authorization: `Bearer ${token}`,
36
- "Content-Type": "application/json",
37
- "x-inkeep-project-id": projectId
38
- },
39
- signal: controller.signal
40
- });
41
- if (!response.ok) {
42
- logger.warn({
43
- status: response.status,
44
- tenantId,
45
- projectId,
46
- agentId
47
- }, "Failed to fetch agents for name lookup");
48
- return;
49
- }
50
- const result = await response.json();
51
- for (const agent of result.data) {
52
- const key = `${tenantId}:${projectId}:${agent.id}`;
53
- agentNameCache.set(key, {
54
- name: agent.name || null,
55
- expiresAt: Date.now() + AGENT_NAME_CACHE_TTL_MS
56
- });
57
- }
58
- if (agentNameCache.size > AGENT_NAME_CACHE_MAX_SIZE) {
59
- const now = Date.now();
60
- for (const [key, entry] of agentNameCache) if (entry.expiresAt <= now) agentNameCache.delete(key);
61
- if (agentNameCache.size > AGENT_NAME_CACHE_MAX_SIZE) {
62
- const excess = agentNameCache.size - AGENT_NAME_CACHE_MAX_SIZE;
63
- const keys = agentNameCache.keys();
64
- for (let i = 0; i < excess; i++) {
65
- const { value } = keys.next();
66
- if (value) agentNameCache.delete(value);
67
- }
68
- }
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);
69
39
  }
70
- return result.data.find((a) => a.id === agentId)?.name || void 0;
71
- } finally {
72
- clearTimeout(timeout);
73
40
  }
74
- } catch (error) {
75
- logger.warn({
76
- error,
77
- tenantId,
78
- projectId,
79
- agentId
80
- }, "Failed to look up agent name");
81
- return;
82
41
  }
42
+ return agents.find((a) => a.id === agentId)?.name || void 0;
83
43
  }
84
44
  /**
85
45
  * Resolve the effective agent configuration.
@@ -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
 
@@ -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,9 +8,9 @@ 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
- id: string;
12
11
  createdAt: string;
13
12
  updatedAt: string;
13
+ id: string;
14
14
  tenantId: string;
15
15
  clientId: string;
16
16
  slackUserId: 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";
@@ -40,6 +40,6 @@ declare const SLACK_SPAN_KEYS: {
40
40
  readonly AUTHORIZED: "slack.authorized";
41
41
  readonly AUTH_SOURCE: "slack.auth_source";
42
42
  };
43
- type SlackOutcome = 'handled' | 'ignored_bot_message' | 'ignored_unknown_event' | 'ignored_no_action_match' | 'ignored_slack_retry' | 'url_verification' | 'validation_error' | 'signature_invalid' | 'error';
43
+ type SlackOutcome = 'handled' | 'ignored_bot_message' | 'ignored_edited_message' | 'ignored_unknown_event' | 'ignored_no_action_match' | 'ignored_slack_retry' | 'url_verification' | 'validation_error' | 'signature_invalid' | 'error';
44
44
  //#endregion
45
45
  export { SLACK_SPAN_KEYS, SLACK_SPAN_NAMES, SlackOutcome, setSpanWithError, tracer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-work-apps",
3
- "version": "0.0.0-dev-20260224031202",
3
+ "version": "0.0.0-dev-20260224034342",
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-20260224031202"
36
+ "@inkeep/agents-core": "0.0.0-dev-20260224034342"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@hono/zod-openapi": "^1.1.5",