b41c1d2501
CI / Architecture Guardrails (push) Successful in 2m38s
CI / Assistant Split Regression (push) Successful in 3m33s
CI / Typecheck (push) Successful in 3m51s
CI / Lint (push) Successful in 5m2s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61) Co-authored-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com> Co-committed-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com>
30 lines
765 B
TypeScript
30 lines
765 B
TypeScript
import { PermissionKey, SystemRole } from "@nexus/shared";
|
|
|
|
import type { ToolContext } from "../router/assistant-tools.js";
|
|
|
|
export function createToolContext(
|
|
db: Record<string, unknown>,
|
|
options?: {
|
|
permissions?: PermissionKey[];
|
|
userRole?: SystemRole;
|
|
},
|
|
): ToolContext {
|
|
const userRole = options?.userRole ?? SystemRole.ADMIN;
|
|
return {
|
|
db: db as ToolContext["db"],
|
|
userId: "user_1",
|
|
userRole,
|
|
permissions: new Set(options?.permissions ?? []),
|
|
session: {
|
|
user: { email: "assistant@example.com", name: "Assistant User", image: null },
|
|
expires: "2026-03-29T00:00:00.000Z",
|
|
},
|
|
dbUser: {
|
|
id: "user_1",
|
|
systemRole: userRole,
|
|
permissionOverrides: null,
|
|
},
|
|
roleDefaults: null,
|
|
};
|
|
}
|