@inkeep/agents-work-apps 0.48.0 → 0.48.1

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_types6 from "hono/types";
7
+ import * as hono_types0 from "hono/types";
8
8
 
9
9
  //#region src/github/index.d.ts
10
- declare function createGithubRoutes(): Hono<hono_types6.BlankEnv, hono_types6.BlankSchema, "/">;
11
- declare const githubRoutes: Hono<hono_types6.BlankEnv, hono_types6.BlankSchema, "/">;
10
+ declare function createGithubRoutes(): Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
11
+ declare const githubRoutes: Hono<hono_types0.BlankEnv, hono_types0.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 hono1 from "hono";
1
+ import * as hono0 from "hono";
2
2
 
3
3
  //#region src/github/mcp/auth.d.ts
4
- declare const githubMcpAuth: () => hono1.MiddlewareHandler<{
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 hono_types1 from "hono/types";
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
- }, hono_types1.BlankSchema, "/">;
9
+ }, hono_types5.BlankSchema, "/">;
10
10
  //#endregion
11
11
  export { app as default };
@@ -36,8 +36,8 @@ declare const ChangedFileSchema: z.ZodObject<{
36
36
  path: z.ZodString;
37
37
  status: z.ZodEnum<{
38
38
  added: "added";
39
- removed: "removed";
40
39
  modified: "modified";
40
+ removed: "removed";
41
41
  renamed: "renamed";
42
42
  copied: "copied";
43
43
  changed: "changed";
@@ -1,7 +1,7 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types2 from "hono/types";
2
+ import * as hono_types6 from "hono/types";
3
3
 
4
4
  //#region src/github/routes/setup.d.ts
5
- declare const app: Hono<hono_types2.BlankEnv, hono_types2.BlankSchema, "/">;
5
+ declare const app: Hono<hono_types6.BlankEnv, hono_types6.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_types8 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_types8.BlankEnv, hono_types8.BlankSchema, "/">;
6
6
  //#endregion
7
7
  export { app as default };
@@ -1,5 +1,5 @@
1
1
  import { Hono } from "hono";
2
- import * as hono_types4 from "hono/types";
2
+ import * as hono_types3 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_types4.BlankEnv, hono_types4.BlankSchema, "/">;
10
+ declare const app: Hono<hono_types3.BlankEnv, hono_types3.BlankSchema, "/">;
11
11
  //#endregion
12
12
  export { WebhookVerificationResult, app as default, verifyWebhookSignature };
@@ -1,5 +1,5 @@
1
1
  import { getLogger } from "../../logger.js";
2
- import { WebClient, retryPolicies } from "@slack/web-api";
2
+ import { WebClient } from "@slack/web-api";
3
3
 
4
4
  //#region src/slack/services/client.ts
5
5
  /**
@@ -29,7 +29,7 @@ async function paginateSlack({ fetchPage, extractItems, getNextCursor, limit })
29
29
  * @returns Configured Slack WebClient instance
30
30
  */
31
31
  function getSlackClient(token) {
32
- return new WebClient(token, { retryConfig: retryPolicies.fiveRetriesInFiveMinutes });
32
+ return new WebClient(token);
33
33
  }
34
34
  /**
35
35
  * Fetch user profile information from Slack.
@@ -71,6 +71,7 @@ async function handleAppMention(params) {
71
71
  const replyThreadTs = threadTs || messageTs;
72
72
  const isInThread = Boolean(threadTs && threadTs !== messageTs);
73
73
  const hasQuery = Boolean(text && text.trim().length > 0);
74
+ let thinkingMessageTs;
74
75
  try {
75
76
  const [agentConfig, existingLink] = await Promise.all([resolveChannelAgentConfig(teamId, channel, workspaceConnection), findCachedUserMapping(tenantId, slackUserId, teamId)]);
76
77
  if (!agentConfig) {
@@ -167,11 +168,11 @@ _Using: ${agentDisplayName}_`
167
168
  slackTeamId: teamId,
168
169
  slackUserId
169
170
  });
170
- const ackMessage$1 = await slackClient.chat.postMessage({
171
+ thinkingMessageTs = (await slackClient.chat.postMessage({
171
172
  channel,
172
173
  thread_ts: threadTs,
173
174
  text: `_${agentDisplayName} is reading this thread..._`
174
- });
175
+ })).ts || void 0;
175
176
  const conversationId$1 = generateSlackConversationId({
176
177
  teamId,
177
178
  threadTs,
@@ -203,7 +204,7 @@ Respond naturally as if you're joining the conversation to help.`;
203
204
  slackClient,
204
205
  channel,
205
206
  threadTs,
206
- thinkingMessageTs: ackMessage$1.ts || "",
207
+ thinkingMessageTs: thinkingMessageTs || "",
207
208
  slackUserId,
208
209
  teamId,
209
210
  jwtToken: slackUserToken$1,
@@ -227,11 +228,11 @@ Respond naturally as if you're joining the conversation to help.`;
227
228
  slackTeamId: teamId,
228
229
  slackUserId
229
230
  });
230
- const ackMessage = await slackClient.chat.postMessage({
231
+ thinkingMessageTs = (await slackClient.chat.postMessage({
231
232
  channel,
232
233
  thread_ts: replyThreadTs,
233
234
  text: `_${agentDisplayName} is preparing a response..._`
234
- });
235
+ })).ts || void 0;
235
236
  const conversationId = generateSlackConversationId({
236
237
  teamId,
237
238
  threadTs: replyThreadTs,
@@ -249,7 +250,7 @@ Respond naturally as if you're joining the conversation to help.`;
249
250
  slackClient,
250
251
  channel,
251
252
  threadTs: replyThreadTs,
252
- thinkingMessageTs: ackMessage.ts || "",
253
+ thinkingMessageTs: thinkingMessageTs || "",
253
254
  slackUserId,
254
255
  teamId,
255
256
  jwtToken: slackUserToken,
@@ -268,6 +269,12 @@ Respond naturally as if you're joining the conversation to help.`;
268
269
  teamId
269
270
  }, "Failed in app mention handler");
270
271
  if (error instanceof Error) setSpanWithError(span, error);
272
+ if (thinkingMessageTs) try {
273
+ await slackClient.chat.delete({
274
+ channel,
275
+ ts: thinkingMessageTs
276
+ });
277
+ } catch {}
271
278
  const userMessage = getUserFriendlyErrorMessage(classifyError(error));
272
279
  try {
273
280
  await slackClient.chat.postEphemeral({
@@ -78,12 +78,12 @@ async function streamAgentResponse(params) {
78
78
  } catch (fetchError) {
79
79
  clearTimeout(timeoutId);
80
80
  if (fetchError.name === "AbortError") {
81
- const errorType = SlackErrorType.TIMEOUT;
82
- const errorMessage = getUserFriendlyErrorMessage(errorType, agentName);
81
+ const errorType$1 = SlackErrorType.TIMEOUT;
82
+ const errorMessage$1 = getUserFriendlyErrorMessage(errorType$1, agentName);
83
83
  await slackClient.chat.postMessage({
84
84
  channel,
85
85
  thread_ts: threadTs,
86
- text: errorMessage
86
+ text: errorMessage$1
87
87
  });
88
88
  if (thinkingMessageTs) try {
89
89
  await slackClient.chat.delete({
@@ -94,13 +94,30 @@ async function streamAgentResponse(params) {
94
94
  span.end();
95
95
  return {
96
96
  success: false,
97
- errorType,
98
- errorMessage
97
+ errorType: errorType$1,
98
+ errorMessage: errorMessage$1
99
99
  };
100
100
  }
101
+ const errorType = classifyError(fetchError);
102
+ const errorMessage = getUserFriendlyErrorMessage(errorType, agentName);
103
+ await slackClient.chat.postMessage({
104
+ channel,
105
+ thread_ts: threadTs,
106
+ text: errorMessage
107
+ }).catch((e) => logger.warn({ error: e }, "Failed to send fetch error notification"));
108
+ if (thinkingMessageTs) try {
109
+ await slackClient.chat.delete({
110
+ channel,
111
+ ts: thinkingMessageTs
112
+ });
113
+ } catch {}
101
114
  if (fetchError instanceof Error) setSpanWithError(span, fetchError);
102
115
  span.end();
103
- throw fetchError;
116
+ return {
117
+ success: false,
118
+ errorType,
119
+ errorMessage
120
+ };
104
121
  }
105
122
  if (!response.ok) {
106
123
  clearTimeout(timeoutId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-work-apps",
3
- "version": "0.48.0",
3
+ "version": "0.48.1",
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.48.0"
36
+ "@inkeep/agents-core": "0.48.1"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@hono/zod-openapi": "^1.1.5",