A hook call used to record only how it was taken; its run's answer went to the chat alone and was lost to the call once the job was pruned. Now `bot_hook_events` keeps `response`, `response_message_id` and `responded_at`, written on every call a run took in when that run ends (completed, failed, lost, stopped or cancelled) by `recordHookCallResponse` in the job helpers, and calls turn done or failed. The Calls view searches what calls sent and what runs answered, filters by status and pages; Show all loads one call whole. Bots get `search_hook_calls` and `read_hook_call` for their own hooks (never in a hook call's own run), with payloads always marked as outside data. Calls are kept for the app setting `hook_events_keep_days` (Settings > General, default now 30 days). The caller still only gets 202 Queued. Co-Authored-By: Claude Opus 5.5 <[email protected]>
58 lines
2.3 KiB
TypeScript
58 lines
2.3 KiB
TypeScript
import userAuth from "@/src/functions/backend/auth/user-auth";
|
|
import { AdminHomePath } from "@/src/dict/admin-sections-dict";
|
|
import grabUsers from "@/src/functions/backend/db/users/grab-users";
|
|
import sanitizeUserBio from "@/src/functions/backend/db/users/sanitize-user-bio";
|
|
import grabUserPasswordHash from "@/src/functions/backend/auth/grab-user-password-hash";
|
|
import type { PagePropsType } from "@/src/types";
|
|
import type { BunextPageServerFn } from "@moduletrace/bunext/types";
|
|
import grabRunLimitsOverview from "@/src/functions/backend/db/app-settings/grab-run-limits";
|
|
import grabSkillLimitsOverview from "@/src/functions/backend/db/app-settings/grab-skill-limits";
|
|
import grabHookCallRetentionOverview from "@/src/functions/backend/db/app-settings/grab-hook-events-keep-days";
|
|
import grabStorageQuotaOverview from "@/src/functions/backend/db/app-settings/grab-storage-quota-overview";
|
|
import { grabSystemPromptAppendOverview } from "@/src/functions/backend/db/app-settings/grab-system-prompt-append";
|
|
import runningVersion from "@/src/utils/running-version";
|
|
|
|
type Params = Parameters<BunextPageServerFn<PagePropsType>>[0];
|
|
|
|
/**
|
|
* Shared server props for the `/admin/settings` sub-pages.
|
|
*/
|
|
export default async function grabSettingsServerProps({ req }: Params) {
|
|
const { user } = await userAuth({ req });
|
|
|
|
if (!user?.id) {
|
|
return {
|
|
redirect: {
|
|
destination: "/auth/login",
|
|
},
|
|
};
|
|
}
|
|
|
|
const user_res = await grabUsers({ user_id: user.id });
|
|
|
|
if (!user_res.singleRes) {
|
|
return {
|
|
redirect: {
|
|
destination: AdminHomePath,
|
|
},
|
|
};
|
|
}
|
|
|
|
const has_password = Boolean(
|
|
await grabUserPasswordHash({ user_id: user.id }),
|
|
);
|
|
|
|
return {
|
|
props: {
|
|
person: sanitizeUserBio({ user: user_res.singleRes }),
|
|
has_password,
|
|
storage_quota: await grabStorageQuotaOverview().catch(() => null),
|
|
system_prompt_append: await grabSystemPromptAppendOverview().catch(() => null),
|
|
run_limits: await grabRunLimitsOverview().catch(() => null),
|
|
skill_limits: await grabSkillLimitsOverview().catch(() => null),
|
|
hook_call_retention: await grabHookCallRetentionOverview().catch(() => null),
|
|
running_version: runningVersion({ env: process.env }),
|
|
},
|
|
};
|
|
}
|