sparkecoder 0.1.119 → 0.1.120
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/agent/index.d.ts +3 -3
- package/dist/agent/index.js +2 -0
- package/dist/agent/index.js.map +1 -1
- package/dist/cli.js +91 -10
- package/dist/cli.js.map +1 -1
- package/dist/db/index.d.ts +2 -2
- package/dist/{index-Bcz0aCAR.d.ts → index-DczYH89U.d.ts} +104 -104
- package/dist/index.d.ts +5 -5
- package/dist/index.js +91 -10
- package/dist/index.js.map +1 -1
- package/dist/{schema-BWbWmfDQ.d.ts → schema-DxrKyetI.d.ts} +3 -3
- package/dist/{search-DOzC4ojH.d.ts → search-CVVfuBPZ.d.ts} +4 -4
- package/dist/server/index.js +91 -10
- package/dist/server/index.js.map +1 -1
- package/dist/tools/index.d.ts +3 -3
- package/package.json +1 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/standalone/web/.next/BUILD_ID +1 -1
- package/web/.next/standalone/web/.next/build-manifest.json +2 -2
- package/web/.next/standalone/web/.next/prerender-manifest.json +3 -3
- package/web/.next/standalone/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/standalone/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.html +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.html +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/!KG1haW4p/agents/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/!KG1haW4p/agents.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/!KG1haW4p.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.html +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/installation.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs/installation/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs/installation.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.html +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/skills.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs/skills/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs/skills.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.html +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/tools.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs/tools/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs/tools.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.html +2 -2
- package/web/.next/standalone/web/.next/server/app/docs.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/docs.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.html +1 -1
- package/web/.next/standalone/web/.next/server/app/index.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.html +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/!KG1haW4p/settings/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/!KG1haW4p/settings.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/!KG1haW4p.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/pages/404.html +1 -1
- package/web/.next/standalone/web/.next/server/pages/500.html +2 -2
- package/web/.next/standalone/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/standalone/web/.next/server/server-reference-manifest.json +1 -1
- /package/web/.next/standalone/web/.next/static/{Bt00m8W4k5F79ALhN700F → static/uy1OnyxIm3QeGGgKEmxAj}/_buildManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/{Bt00m8W4k5F79ALhN700F → static/uy1OnyxIm3QeGGgKEmxAj}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/standalone/web/.next/static/{Bt00m8W4k5F79ALhN700F → static/uy1OnyxIm3QeGGgKEmxAj}/_ssgManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/{static/Bt00m8W4k5F79ALhN700F → uy1OnyxIm3QeGGgKEmxAj}/_buildManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/{static/Bt00m8W4k5F79ALhN700F → uy1OnyxIm3QeGGgKEmxAj}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/standalone/web/.next/static/{static/Bt00m8W4k5F79ALhN700F → uy1OnyxIm3QeGGgKEmxAj}/_ssgManifest.js +0 -0
- /package/web/.next/static/{Bt00m8W4k5F79ALhN700F → uy1OnyxIm3QeGGgKEmxAj}/_buildManifest.js +0 -0
- /package/web/.next/static/{Bt00m8W4k5F79ALhN700F → uy1OnyxIm3QeGGgKEmxAj}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{Bt00m8W4k5F79ALhN700F → uy1OnyxIm3QeGGgKEmxAj}/_ssgManifest.js +0 -0
|
@@ -85,7 +85,7 @@ declare const sessions: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
85
85
|
tableName: "sessions";
|
|
86
86
|
dataType: "string";
|
|
87
87
|
columnType: "SQLiteText";
|
|
88
|
-
data: "
|
|
88
|
+
data: "completed" | "error" | "active" | "waiting";
|
|
89
89
|
driverParam: string;
|
|
90
90
|
notNull: true;
|
|
91
91
|
hasDefault: true;
|
|
@@ -391,7 +391,7 @@ declare const toolExecutions: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
391
391
|
tableName: "tool_executions";
|
|
392
392
|
dataType: "string";
|
|
393
393
|
columnType: "SQLiteText";
|
|
394
|
-
data: "
|
|
394
|
+
data: "completed" | "error" | "pending" | "approved" | "rejected";
|
|
395
395
|
driverParam: string;
|
|
396
396
|
notNull: true;
|
|
397
397
|
hasDefault: true;
|
|
@@ -814,7 +814,7 @@ declare const terminals: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
814
814
|
tableName: "terminals";
|
|
815
815
|
dataType: "string";
|
|
816
816
|
columnType: "SQLiteText";
|
|
817
|
-
data: "
|
|
817
|
+
data: "running" | "error" | "stopped";
|
|
818
818
|
driverParam: string;
|
|
819
819
|
notNull: true;
|
|
820
820
|
hasDefault: true;
|
|
@@ -16,11 +16,11 @@ interface BashToolOptions {
|
|
|
16
16
|
declare function createBashTool(options: BashToolOptions): ai.Tool<{
|
|
17
17
|
background: boolean;
|
|
18
18
|
id?: string | undefined;
|
|
19
|
-
command?: string | undefined;
|
|
20
19
|
input?: string | undefined;
|
|
20
|
+
command?: string | undefined;
|
|
21
21
|
kill?: boolean | undefined;
|
|
22
22
|
tail?: number | undefined;
|
|
23
|
-
key?: "
|
|
23
|
+
key?: "Enter" | "Escape" | "Up" | "Down" | "Left" | "Right" | "Tab" | "C-c" | "C-d" | "y" | "n" | undefined;
|
|
24
24
|
}, {
|
|
25
25
|
success: boolean;
|
|
26
26
|
id: string;
|
|
@@ -66,7 +66,7 @@ declare function createBashTool(options: BashToolOptions): ai.Tool<{
|
|
|
66
66
|
id: string;
|
|
67
67
|
output: string;
|
|
68
68
|
exitCode: number;
|
|
69
|
-
status: "
|
|
69
|
+
status: "running" | "completed" | "error" | "stopped";
|
|
70
70
|
message?: undefined;
|
|
71
71
|
error?: undefined;
|
|
72
72
|
} | {
|
|
@@ -218,8 +218,8 @@ interface SearchToolOptions {
|
|
|
218
218
|
* Progress is streamed back to the UI so users can see exploration happening.
|
|
219
219
|
*/
|
|
220
220
|
declare function createSearchTool(options: SearchToolOptions): ai.Tool<{
|
|
221
|
-
context: string;
|
|
222
221
|
query: string;
|
|
222
|
+
context: string;
|
|
223
223
|
}, {
|
|
224
224
|
success: boolean;
|
|
225
225
|
error: string;
|
package/dist/server/index.js
CHANGED
|
@@ -7802,6 +7802,9 @@ function isSlackConfigured() {
|
|
|
7802
7802
|
function getSlackSigningSecret() {
|
|
7803
7803
|
return readSlackConfig()?.signingSecret ?? null;
|
|
7804
7804
|
}
|
|
7805
|
+
function getSlackBotToken() {
|
|
7806
|
+
return readSlackConfig()?.botToken ?? null;
|
|
7807
|
+
}
|
|
7805
7808
|
function getDefaultOrchestratorName() {
|
|
7806
7809
|
return readSlackConfig()?.defaultOrchestratorName ?? null;
|
|
7807
7810
|
}
|
|
@@ -7856,6 +7859,62 @@ function getSlackAllowlistPolicy() {
|
|
|
7856
7859
|
return { allowedUsers: [], allowedChannels: [], allowDmsFromAnyone: true };
|
|
7857
7860
|
}
|
|
7858
7861
|
}
|
|
7862
|
+
async function fetchSlackUserName(userId) {
|
|
7863
|
+
const token = getSlackBotToken();
|
|
7864
|
+
if (!token) return null;
|
|
7865
|
+
try {
|
|
7866
|
+
const res = await fetch(`https://slack.com/api/users.info?user=${encodeURIComponent(userId)}`, {
|
|
7867
|
+
headers: { Authorization: `Bearer ${token}` }
|
|
7868
|
+
});
|
|
7869
|
+
const data = await res.json().catch(() => ({}));
|
|
7870
|
+
if (!data?.ok) {
|
|
7871
|
+
console.warn(`[slack] users.info(${userId}) failed: ${data?.error || `HTTP ${res.status}`}`);
|
|
7872
|
+
return null;
|
|
7873
|
+
}
|
|
7874
|
+
const profile = data.user?.profile || {};
|
|
7875
|
+
const name = profile.display_name_normalized || profile.display_name || profile.real_name_normalized || profile.real_name || data.user?.real_name || data.user?.name || null;
|
|
7876
|
+
return name ? String(name) : null;
|
|
7877
|
+
} catch (err) {
|
|
7878
|
+
console.warn(`[slack] users.info(${userId}) error:`, err?.message || err);
|
|
7879
|
+
return null;
|
|
7880
|
+
}
|
|
7881
|
+
}
|
|
7882
|
+
async function resolveSlackUserName(userId) {
|
|
7883
|
+
if (!userId) return null;
|
|
7884
|
+
const now = Date.now();
|
|
7885
|
+
const hit = userNameCache.get(userId);
|
|
7886
|
+
if (hit && hit.expiresAt > now) return hit.name;
|
|
7887
|
+
const inflight = userInflight.get(userId);
|
|
7888
|
+
if (inflight) return inflight;
|
|
7889
|
+
const p = (async () => {
|
|
7890
|
+
const name = await fetchSlackUserName(userId);
|
|
7891
|
+
userNameCache.set(userId, {
|
|
7892
|
+
name,
|
|
7893
|
+
expiresAt: now + (name ? USER_TTL_MS : USER_FAIL_TTL_MS)
|
|
7894
|
+
});
|
|
7895
|
+
userInflight.delete(userId);
|
|
7896
|
+
return name;
|
|
7897
|
+
})();
|
|
7898
|
+
userInflight.set(userId, p);
|
|
7899
|
+
return p;
|
|
7900
|
+
}
|
|
7901
|
+
async function normalizeSlackMentions(text) {
|
|
7902
|
+
if (!text) return text;
|
|
7903
|
+
const userMentionRe = /<@([UW][A-Z0-9]+)(?:\|([^>]+))?>/g;
|
|
7904
|
+
const userIds = /* @__PURE__ */ new Set();
|
|
7905
|
+
for (const m of text.matchAll(userMentionRe)) {
|
|
7906
|
+
if (!m[2]) userIds.add(m[1]);
|
|
7907
|
+
}
|
|
7908
|
+
if (userIds.size > 0) {
|
|
7909
|
+
await Promise.all([...userIds].map((id) => resolveSlackUserName(id)));
|
|
7910
|
+
}
|
|
7911
|
+
return text.replace(userMentionRe, (_full, id, label) => {
|
|
7912
|
+
if (label) return `${label} <@${id}>`;
|
|
7913
|
+
const cached = userNameCache.get(id);
|
|
7914
|
+
const name = cached?.name;
|
|
7915
|
+
return name ? `${name} <@${id}>` : `<@${id}>`;
|
|
7916
|
+
});
|
|
7917
|
+
}
|
|
7859
7918
|
function getSlackDeniedReplyPolicy() {
|
|
7860
7919
|
try {
|
|
7861
7920
|
const cfg = getConfig();
|
|
@@ -7868,13 +7927,17 @@ function getSlackDeniedReplyPolicy() {
|
|
|
7868
7927
|
return { enabled: true, template: DEFAULT_DENIED_TEMPLATE };
|
|
7869
7928
|
}
|
|
7870
7929
|
}
|
|
7871
|
-
var cachedSelf, selfInflight, DEFAULT_DENIED_TEMPLATE;
|
|
7930
|
+
var cachedSelf, selfInflight, USER_TTL_MS, USER_FAIL_TTL_MS, userNameCache, userInflight, DEFAULT_DENIED_TEMPLATE;
|
|
7872
7931
|
var init_client3 = __esm({
|
|
7873
7932
|
"src/integrations/slack/client.ts"() {
|
|
7874
7933
|
"use strict";
|
|
7875
7934
|
init_config();
|
|
7876
7935
|
cachedSelf = null;
|
|
7877
7936
|
selfInflight = null;
|
|
7937
|
+
USER_TTL_MS = 60 * 60 * 1e3;
|
|
7938
|
+
USER_FAIL_TTL_MS = 5 * 60 * 1e3;
|
|
7939
|
+
userNameCache = /* @__PURE__ */ new Map();
|
|
7940
|
+
userInflight = /* @__PURE__ */ new Map();
|
|
7878
7941
|
DEFAULT_DENIED_TEMPLATE = "Sorry, you don't have permission to use this bot. (Contact the bot owner if you think this is a mistake.)";
|
|
7879
7942
|
}
|
|
7880
7943
|
});
|
|
@@ -7889,9 +7952,6 @@ function markThreadOwned(channel, threadTs) {
|
|
|
7889
7952
|
function isThreadOwned(channel, threadTs) {
|
|
7890
7953
|
return ownedThreads.has(threadKey(channel, threadTs));
|
|
7891
7954
|
}
|
|
7892
|
-
function stripMention(text) {
|
|
7893
|
-
return String(text || "").replace(/<@[^>]+>/g, "").trim();
|
|
7894
|
-
}
|
|
7895
7955
|
function isSelfAuthored(event, self) {
|
|
7896
7956
|
if (!self) return true;
|
|
7897
7957
|
if (self.botId && event.bot_id && event.bot_id === self.botId) return true;
|
|
@@ -7906,14 +7966,22 @@ function slackEventToInboundResult(event, opts = {}) {
|
|
|
7906
7966
|
return { event: null, dropReason: "bot_message" };
|
|
7907
7967
|
}
|
|
7908
7968
|
if (event.type === "message" && event.subtype && IGNORED_MESSAGE_SUBTYPES.has(event.subtype)) {
|
|
7909
|
-
return { event: null, dropReason: "
|
|
7969
|
+
return { event: null, dropReason: "ignored_subtype" };
|
|
7910
7970
|
}
|
|
7911
7971
|
const isDm = event.type === "message" && event.channel_type === "im";
|
|
7912
7972
|
const isThreadReply = event.type === "message" && !isDm && typeof event.thread_ts === "string" && event.thread_ts !== event.ts;
|
|
7973
|
+
const isNonThreadChannelMsg = event.type === "message" && !isDm && !isThreadReply && (event.channel_type === "channel" || event.channel_type === "group" || event.channel_type === "mpim" || // Some payload shapes omit channel_type for channel messages.
|
|
7974
|
+
typeof event.channel === "string");
|
|
7913
7975
|
if (event.type !== "app_mention" && !isDm && !isThreadReply) {
|
|
7976
|
+
if (isNonThreadChannelMsg) {
|
|
7977
|
+
return { event: null, dropReason: "non_thread_channel_msg" };
|
|
7978
|
+
}
|
|
7979
|
+
if (event.type !== "message") {
|
|
7980
|
+
return { event: null, dropReason: "non_message_event" };
|
|
7981
|
+
}
|
|
7914
7982
|
return { event: null, dropReason: "unsupported_type" };
|
|
7915
7983
|
}
|
|
7916
|
-
const text =
|
|
7984
|
+
const text = (event.text ?? "").trim();
|
|
7917
7985
|
if (!text) return { event: null, dropReason: "empty_text" };
|
|
7918
7986
|
const policy = getSlackAllowlistPolicy();
|
|
7919
7987
|
const userAllowlistActive = policy.allowedUsers.length > 0;
|
|
@@ -13654,16 +13722,18 @@ init_webhook_events();
|
|
|
13654
13722
|
init_inbox();
|
|
13655
13723
|
var recentlyHandled = /* @__PURE__ */ new Map();
|
|
13656
13724
|
var MAX_RECENT = 1e3;
|
|
13657
|
-
function
|
|
13725
|
+
function wasHandled(channel, ts) {
|
|
13658
13726
|
if (!channel || !ts) return false;
|
|
13727
|
+
return recentlyHandled.has(`${channel}\u241F${ts}`);
|
|
13728
|
+
}
|
|
13729
|
+
function markHandled(channel, ts) {
|
|
13730
|
+
if (!channel || !ts) return;
|
|
13659
13731
|
const key2 = `${channel}\u241F${ts}`;
|
|
13660
|
-
if (recentlyHandled.has(key2)) return true;
|
|
13661
13732
|
recentlyHandled.set(key2, Date.now());
|
|
13662
13733
|
if (recentlyHandled.size > MAX_RECENT) {
|
|
13663
13734
|
const oldest = recentlyHandled.keys().next().value;
|
|
13664
13735
|
if (oldest) recentlyHandled.delete(oldest);
|
|
13665
13736
|
}
|
|
13666
|
-
return false;
|
|
13667
13737
|
}
|
|
13668
13738
|
var slack = new Hono6();
|
|
13669
13739
|
slack.post("/events", async (c) => {
|
|
@@ -13700,7 +13770,7 @@ slack.post("/events", async (c) => {
|
|
|
13700
13770
|
textSnippet: typeof ev.text === "string" ? ev.text : void 0,
|
|
13701
13771
|
meta: { ts: ev.ts, thread_ts: ev.thread_ts, team: ev.team, event_subtype: ev.subtype }
|
|
13702
13772
|
});
|
|
13703
|
-
if (
|
|
13773
|
+
if (wasHandled(ev.channel, ev.ts)) {
|
|
13704
13774
|
updateEvent(auditId, { status: "dropped", dropReason: "duplicate_delivery" });
|
|
13705
13775
|
return c.json({ ok: true });
|
|
13706
13776
|
}
|
|
@@ -13724,7 +13794,18 @@ slack.post("/events", async (c) => {
|
|
|
13724
13794
|
}
|
|
13725
13795
|
const orchestratorId = await findOrCreateOrchestratorId();
|
|
13726
13796
|
if (orchestratorId) {
|
|
13797
|
+
inbound.content = await normalizeSlackMentions(inbound.content);
|
|
13798
|
+
if (ev.user) {
|
|
13799
|
+
const speakerName = await resolveSlackUserName(ev.user);
|
|
13800
|
+
if (speakerName) {
|
|
13801
|
+
inbound.content = inbound.content.replace(
|
|
13802
|
+
`user=${ev.user}`,
|
|
13803
|
+
`user=${speakerName} <@${ev.user}>`
|
|
13804
|
+
);
|
|
13805
|
+
}
|
|
13806
|
+
}
|
|
13727
13807
|
pushToInbox(orchestratorId, inbound);
|
|
13808
|
+
markHandled(ev.channel, ev.ts);
|
|
13728
13809
|
updateEvent(auditId, { status: "routed", sessionId: orchestratorId });
|
|
13729
13810
|
} else {
|
|
13730
13811
|
updateEvent(auditId, { status: "error", error: "no orchestrator session available" });
|