@sentry/junior 0.9.3 → 0.10.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 +0 -7
- package/dist/{chunk-LWHXDHIN.js → chunk-7RM2Y52T.js} +397 -686
- package/dist/{chunk-HRA2FXYH.js → chunk-BJ4EBVQK.js} +17 -34
- package/dist/{chunk-ZBWWHP6Q.js → chunk-MY7JNCS2.js} +862 -5
- package/dist/{chunk-VM3CPAZF.js → chunk-WM66QDLA.js} +4 -6
- package/dist/cli/check.js +2 -3
- package/dist/cli/env.d.ts +7 -0
- package/dist/cli/env.js +54 -0
- package/dist/cli/init.js +21 -12
- package/dist/cli/snapshot-warmup.js +2 -3
- package/dist/handlers/router.d.ts +2 -4
- package/dist/handlers/router.js +28 -52
- package/dist/handlers/webhooks.d.ts +8 -1
- package/dist/handlers/webhooks.js +9 -4
- package/dist/next-config.js +0 -1
- package/package.json +16 -18
- package/dist/chunk-PEJ6SSW4.js +0 -104
- package/dist/chunk-XHISVOAJ.js +0 -678
- package/dist/chunk-ZW4OVKF5.js +0 -864
- package/dist/handlers/queue-callback.d.ts +0 -10
- package/dist/handlers/queue-callback.js +0 -12
- package/dist/production-BGZNVORK.js +0 -15
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getPluginCapabilityProviders,
|
|
3
3
|
getPluginForSkillPath,
|
|
4
|
-
getPluginSkillRoots
|
|
5
|
-
|
|
4
|
+
getPluginSkillRoots,
|
|
5
|
+
logInfo,
|
|
6
|
+
logWarn
|
|
7
|
+
} from "./chunk-MY7JNCS2.js";
|
|
6
8
|
import {
|
|
7
9
|
skillRoots
|
|
8
10
|
} from "./chunk-KCLEEKYX.js";
|
|
9
|
-
import {
|
|
10
|
-
logInfo,
|
|
11
|
-
logWarn
|
|
12
|
-
} from "./chunk-ZW4OVKF5.js";
|
|
13
11
|
|
|
14
12
|
// src/chat/skills.ts
|
|
15
13
|
import fs from "fs/promises";
|
package/dist/cli/check.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseSkillFile
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-WM66QDLA.js";
|
|
4
4
|
import {
|
|
5
5
|
parsePluginManifest
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-MY7JNCS2.js";
|
|
7
7
|
import "../chunk-KCLEEKYX.js";
|
|
8
|
-
import "../chunk-ZW4OVKF5.js";
|
|
9
8
|
|
|
10
9
|
// src/cli/check.ts
|
|
11
10
|
import fs from "fs/promises";
|
package/dist/cli/env.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// src/cli/env.ts
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
function envFileNames(nodeEnv) {
|
|
5
|
+
return [
|
|
6
|
+
`.env.${nodeEnv}.local`,
|
|
7
|
+
...nodeEnv === "test" ? [] : [".env.local"],
|
|
8
|
+
`.env.${nodeEnv}`,
|
|
9
|
+
".env"
|
|
10
|
+
];
|
|
11
|
+
}
|
|
12
|
+
function hasEnvRootMarker(dir) {
|
|
13
|
+
return fs.existsSync(path.join(dir, "package.json")) || fs.existsSync(path.join(dir, "pnpm-workspace.yaml"));
|
|
14
|
+
}
|
|
15
|
+
function resolveCliEnvRoots(cwd) {
|
|
16
|
+
const roots = [];
|
|
17
|
+
const seen = /* @__PURE__ */ new Set();
|
|
18
|
+
const addRoot = (candidate) => {
|
|
19
|
+
const resolved = path.resolve(candidate);
|
|
20
|
+
if (seen.has(resolved)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
seen.add(resolved);
|
|
24
|
+
roots.push(resolved);
|
|
25
|
+
};
|
|
26
|
+
let current = path.resolve(cwd);
|
|
27
|
+
addRoot(current);
|
|
28
|
+
while (true) {
|
|
29
|
+
if (hasEnvRootMarker(current)) {
|
|
30
|
+
addRoot(current);
|
|
31
|
+
}
|
|
32
|
+
const parent = path.dirname(current);
|
|
33
|
+
if (parent === current) {
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
current = parent;
|
|
37
|
+
}
|
|
38
|
+
return roots;
|
|
39
|
+
}
|
|
40
|
+
function loadCliEnvFiles(cwd = process.cwd()) {
|
|
41
|
+
const nodeEnv = process.env.NODE_ENV ?? "development";
|
|
42
|
+
for (const root of resolveCliEnvRoots(cwd)) {
|
|
43
|
+
for (const envFile of envFileNames(nodeEnv)) {
|
|
44
|
+
const absolutePath = path.join(root, envFile);
|
|
45
|
+
if (!fs.existsSync(absolutePath)) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
process.loadEnvFile(absolutePath);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
loadCliEnvFiles
|
|
54
|
+
};
|
package/dist/cli/init.js
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import path from "path";
|
|
4
4
|
function writeRouteModule(filePath, exportLine) {
|
|
5
|
-
fs.writeFileSync(
|
|
5
|
+
fs.writeFileSync(
|
|
6
|
+
filePath,
|
|
7
|
+
`${exportLine}
|
|
6
8
|
export const runtime = "nodejs";
|
|
7
|
-
`
|
|
9
|
+
`
|
|
10
|
+
);
|
|
8
11
|
}
|
|
9
12
|
function writeWrapperFiles(targetDir) {
|
|
10
13
|
const routeDir = path.join(targetDir, "app", "api", "[...path]");
|
|
11
14
|
fs.mkdirSync(routeDir, { recursive: true });
|
|
12
|
-
writeRouteModule(path.join(routeDir, "route.js"), 'export { GET, POST } from "@sentry/junior/handler";');
|
|
13
|
-
const queueRouteDir = path.join(targetDir, "app", "api", "queue", "callback");
|
|
14
|
-
fs.mkdirSync(queueRouteDir, { recursive: true });
|
|
15
15
|
writeRouteModule(
|
|
16
|
-
path.join(
|
|
17
|
-
'export { POST } from "@sentry/junior/
|
|
16
|
+
path.join(routeDir, "route.js"),
|
|
17
|
+
'export { GET, POST } from "@sentry/junior/handler";'
|
|
18
18
|
);
|
|
19
19
|
fs.mkdirSync(path.join(targetDir, "app"), { recursive: true });
|
|
20
20
|
fs.writeFileSync(
|
|
@@ -66,14 +66,20 @@ async function runInit(dir, log = console.log) {
|
|
|
66
66
|
"@sentry/nextjs": "^10.0.0"
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
fs.writeFileSync(
|
|
70
|
-
|
|
69
|
+
fs.writeFileSync(
|
|
70
|
+
path.join(target, "package.json"),
|
|
71
|
+
`${JSON.stringify(pkg, null, 2)}
|
|
72
|
+
`
|
|
73
|
+
);
|
|
71
74
|
const dataDir = path.join(target, "app", "data");
|
|
72
75
|
fs.mkdirSync(dataDir, { recursive: true });
|
|
73
|
-
fs.writeFileSync(
|
|
76
|
+
fs.writeFileSync(
|
|
77
|
+
path.join(dataDir, "SOUL.md"),
|
|
78
|
+
`# ${name}
|
|
74
79
|
|
|
75
80
|
You are ${name}, a helpful assistant.
|
|
76
|
-
`
|
|
81
|
+
`
|
|
82
|
+
);
|
|
77
83
|
fs.writeFileSync(
|
|
78
84
|
path.join(dataDir, "ABOUT.md"),
|
|
79
85
|
`# About ${name}
|
|
@@ -87,7 +93,10 @@ Describe what ${name} helps users do.
|
|
|
87
93
|
const pluginsDir = path.join(target, "app", "plugins");
|
|
88
94
|
fs.mkdirSync(pluginsDir, { recursive: true });
|
|
89
95
|
fs.writeFileSync(path.join(pluginsDir, ".gitkeep"), "");
|
|
90
|
-
fs.writeFileSync(
|
|
96
|
+
fs.writeFileSync(
|
|
97
|
+
path.join(target, ".gitignore"),
|
|
98
|
+
["node_modules/", ".next/", ".env", ".env.local", ""].join("\n")
|
|
99
|
+
);
|
|
91
100
|
fs.writeFileSync(
|
|
92
101
|
path.join(target, ".env.example"),
|
|
93
102
|
[
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
disconnectStateAdapter,
|
|
3
3
|
resolveRuntimeDependencySnapshot
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-BJ4EBVQK.js";
|
|
5
5
|
import {
|
|
6
6
|
getPluginProviders,
|
|
7
7
|
getPluginRuntimeDependencies,
|
|
8
8
|
getPluginRuntimePostinstall
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-MY7JNCS2.js";
|
|
10
10
|
import "../chunk-KCLEEKYX.js";
|
|
11
|
-
import "../chunk-ZW4OVKF5.js";
|
|
12
11
|
|
|
13
12
|
// src/cli/snapshot-warmup.ts
|
|
14
13
|
var DEFAULT_RUNTIME = "node22";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { maxDuration } from './webhooks.js';
|
|
2
|
+
|
|
1
3
|
type RouteContext = {
|
|
2
4
|
params: Promise<unknown>;
|
|
3
5
|
};
|
|
@@ -15,10 +17,6 @@ declare function GET(request: Request, context: RouteContext): Promise<Response>
|
|
|
15
17
|
*
|
|
16
18
|
* Supported routes:
|
|
17
19
|
* - `api/webhooks/:platform`
|
|
18
|
-
* - `api/queue/callback`
|
|
19
|
-
*
|
|
20
|
-
* `queue/callback` is routed here for local/dev parity, but production queue triggers
|
|
21
|
-
* should still target the dedicated `app/api/queue/callback/route.ts` endpoint.
|
|
22
20
|
*/
|
|
23
21
|
declare function POST(request: Request, context: RouteContext): Promise<Response>;
|
|
24
22
|
|
package/dist/handlers/router.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
POST
|
|
3
|
-
} from "../chunk-PEJ6SSW4.js";
|
|
4
|
-
import {
|
|
5
|
-
POST
|
|
6
|
-
} from "../chunk-XHISVOAJ.js";
|
|
7
|
-
import {
|
|
2
|
+
POST,
|
|
8
3
|
buildConversationContext,
|
|
9
4
|
buildSlackOutputMessage,
|
|
10
5
|
coerceThreadArtifactsState,
|
|
@@ -16,14 +11,16 @@ import {
|
|
|
16
11
|
formatProviderLabel,
|
|
17
12
|
generateAssistantReply,
|
|
18
13
|
generateConversationId,
|
|
14
|
+
getPersistedThreadState,
|
|
19
15
|
getSlackClient,
|
|
20
16
|
isRetryableTurnError,
|
|
21
17
|
markConversationMessage,
|
|
22
18
|
markTurnCompleted,
|
|
23
19
|
markTurnFailed,
|
|
20
|
+
maxDuration,
|
|
24
21
|
mergeArtifactsState,
|
|
25
22
|
normalizeConversationText,
|
|
26
|
-
|
|
23
|
+
persistThreadStateById,
|
|
27
24
|
publishAppHomeView,
|
|
28
25
|
resolveBaseUrl,
|
|
29
26
|
resolveReplyDelivery,
|
|
@@ -31,31 +28,28 @@ import {
|
|
|
31
28
|
updateConversationStats,
|
|
32
29
|
uploadFilesToThread,
|
|
33
30
|
upsertConversationMessage
|
|
34
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-7RM2Y52T.js";
|
|
35
32
|
import {
|
|
36
33
|
GET
|
|
37
34
|
} from "../chunk-4RBEYCOG.js";
|
|
38
|
-
import "../chunk-
|
|
35
|
+
import "../chunk-WM66QDLA.js";
|
|
39
36
|
import {
|
|
40
37
|
botConfig,
|
|
41
38
|
getStateAdapter
|
|
42
|
-
} from "../chunk-
|
|
39
|
+
} from "../chunk-BJ4EBVQK.js";
|
|
43
40
|
import {
|
|
44
41
|
buildOAuthTokenRequest,
|
|
45
42
|
getPluginOAuthConfig,
|
|
46
|
-
parseOAuthTokenResponse
|
|
47
|
-
} from "../chunk-ZBWWHP6Q.js";
|
|
48
|
-
import "../chunk-KCLEEKYX.js";
|
|
49
|
-
import {
|
|
50
43
|
logException,
|
|
51
44
|
logInfo,
|
|
52
|
-
logWarn
|
|
53
|
-
|
|
45
|
+
logWarn,
|
|
46
|
+
parseOAuthTokenResponse
|
|
47
|
+
} from "../chunk-MY7JNCS2.js";
|
|
48
|
+
import "../chunk-KCLEEKYX.js";
|
|
54
49
|
|
|
55
50
|
// src/handlers/mcp-oauth-callback.ts
|
|
56
51
|
import { Buffer } from "buffer";
|
|
57
52
|
import { after } from "next/server";
|
|
58
|
-
import { ThreadImpl } from "chat";
|
|
59
53
|
|
|
60
54
|
// src/handlers/oauth-resume.ts
|
|
61
55
|
function resolveReplyTimeoutMs(explicitTimeoutMs) {
|
|
@@ -330,15 +324,6 @@ async function deliverReplyToThread(channelId, threadTs, reply) {
|
|
|
330
324
|
} catch {
|
|
331
325
|
}
|
|
332
326
|
}
|
|
333
|
-
function createSlackThread(channelId, threadTs) {
|
|
334
|
-
return ThreadImpl.fromJSON({
|
|
335
|
-
_type: "chat:Thread",
|
|
336
|
-
adapterName: "slack",
|
|
337
|
-
channelId,
|
|
338
|
-
id: `slack:${channelId}:${threadTs}`,
|
|
339
|
-
isDM: channelId.startsWith("D")
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
327
|
function buildDeterministicTurnId(messageId) {
|
|
343
328
|
const sanitized = messageId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
344
329
|
return `turn_${sanitized}`;
|
|
@@ -356,16 +341,18 @@ function getUserMessageIdForTurn(conversation, sessionId) {
|
|
|
356
341
|
return void 0;
|
|
357
342
|
}
|
|
358
343
|
async function buildResumeConversationContext(channelId, threadTs, sessionId) {
|
|
359
|
-
const
|
|
360
|
-
const conversation = coerceThreadConversationState(
|
|
344
|
+
const threadId = `slack:${channelId}:${threadTs}`;
|
|
345
|
+
const conversation = coerceThreadConversationState(
|
|
346
|
+
await getPersistedThreadState(threadId)
|
|
347
|
+
);
|
|
361
348
|
const userMessageId = getUserMessageIdForTurn(conversation, sessionId);
|
|
362
349
|
return buildConversationContext(conversation, {
|
|
363
350
|
excludeMessageId: userMessageId
|
|
364
351
|
});
|
|
365
352
|
}
|
|
366
353
|
async function persistCompletedReplyState(channelId, threadTs, sessionId, reply) {
|
|
367
|
-
const
|
|
368
|
-
const currentState = await
|
|
354
|
+
const threadId = `slack:${channelId}:${threadTs}`;
|
|
355
|
+
const currentState = await getPersistedThreadState(threadId);
|
|
369
356
|
const conversation = coerceThreadConversationState(currentState);
|
|
370
357
|
const artifacts = coerceThreadArtifactsState(currentState);
|
|
371
358
|
const nextArtifacts = reply.artifactStatePatch ? mergeArtifactsState(artifacts, reply.artifactStatePatch) : void 0;
|
|
@@ -392,7 +379,7 @@ async function persistCompletedReplyState(channelId, threadTs, sessionId, reply)
|
|
|
392
379
|
nowMs: Date.now(),
|
|
393
380
|
updateConversationStats
|
|
394
381
|
});
|
|
395
|
-
await
|
|
382
|
+
await persistThreadStateById(threadId, {
|
|
396
383
|
artifacts: nextArtifacts,
|
|
397
384
|
conversation,
|
|
398
385
|
sandboxId: reply.sandboxId,
|
|
@@ -400,8 +387,8 @@ async function persistCompletedReplyState(channelId, threadTs, sessionId, reply)
|
|
|
400
387
|
});
|
|
401
388
|
}
|
|
402
389
|
async function persistFailedReplyState(channelId, threadTs, sessionId) {
|
|
403
|
-
const
|
|
404
|
-
const currentState = await
|
|
390
|
+
const threadId = `slack:${channelId}:${threadTs}`;
|
|
391
|
+
const currentState = await getPersistedThreadState(threadId);
|
|
405
392
|
const conversation = coerceThreadConversationState(currentState);
|
|
406
393
|
markTurnFailed({
|
|
407
394
|
conversation,
|
|
@@ -410,7 +397,7 @@ async function persistFailedReplyState(channelId, threadTs, sessionId) {
|
|
|
410
397
|
markConversationMessage,
|
|
411
398
|
updateConversationStats
|
|
412
399
|
});
|
|
413
|
-
await
|
|
400
|
+
await persistThreadStateById(threadId, {
|
|
414
401
|
conversation
|
|
415
402
|
});
|
|
416
403
|
}
|
|
@@ -551,7 +538,6 @@ async function GET2(request, context) {
|
|
|
551
538
|
|
|
552
539
|
// src/handlers/oauth-callback.ts
|
|
553
540
|
import { after as after2 } from "next/server";
|
|
554
|
-
import { ThreadImpl as ThreadImpl2 } from "chat";
|
|
555
541
|
function htmlErrorResponse(title, message, status) {
|
|
556
542
|
const safeTitle = escapeXml(title);
|
|
557
543
|
const safeMessage = escapeXml(message);
|
|
@@ -571,18 +557,10 @@ function htmlErrorResponse(title, message, status) {
|
|
|
571
557
|
headers: { "Content-Type": "text/html; charset=utf-8" }
|
|
572
558
|
});
|
|
573
559
|
}
|
|
574
|
-
function createSlackThread2(channelId, threadTs) {
|
|
575
|
-
return ThreadImpl2.fromJSON({
|
|
576
|
-
_type: "chat:Thread",
|
|
577
|
-
adapterName: "slack",
|
|
578
|
-
channelId,
|
|
579
|
-
id: `slack:${channelId}:${threadTs}`,
|
|
580
|
-
isDM: channelId.startsWith("D")
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
560
|
async function buildResumeConversationContext2(channelId, threadTs) {
|
|
584
|
-
const
|
|
585
|
-
|
|
561
|
+
const conversation = coerceThreadConversationState(
|
|
562
|
+
await getPersistedThreadState(`slack:${channelId}:${threadTs}`)
|
|
563
|
+
);
|
|
586
564
|
const latestUserMessageId = [...conversation.messages].reverse().find((message) => message.role === "user")?.id;
|
|
587
565
|
return buildConversationContext(conversation, {
|
|
588
566
|
excludeMessageId: latestUserMessageId
|
|
@@ -831,15 +809,12 @@ async function GET4(request, context) {
|
|
|
831
809
|
}
|
|
832
810
|
return new Response("Not Found", { status: 404 });
|
|
833
811
|
}
|
|
834
|
-
async function
|
|
812
|
+
async function POST2(request, context) {
|
|
835
813
|
const route = normalizeRoutePath(getRoutePathParts(await context.params));
|
|
836
|
-
if (route === "queue/callback") {
|
|
837
|
-
return POST(request);
|
|
838
|
-
}
|
|
839
814
|
const webhookMatch = route.match(/^webhooks\/([^/]+)$/);
|
|
840
815
|
if (webhookMatch) {
|
|
841
816
|
const platform = webhookMatch[1];
|
|
842
|
-
return
|
|
817
|
+
return POST(request, {
|
|
843
818
|
params: Promise.resolve({ platform })
|
|
844
819
|
});
|
|
845
820
|
}
|
|
@@ -847,5 +822,6 @@ async function POST3(request, context) {
|
|
|
847
822
|
}
|
|
848
823
|
export {
|
|
849
824
|
GET4 as GET,
|
|
850
|
-
|
|
825
|
+
POST2 as POST,
|
|
826
|
+
maxDuration
|
|
851
827
|
};
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vercel function timeout in seconds.
|
|
3
|
+
*
|
|
4
|
+
* Agent turns run inside `after()` which shares the function's timeout budget.
|
|
5
|
+
* This must be at least as large as the configured turn timeout plus buffer.
|
|
6
|
+
*/
|
|
7
|
+
declare const maxDuration: number;
|
|
1
8
|
/**
|
|
2
9
|
* Webhook route contract for `@sentry/junior`.
|
|
3
10
|
*
|
|
@@ -18,4 +25,4 @@ type WebhookRouteContext = {
|
|
|
18
25
|
*/
|
|
19
26
|
declare function POST(request: Request, context: WebhookRouteContext): Promise<Response>;
|
|
20
27
|
|
|
21
|
-
export { POST };
|
|
28
|
+
export { POST, maxDuration };
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
POST
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
POST,
|
|
3
|
+
maxDuration
|
|
4
|
+
} from "../chunk-7RM2Y52T.js";
|
|
5
|
+
import "../chunk-WM66QDLA.js";
|
|
6
|
+
import "../chunk-BJ4EBVQK.js";
|
|
7
|
+
import "../chunk-MY7JNCS2.js";
|
|
8
|
+
import "../chunk-KCLEEKYX.js";
|
|
5
9
|
export {
|
|
6
|
-
POST
|
|
10
|
+
POST,
|
|
11
|
+
maxDuration
|
|
7
12
|
};
|
package/dist/next-config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"exports": {
|
|
13
13
|
"./handler": "./dist/handlers/router.js",
|
|
14
14
|
"./handlers/webhooks": "./dist/handlers/webhooks.js",
|
|
15
|
-
"./handlers/queue-callback": "./dist/handlers/queue-callback.js",
|
|
16
15
|
"./handlers/health": "./dist/handlers/health.js",
|
|
17
16
|
"./config": "./dist/next-config.js",
|
|
18
17
|
"./instrumentation": "./dist/instrumentation.js",
|
|
@@ -23,23 +22,22 @@
|
|
|
23
22
|
"bin"
|
|
24
23
|
],
|
|
25
24
|
"dependencies": {
|
|
26
|
-
"@ai-sdk/gateway": "^3.0.
|
|
27
|
-
"@chat-adapter/slack": "4.
|
|
28
|
-
"@chat-adapter/state-memory": "4.
|
|
29
|
-
"@chat-adapter/state-redis": "4.
|
|
25
|
+
"@ai-sdk/gateway": "^3.0.80",
|
|
26
|
+
"@chat-adapter/slack": "4.22.0",
|
|
27
|
+
"@chat-adapter/state-memory": "4.22.0",
|
|
28
|
+
"@chat-adapter/state-redis": "4.22.0",
|
|
30
29
|
"@mariozechner/pi-agent-core": "^0.59.0",
|
|
31
30
|
"@mariozechner/pi-ai": "^0.59.0",
|
|
32
31
|
"@modelcontextprotocol/sdk": "1.27.1",
|
|
33
32
|
"@sinclair/typebox": "^0.34.48",
|
|
34
33
|
"@slack/web-api": "^7.15.0",
|
|
35
|
-
"@vercel/
|
|
36
|
-
"
|
|
37
|
-
"ai": "^6.0.116",
|
|
34
|
+
"@vercel/sandbox": "^1.9.0",
|
|
35
|
+
"ai": "^6.0.138",
|
|
38
36
|
"bash-tool": "^1.3.15",
|
|
39
|
-
"chat": "4.
|
|
40
|
-
"just-bash": "^2.
|
|
37
|
+
"chat": "4.22.0",
|
|
38
|
+
"just-bash": "^2.14.0",
|
|
41
39
|
"node-html-markdown": "^2.0.0",
|
|
42
|
-
"yaml": "^2.8.
|
|
40
|
+
"yaml": "^2.8.3",
|
|
43
41
|
"zod": "^4.3.6"
|
|
44
42
|
},
|
|
45
43
|
"peerDependencies": {
|
|
@@ -49,18 +47,18 @@
|
|
|
49
47
|
"react-dom": ">=19.0.0"
|
|
50
48
|
},
|
|
51
49
|
"devDependencies": {
|
|
52
|
-
"@sentry/nextjs": "^10.
|
|
53
|
-
"@types/node": "^25.
|
|
50
|
+
"@sentry/nextjs": "^10.46.0",
|
|
51
|
+
"@types/node": "^25.5.0",
|
|
54
52
|
"@types/react": "^19.2.14",
|
|
55
53
|
"@types/react-dom": "^19.2.3",
|
|
56
|
-
"msw": "^2.12.
|
|
57
|
-
"next": "^16.1
|
|
54
|
+
"msw": "^2.12.14",
|
|
55
|
+
"next": "^16.2.1",
|
|
58
56
|
"react": "^19.2.4",
|
|
59
57
|
"react-dom": "^19.2.4",
|
|
60
58
|
"tsup": "^8.5.1",
|
|
61
59
|
"typescript": "^5.9.3",
|
|
62
|
-
"vercel": "^50.
|
|
63
|
-
"vitest": "^4.1.
|
|
60
|
+
"vercel": "^50.37.0",
|
|
61
|
+
"vitest": "^4.1.1"
|
|
64
62
|
},
|
|
65
63
|
"scripts": {
|
|
66
64
|
"build": "tsup",
|
package/dist/chunk-PEJ6SSW4.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createRequestContext,
|
|
3
|
-
logException,
|
|
4
|
-
logWarn,
|
|
5
|
-
setSpanAttributes,
|
|
6
|
-
setSpanStatus,
|
|
7
|
-
withContext,
|
|
8
|
-
withSpan
|
|
9
|
-
} from "./chunk-ZW4OVKF5.js";
|
|
10
|
-
|
|
11
|
-
// src/handlers/webhooks.ts
|
|
12
|
-
import { after } from "next/server";
|
|
13
|
-
import * as Sentry from "@sentry/nextjs";
|
|
14
|
-
async function loadBot() {
|
|
15
|
-
const { bot } = await import("./production-BGZNVORK.js");
|
|
16
|
-
return bot;
|
|
17
|
-
}
|
|
18
|
-
async function POST(request, context) {
|
|
19
|
-
const bot = await loadBot();
|
|
20
|
-
const { platform } = await context.params;
|
|
21
|
-
const handler = bot.webhooks[platform];
|
|
22
|
-
const requestContext = createRequestContext(request, { platform });
|
|
23
|
-
const requestUrl = new URL(request.url);
|
|
24
|
-
return withContext(requestContext, async () => {
|
|
25
|
-
if (!handler) {
|
|
26
|
-
const error = new Error(`Unknown platform: ${platform}`);
|
|
27
|
-
logException(
|
|
28
|
-
error,
|
|
29
|
-
"webhook_platform_unknown",
|
|
30
|
-
{},
|
|
31
|
-
{
|
|
32
|
-
"http.response.status_code": 404
|
|
33
|
-
},
|
|
34
|
-
`Unknown platform: ${platform}`
|
|
35
|
-
);
|
|
36
|
-
return new Response(`Unknown platform: ${platform}`, { status: 404 });
|
|
37
|
-
}
|
|
38
|
-
try {
|
|
39
|
-
return await withSpan(
|
|
40
|
-
"http.server.request",
|
|
41
|
-
"http.server",
|
|
42
|
-
requestContext,
|
|
43
|
-
async () => {
|
|
44
|
-
try {
|
|
45
|
-
const activeSpan = Sentry.getActiveSpan();
|
|
46
|
-
const response = await handler(request, {
|
|
47
|
-
waitUntil: (task) => after(() => {
|
|
48
|
-
const runTask = () => {
|
|
49
|
-
const taskOrFactory = task;
|
|
50
|
-
return typeof taskOrFactory === "function" ? taskOrFactory() : taskOrFactory;
|
|
51
|
-
};
|
|
52
|
-
if (activeSpan) {
|
|
53
|
-
return Sentry.withActiveSpan(activeSpan, runTask);
|
|
54
|
-
}
|
|
55
|
-
return runTask();
|
|
56
|
-
})
|
|
57
|
-
});
|
|
58
|
-
if (response.status >= 400) {
|
|
59
|
-
let responseBodySnippet;
|
|
60
|
-
try {
|
|
61
|
-
responseBodySnippet = (await response.clone().text()).slice(
|
|
62
|
-
0,
|
|
63
|
-
300
|
|
64
|
-
);
|
|
65
|
-
} catch {
|
|
66
|
-
responseBodySnippet = void 0;
|
|
67
|
-
}
|
|
68
|
-
logWarn(
|
|
69
|
-
"webhook_non_success_response",
|
|
70
|
-
{},
|
|
71
|
-
{
|
|
72
|
-
"http.response.status_code": response.status,
|
|
73
|
-
"http.request.header.x_slack_signature": request.headers.get("x-slack-signature") ?? void 0,
|
|
74
|
-
"http.request.header.x_slack_request_timestamp": request.headers.get("x-slack-request-timestamp") ?? void 0,
|
|
75
|
-
...responseBodySnippet ? { "app.webhook.response_body": responseBodySnippet } : {}
|
|
76
|
-
},
|
|
77
|
-
`Webhook ${platform} returned ${response.status}`
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
setSpanAttributes({
|
|
81
|
-
"http.response.status_code": response.status
|
|
82
|
-
});
|
|
83
|
-
setSpanStatus(response.status >= 500 ? "error" : "ok");
|
|
84
|
-
return response;
|
|
85
|
-
} catch (error) {
|
|
86
|
-
setSpanStatus("error");
|
|
87
|
-
throw error;
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
"http.request.method": request.method,
|
|
92
|
-
"url.path": requestUrl.pathname
|
|
93
|
-
}
|
|
94
|
-
);
|
|
95
|
-
} catch (error) {
|
|
96
|
-
logException(error, "webhook_handler_failed");
|
|
97
|
-
throw error;
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export {
|
|
103
|
-
POST
|
|
104
|
-
};
|