text
stringlengths
3
8.33k
repo
stringclasses
52 values
path
stringlengths
6
141
language
stringclasses
35 values
sha
stringlengths
64
64
chunk_index
int32
0
273
n_tokens
int32
1
896
import { asc, eq, and } from "drizzle-orm"; import { generateId } from "@aucta/shared/utils/id"; import { KnowledgeVerificationDTO as KnowledgeVerificationDTOSchema, type CreateKnowledgeVerificationDTO, type KnowledgeVerificationDTO, } from "@aucta/shared/schemas/knowledge-verification.schema"; import type { Driz...
aucta
packages/db/src/repositories/knowledge-verification.repository.ts
TypeScript
3aaf85584b832eb975e4fa144da0055ff76bdbc2eda953774bed670093d871d0
0
446
import { eq } from "drizzle-orm"; import { z } from "zod"; import type { DrizzleClient } from "../client.js"; import { orgSettings } from "../schema/org-settings.js"; const OrgSettingsDTO = z.object({ orgId: z.string(), industryType: z.string(), location: z.string(), updatedAt: z.date(), }); export type OrgSe...
aucta
packages/db/src/repositories/org-settings.repository.ts
TypeScript
6abc54ff7734ced2a6e6fad95fa80540ed04fc2ed4f82dc218a76e2ec5bed629
0
288
import { describe, expect, it, vi, beforeEach } from "vitest"; import { SessionFindingRepository } from "./session-finding.repository.js"; function createMockFindingRow(overrides: Record<string, unknown> = {}) { return { id: "fnd_abc123456789012345", sessionId: "ses_abc123456789012345", category: "safety...
aucta
packages/db/src/repositories/session-finding.repository.test.ts
TypeScript
d1d3d40ec7860f07a78ba5bb036d288ff25aae383e0993fa6cea553b8e216564
0
741
import { desc, eq } from "drizzle-orm"; import { generateId } from "@aucta/shared/utils/id"; import { SessionFindingDTO as SessionFindingDTOSchema, type CreateSessionFindingDTO, type SessionFindingDTO, } from "@aucta/shared/schemas/session-finding.schema"; import type { DrizzleClient } from "../client.js"; import...
aucta
packages/db/src/repositories/session-finding.repository.ts
TypeScript
16b5e721a9ad5abedcc55792e4db067a556221553eedc7daf134f31d06146d9e
0
309
import { describe, expect, it, vi, beforeEach } from "vitest"; import { SessionToolCallRepository } from "./session-tool-call.repository.js"; function createMockToolCallRow(overrides: Record<string, unknown> = {}) { return { id: "tc_abc123456789012345", sessionId: "ses_abc123456789012345", toolName: "loo...
aucta
packages/db/src/repositories/session-tool-call.repository.test.ts
TypeScript
5da019361146c7556d7905bb53362bf722a45b47b9bc733879a3f77b3eaec805
0
770
import { desc, eq } from "drizzle-orm"; import { generateId } from "@aucta/shared/utils/id"; import { SessionToolCallDTO as SessionToolCallDTOSchema, type CreateSessionToolCallDTO, type SessionToolCallDTO, } from "@aucta/shared/schemas/session-tool-call.schema"; import type { DrizzleClient } from "../client.js"; ...
aucta
packages/db/src/repositories/session-tool-call.repository.ts
TypeScript
d1471454886b57d0de170c2b04b823a6293d232d866237d137c7922819dd4dee
0
326
import { describe, expect, it, vi, beforeEach } from "vitest"; import { SessionRepository } from "./session.repository.js"; function createMockRow(overrides: Record<string, unknown> = {}) { return { id: "ses_abc123456789012345", orgId: "org_xyz789", userId: "usr_123", status: "connecting" as const, ...
aucta
packages/db/src/repositories/session.repository.test.ts
TypeScript
ecde55be0d0c2f3d19d04c37328ec5e871b8f08f77215c2764ed01929a7ff76e
0
896
30:00Z"), durationMs: 1800000, }), ]), }); const result = await repo.updateEnd("ses_abc123456789012345", { status: "completed", endedAt: new Date("2026-04-04T10:30:00Z"), durationMs: 1800000, languageDetected: "de", tokenCountInput: 5000...
aucta
packages/db/src/repositories/session.repository.test.ts
TypeScript
3755346ad6c70d18676e0b128dfa8f6b4a5f612a0bd2a2c2788cc83829e0a656
1
583
import { desc, eq } from "drizzle-orm"; import { generateId } from "@aucta/shared/utils/id"; import { SessionDTO as SessionDTOSchema, type CreateSessionDTO, type UpdateSessionDTO, type FeedbackInputDTO, type SessionDTO, } from "@aucta/shared/schemas/session.schema"; import { SessionFindingDTO as SessionFindin...
aucta
packages/db/src/repositories/session.repository.ts
TypeScript
625cf1962112b87daf1d9616817b0c9098f71664f69349952abf565700d16000
0
896
(desc(aiSessions.startedAt)) .limit(limit); return rows.map((row) => SessionDTOSchema.parse(row)); } async findWithDetails(id: string): Promise<{ session: SessionDTO; findings: import("@aucta/shared/schemas/session-finding.schema").SessionFindingDTO[]; toolCalls: import("@aucta/shared/schema...
aucta
packages/db/src/repositories/session.repository.ts
TypeScript
59f166a4b93de874578d71fd1b4f4b2587766b16a0a743a5fdea534dc7a3dc42
1
248
import { boolean, integer, jsonb, pgEnum, pgTable, text, timestamp, varchar, } from "drizzle-orm/pg-core"; export const aiSessionStatusEnum = pgEnum("ai_session_status", [ "connecting", "active", "completed", "failed", "timeout", "abandoned", ]); export const aiSessions = pgTable("ai_sessi...
aucta
packages/db/src/schema/ai-sessions.ts
TypeScript
0ddb21b6ebc59b2984d2d82ee462ebc4796f8615b3137efcb639859b97f345d8
0
412
import { jsonb, pgTable, serial, timestamp, varchar, } from "drizzle-orm/pg-core"; export const auditLog = pgTable("audit_log", { id: serial("id").primaryKey(), orgId: varchar("org_id", { length: 36 }).notNull(), userId: varchar("user_id", { length: 36 }).notNull(), action: varchar("action", { length...
aucta
packages/db/src/schema/audit-log.ts
TypeScript
1bc9efb5e6fa9c5960fab976802f18ca2d0f0cc2a58443ea77c7833cc5f71e4c
0
174
import { boolean, index, pgTable, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core"; import { relations } from "drizzle-orm"; // Better Auth generated schema - stub for Drizzle migration generation. // Better Auth manages these tables at runtime via drizzleAdapter(). export const user = pgTable("...
aucta
packages/db/src/schema/auth.ts
TypeScript
20cc7ea37ab6439c193a0915aabddad099cb0da063a79bcec01157fc0e2af74d
0
896
, { onDelete: "cascade" }), userId: text("user_id") .notNull() .references(() => user.id, { onDelete: "cascade" }), role: text("role").notNull().default("member"), createdAt: timestamp("created_at").notNull(), }, (table) => [ index("member_organizationId_idx").on(table.organizationId), ...
aucta
packages/db/src/schema/auth.ts
TypeScript
c49278c3e12d4834a3b90a62a41eb26e1da3a6483338902028bad2bdce7d2f40
1
625
export { inviteCodes, inviteRoleEnum } from "./invite-codes.js"; export { orgSettings } from "./org-settings.js"; export { auditLog } from "./audit-log.js"; export { aiSessions, aiSessionStatusEnum, } from "./ai-sessions.js"; export { sessionFindings, findingCategoryEnum, findingSeverityEnum, } from "./sessio...
aucta
packages/db/src/schema/index.ts
TypeScript
2865f835a8bf22e41d75438336033e439993e84d8d0f9a8873b583d79553e248
0
198
import { integer, pgEnum, pgTable, timestamp, varchar, } from "drizzle-orm/pg-core"; export const inviteRoleEnum = pgEnum("invite_role", [ "technician", "manager", ]); export const inviteCodes = pgTable("invite_codes", { id: varchar("id", { length: 30 }).primaryKey(), // References Better Auth's org...
aucta
packages/db/src/schema/invite-codes.ts
TypeScript
9b94176e29151b6f82e52e73ce13ddbb31c721bbecd98d1403f34ae773d2746f
0
270
import { boolean, integer, jsonb, pgEnum, pgTable, text, timestamp, varchar, } from "drizzle-orm/pg-core"; // KB-01: 4-tier confidence levels for knowledge article trust hierarchy export const confidenceLevelEnum = pgEnum("confidence_level", [ "unverified", "technician_reviewed", "expert_approved...
aucta
packages/db/src/schema/knowledge-articles.ts
TypeScript
625f5cce4cd80048910d5398a59a5b58e77d370ec10b7db62e1bc6fe6260a3ed
0
606
import { pgEnum, pgTable, timestamp, varchar, } from "drizzle-orm/pg-core"; export const linkTypeEnum = pgEnum("link_type", [ "reference", "prerequisite", "related", ]); export const knowledgeLinks = pgTable("knowledge_links", { id: varchar("id", { length: 30 }).primaryKey(), sourceArticleId: varcha...
aucta
packages/db/src/schema/knowledge-links.ts
TypeScript
9112f9fb8a6a7b9cf517dd50a252720f2b9aac4998f65a9aa9cbb7d76ff39c40
0
155
import { pgEnum, pgTable, text, timestamp, varchar, } from "drizzle-orm/pg-core"; export const verificationStatusEnum = pgEnum("verification_status", [ "pending", "approved", "rejected", "needs_revision", ]); export const knowledgeVerifications = pgTable("knowledge_verifications", { id: varchar("i...
aucta
packages/db/src/schema/knowledge-verifications.ts
TypeScript
7e0c22b5c2fe9a99d4729f5084f5c6a702c53b84c3b3a08a3b5006249039d49f
0
204
import { pgTable, timestamp, varchar } from "drizzle-orm/pg-core"; export const orgSettings = pgTable("org_settings", { // References Better Auth's organization.id -- serves as PK (one settings row per org) orgId: varchar("org_id", { length: 36 }).primaryKey(), industryType: varchar("industry_type", { length: 50...
aucta
packages/db/src/schema/org-settings.ts
TypeScript
f49e60838005d0e616355904189b4ab5a7a2c9924cad41c8e0999c69cf5fe468
0
135
import { pgEnum, pgTable, text, timestamp, varchar, } from "drizzle-orm/pg-core"; import { aiSessions } from "./ai-sessions.js"; export const findingCategoryEnum = pgEnum("finding_category", [ "safety", "maintenance", "regulatory", "observation", "recommendation", ]); export const findingSeverityE...
aucta
packages/db/src/schema/session-findings.ts
TypeScript
c02a703b45bcddc6d669603e816b1e6a1d1691e21e8bae297f52fb986da5d81c
0
258
import { boolean, integer, jsonb, pgTable, text, timestamp, varchar, } from "drizzle-orm/pg-core"; import { aiSessions } from "./ai-sessions.js"; export const sessionToolCalls = pgTable("session_tool_calls", { id: varchar("id", { length: 30 }).primaryKey(), sessionId: varchar("session_id", { length: ...
aucta
packages/db/src/schema/session-tool-calls.ts
TypeScript
1b56d7cd192019e078ac9485440961fe0b4cb3a68b39e38d223e18ad67219e2b
0
202
{ "name": "@aucta/shared", "version": "0.0.0", "private": true, "type": "module", "exports": { "./schemas/*": "./src/schemas/*.ts", "./constants/*": "./src/constants/*.ts", "./utils/*": "./src/utils/*.ts" }, "scripts": { "typecheck": "tsc --noEmit", "lint": "biome check .", "test":...
aucta
packages/shared/package.json
JSON
a143d1318b0ea57978d57583f103d8f722869e52a76bb06e6d8e40f7ebf505e7
0
155
// Web Crypto API global -- available in Node.js 19+, Bun, Deno, and browsers. // Declared here to avoid coupling this package to DOM or @types/node. declare const crypto: { getRandomValues<T extends ArrayBufferView>(array: T): T; randomUUID(): string; };
aucta
packages/shared/src/global.d.ts
TypeScript
569bfd591774890d9351f5790f449458773590c7939d29ac458670130872d004
0
67
export const INDUSTRY_TYPES = [ "hvac", "plumbing", "electrical", "refrigeration", "building_maintenance", "general_contractor", "other", ] as const; export type IndustryType = (typeof INDUSTRY_TYPES)[number];
aucta
packages/shared/src/constants/industries.ts
TypeScript
29be83ddf97f411a6d782eb6027aded4fc78b1946c8ec0491b62e30b2247393f
0
49
export const RATE_LIMITS = { AUTH: { window: "60 s", max: 10 }, TOKEN: { window: "60 s", max: 5 }, GENERAL: { window: "60 s", max: 100 }, } as const; export const INVITE_DEFAULTS = { CODE_LENGTH: 6, MAX_USES: 1, EXPIRY_DAYS: 7, } as const; export const ORG_LIMITS = { MAX_MEMBERS: 100, MAX_ORGS_PER_USE...
aucta
packages/shared/src/constants/limits.ts
TypeScript
86ad2a2ea2c7b73c5c252b2c9e0db1c884d4389b39113ee4f9fbc87f55bdba85
0
92
export const ROLES = { OWNER: "owner", MANAGER: "manager", TECHNICIAN: "technician", } as const; export type Role = (typeof ROLES)[keyof typeof ROLES]; export const ROLE_HIERARCHY: Record<Role, number> = { owner: 3, manager: 2, technician: 1, };
aucta
packages/shared/src/constants/roles.ts
TypeScript
a9bb8a4b1a35ff8b4ade2ad63f25fd18bce9ca1113336ca62a826c8c947a3447
0
67
import { z } from "zod"; export const LoginInput = z.object({ email: z.string().email(), password: z.string().min(8), }); export type LoginInput = z.infer<typeof LoginInput>; export const SignUpInput = z.object({ name: z.string().min(1).max(100), email: z.string().email(), password: z.string().min(8), }); ...
aucta
packages/shared/src/schemas/auth.schema.ts
TypeScript
44ff56b8573947e5f7d500267745c1f12f979090089812db681c31fb77e7e7e4
0
169
import { describe, expect, it } from "vitest"; import { CreateInviteInput, InviteCodeDTO } from "./invite.schema.js"; describe("InviteCodeDTO", () => { it("validates a complete valid invite code object", () => { const valid = { id: "inv_abc123", orgId: "org_xyz789", code: "AB3CD5", create...
aucta
packages/shared/src/schemas/invite.schema.test.ts
TypeScript
aad068a58bb06c10d5a98a29191b5a6605e1c5402d115fa9a8b79dcfd741cbe3
0
642
import { z } from "zod"; export const InviteCodeDTO = z.object({ id: z.string(), orgId: z.string(), code: z.string().length(6), createdBy: z.string(), role: z.enum(["technician", "manager"]), maxUses: z.number(), usedCount: z.number(), expiresAt: z.date(), createdAt: z.date(), }); export type Invite...
aucta
packages/shared/src/schemas/invite.schema.ts
TypeScript
8f6cbeccd76705bf46cb128d80bbbe87947357857dbad267b075793d8bf5342e
0
275
import { z } from "zod"; export const ConfidenceLevel = z.enum([ "unverified", "technician_reviewed", "expert_approved", "manufacturer_sourced", ]); export type ConfidenceLevel = z.infer<typeof ConfidenceLevel>; export const ArticleCategory = z.enum([ "equipment", "procedure", "safety", "regulatory",...
aucta
packages/shared/src/schemas/knowledge-article.schema.ts
TypeScript
6b190020cb6ea1d6d0d00b7c61671eff0209e04a5e5f6e8dfd00f7cc63b7be9d
0
749
import { z } from "zod"; export const LinkType = z.enum(["reference", "prerequisite", "related"]); export type LinkType = z.infer<typeof LinkType>; export const KnowledgeLinkDTO = z.object({ id: z.string(), sourceArticleId: z.string(), targetArticleId: z.string(), linkType: LinkType, createdAt: z.coerce.da...
aucta
packages/shared/src/schemas/knowledge-link.schema.ts
TypeScript
f458715e54fb68e355340bb6207600e04bce31f19f9f8a61ba7f20717f8041c4
0
150
import { z } from "zod"; export const VerificationStatus = z.enum([ "pending", "approved", "rejected", "needs_revision", ]); export type VerificationStatus = z.infer<typeof VerificationStatus>; export const KnowledgeVerificationDTO = z.object({ id: z.string(), articleId: z.string(), orgId: z.string(), ...
aucta
packages/shared/src/schemas/knowledge-verification.schema.ts
TypeScript
7ce6d5d68cac1e08d43424bf7bbc1a5e6c27a49a54f8b8ace8ea125bacf7590f
0
209
import { z } from "zod"; import { INDUSTRY_TYPES } from "../constants/industries.js"; export const OrgDTO = z.object({ id: z.string(), name: z.string(), slug: z.string(), logo: z.string().nullable(), createdAt: z.date(), }); export type OrgDTO = z.infer<typeof OrgDTO>; export const CreateOrgInput = z.objec...
aucta
packages/shared/src/schemas/org.schema.ts
TypeScript
afe1f6dcc9a8880e1fe8c9b3abb27dfc42c41367c3cc4925440b73b29f632bd9
0
162
import { z } from "zod"; export const FindingCategory = z.enum([ "safety", "maintenance", "regulatory", "observation", "recommendation", ]); export type FindingCategory = z.infer<typeof FindingCategory>; export const FindingSeverity = z.enum([ "low", "medium", "high", "critical", ]); export type F...
aucta
packages/shared/src/schemas/session-finding.schema.ts
TypeScript
15ca8566406b5187d11316090def9981ac33b3c90fae3270b6015b78aa3e5510
0
255
import { z } from "zod"; export const SessionToolCallDTO = z.object({ id: z.string(), sessionId: z.string(), toolName: z.string(), input: z.unknown().nullable(), output: z.unknown().nullable(), durationMs: z.number().int().nullable(), success: z.boolean(), errorMessage: z.string().nullable(), created...
aucta
packages/shared/src/schemas/session-tool-call.schema.ts
TypeScript
074408aa34167ae3482bbb606cb6b95c8dca4fed07da7296d155f2eba77b2cfb
0
227
import { describe, expect, it } from "vitest"; import { SessionDTO, SessionStatus, CreateSessionDTO, UpdateSessionDTO, FeedbackInputDTO, SessionSummaryDTO, } from "./session.schema.js"; import { SessionFindingDTO, CreateSessionFindingDTO, FindingCategory, FindingSeverity } from "./session-finding.schema.js"...
aucta
packages/shared/src/schemas/session.schema.test.ts
TypeScript
b3ab79cd7620f57b45d4d6a545ae0083ce33685d7c40185025ead6894f32753a
0
896
: "usr_456", modelVersion: "gemini-2.5-flash", }); expect(result.success).toBe(true); }); it("rejects missing orgId", () => { const result = CreateSessionDTO.safeParse({ userId: "usr_456" }); expect(result.success).toBe(false); }); }); describe("FeedbackInputDTO", () => { it("accepts rat...
aucta
packages/shared/src/schemas/session.schema.test.ts
TypeScript
5c8a82c7f6841578050fed3cbbc1be264c7932b11b8c64790d26d72d59c87093
1
896
validates minimal finding creation", () => { const result = CreateSessionFindingDTO.safeParse({ sessionId: "ses_123", category: "regulatory", description: "F-Gas threshold exceeded", severity: "critical", }); expect(result.success).toBe(true); }); it("accepts optional equipment ...
aucta
packages/shared/src/schemas/session.schema.test.ts
TypeScript
ae49fbaa6f1f3cdfcea32e744bf0741f05207eb3ca602f6376f228425ac102b8
2
896
; for (const field of forbidden) { expect(keys).not.toContain(field); } }); it("SessionFindingDTO has no sentiment/emotion/mood/tone fields", () => { const shape = SessionFindingDTO.shape; const keys = Object.keys(shape); const forbidden = ["sentiment", "emotion", "mood", "tone"]; for...
aucta
packages/shared/src/schemas/session.schema.test.ts
TypeScript
79b2f460dea9866de139069e9a40a4bf51c2ddd2e7ed0f6eb6aa401bff2e6242
3
194
import { z } from "zod"; export const SessionStatus = z.enum([ "connecting", "active", "completed", "failed", "timeout", "abandoned", ]); export type SessionStatus = z.infer<typeof SessionStatus>; export const SessionDTO = z.object({ id: z.string(), orgId: z.string(), userId: z.string(), status: ...
aucta
packages/shared/src/schemas/session.schema.ts
TypeScript
c8e257b9ea68071fee6dd0c968b38c3d255220f013ce73c07548d9b7a1d0c4c0
0
603
import { z } from "zod"; export const UserDTO = z.object({ id: z.string(), name: z.string(), email: z.string().email(), emailVerified: z.boolean(), image: z.string().nullable(), createdAt: z.date(), updatedAt: z.date(), }); export type UserDTO = z.infer<typeof UserDTO>;
aucta
packages/shared/src/schemas/user.schema.ts
TypeScript
7a1879ca727bb4ada4fdf03df30fbc0491531889bbeaeab89578c0b9150ba1ae
0
97
import { describe, expect, it } from "vitest"; import { ErrorWithCode } from "./errors.js"; describe("ErrorWithCode", () => { it("creates an error with NotFound code and message", () => { const error = ErrorWithCode.NotFound("Session not found"); expect(error.code).toBe("NOT_FOUND"); expect(error.message...
aucta
packages/shared/src/utils/errors.test.ts
TypeScript
4274aac86a2855e4bed7b6dceca390538727f64dd557ac8a69dd1e144f8479a8
0
442
export class ErrorWithCode extends Error { constructor( public readonly code: string, message: string, ) { super(message); this.name = "ErrorWithCode"; } static NotFound(message: string) { return new ErrorWithCode("NOT_FOUND", message); } static Forbidden(message: string) { return ...
aucta
packages/shared/src/utils/errors.ts
TypeScript
c3db499b189d201f9a2361134e71aab694f9848968a7f761f2d337e9c0457378
0
115
import { describe, expect, it } from "vitest"; import { generateId } from "./id.js"; describe("generateId", () => { it("returns a string starting with the given prefix followed by underscore", () => { const id = generateId("org"); expect(id).toMatch(/^org_/); }); it("works with different prefixes", () =...
aucta
packages/shared/src/utils/id.test.ts
TypeScript
e108df9b6d6d66a2ee66f63782d2126c0ac2c467b0e9080a72a3df369f8985eb
0
315
const CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; export function generateId(prefix: string, length = 21): string { const array = new Uint8Array(length); crypto.getRandomValues(array); let id = ""; for (const byte of array) { id += CHARS.charAt(byte % CHARS.length); } retu...
aucta
packages/shared/src/utils/id.ts
TypeScript
ee27ceab1e9c2582c8c427b4a6587a3ddad56d77765b5721acd41de06a0362ac
0
81
import { describe, expect, it } from "vitest"; import { generateInviteCode, normalizeInviteCode } from "./invite-code.js"; const VALID_CHARSET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"; const AMBIGUOUS_CHARS = ["I", "O", "0", "1"]; describe("generateInviteCode", () => { it("returns a string of exactly 6 characters", () ...
aucta
packages/shared/src/utils/invite-code.test.ts
TypeScript
201a2a7c18dd58b75e69693dca9beda67c72fa5ce96efd8a4657516c0cb8041e
0
425
// Excludes I/O/0/1 for readability on job sites (speakable, glove-friendly) const CHARSET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"; export function generateInviteCode(): string { let code = ""; const array = new Uint8Array(6); crypto.getRandomValues(array); for (const byte of array) { code += CHARSET.charAt(b...
aucta
packages/shared/src/utils/invite-code.ts
TypeScript
15be44d019a16bbe674d2629ab53fb9e1fa3cd8fcc0759629c69e3505a84ae5b
0
109
# {Feature Name} — Agent Instructions Read this file first when working on this feature. ## Context {Brief description of what this feature does and why it exists} ## Key Files - `design.md` — Full technical specification - `implementation.md` — Current progress - `decisions.md` — Architecture decisions made ## R...
aucta
specs/_templates/CLAUDE.md
Markdown
0c09f07fb3b65200dd13baadda4bec6824aef14f6073b01f864007eda58df02d
0
136
# {Feature Name} — Architecture Decision Records (Record decisions as ADR-001, ADR-002, etc.)
aucta
specs/_templates/decisions.md
Markdown
f2c6e0566977d31de9a7ef6993999437f8f8dbfbfa17afe502b2a28b509622f3
0
24
# {Feature Name} — Design Document ## Overview {What are we building and why?} ## Requirements ### Must Have - {Requirement 1} - {Requirement 2} ### Should Have - {Requirement 3} ### Won't Have (this phase) - {Deferred item} ## Technical Design ### Data Model {Schema changes, new tables, DTOs} ### API {New t...
aucta
specs/_templates/design.md
Markdown
91b3a8ea6fe11b4c73dc9459c4404a00e00507b3ef38fdaa3798fb6a0f797249
0
130
# {Feature Name} — Future Work Items deliberately deferred from this implementation phase. (Add items here as they come up during design and implementation)
aucta
specs/_templates/future-work.md
Markdown
89135a6ba37ab593a6bd6d06acabcf0dced3e77ed4634182bae28a95b7cdfbda
0
29
# {Feature Name} — Implementation Status ## Status: not-started ## Completed (nothing yet) ## In Progress (nothing yet) ## Next Steps 1. {First task} 2. {Second task} ## Session Notes (Add notes here after each implementation session)
aucta
specs/_templates/implementation.md
Markdown
27e72f5329a7bb55ddac6e34264b11f0d1f86be29a6f35a296855844fc6eea3a
0
59
{ "extends": "next/core-web-vitals" }
brz-chatbot
.eslintrc.json
JSON
1589a15e55fbebc6519c95d91d8f0a090618f20dc78e479858b9c27552484961
0
15
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies node_modules .pnp .pnp.js # testing coverage # next.js .next/ out/ build # misc .DS_Store *.pem # debug npm-debug.log* yarn-debug.log* yarn-error.log* .pnpm-debug.log* # local env files .env.local .env.development...
brz-chatbot
.gitattributes
Git Attributes
e08a83018b72d385de4f171fb135b49af61ee9e38dfd61020f67ede0d07a2a90
0
121
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules /.pnp .pnp.js # testing /coverage # next.js /.next/ /out/ # production /build # misc .DS_Store *.pem # debug npm-debug.log* yarn-debug.log* yarn-error.log* # local env files .env*.local .env # verc...
brz-chatbot
.gitignore
Git Ignore
6a118ea6ae29e8467c0351f4f636f4c0ecc7dc776f9bf63917987677f170a0d0
0
110
import type { NextAuthConfig } from 'next-auth' export const authConfig = { secret: process.env.AUTH_SECRET, pages: { signIn: '/login', newUser: '/signup' }, callbacks: { async authorized({ auth, request: { nextUrl } }) { const isLoggedIn = !!auth?.user const isOnLoginPage = nextUrl.pat...
brz-chatbot
auth.config.ts
TypeScript
7785bc5ef8c5479f7acdb24f14c6555791315426af9f883f78d3cfb3a5881a92
0
229
import NextAuth from 'next-auth' import Credentials from 'next-auth/providers/credentials' import { authConfig } from './auth.config' import { z } from 'zod' import { getStringFromBuffer } from './lib/utils' import { getUser } from './app/login/actions' export const { auth, signIn, signOut } = NextAuth({ ...authConf...
brz-chatbot
auth.ts
TypeScript
193e8d3b043be3b3898617451950fb0a2ea29c69534fc900e19d183ecda3749f
0
240
{ "$schema": "https://ui.shadcn.com/schema.json", "style": "default", "rsc": true, "tsx": true, "tailwind": { "config": "tailwind.config.js", "css": "app/globals.css", "baseColor": "slate", "cssVariables": true }, "aliases": { "components": "@/components", "utils": "@/lib/utils" ...
brz-chatbot
components.json
JSON
d9c78d24a3aa5e0a7e312d25b774f1e985db9a2b630188e31dfb10f7d23790b7
0
114
import { kv } from '@vercel/kv' import type { NextFetchEvent, NextRequest } from 'next/server' const MAX_REQUESTS = 50 export async function middleware(req: NextRequest, ev: NextFetchEvent) { if (req.method === 'POST') { const realIp = req.headers.get('x-real-ip') || 'no-ip' const pipeline = kv.pipeline() ...
brz-chatbot
middleware.ts
TypeScript
59058f53210653648150ff187f6b640804ba9434ba87eec3c40d904f320e8027
0
217
/** @type {import('next').NextConfig} */ module.exports = { reactStrictMode: true, experimental: { serverComponentsExternalPackages: ['puppeteer-core', '@sparticuz/chromium'] }, images: { remotePatterns: [ { hostname: 'www.brz-jobs.at', protocol: 'https', port: '' } ...
brz-chatbot
next.config.js
JavaScript
8e1c7ed33f5875e4d00d65f971c25aba97d98e1189ce4fe145f628ed3789c5ab
0
80
{ "name": "brz-chatbot", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint", "format": "prettier --write \"app\"" }, "engines": { "node": ">=18" }, "dependencies": { "@ai-sdk/openai": "^0.0.20...
brz-chatbot
package.json
JSON
ac3ba2468db3bacbdd5e6793a4a38829a6e2d8520324d76d1a02132c2c2203a3
0
896
"^15.5.10", "@types/xml2js": "^0.4.14", "eslint": "^8.53.0", "eslint-config-next": "^14.0.2", "prettier": "^3.0.3", "tailwind-merge": "^2.0.0", "tailwindcss": "^3.3.5", "tailwindcss-animate": "^1.0.7", "typescript": "^5.2.2" } }
brz-chatbot
package.json
JSON
da515f3a8c2fa294c79e95621a23cd9cf564d7f730582035227969c4637f5824
1
107
module.exports = { plugins: { tailwindcss: {}, autoprefixer: {} } }
brz-chatbot
postcss.config.js
JavaScript
b9357981319940ed660b848c7a15ea479915885b7cbe60d6951b5d5cef5b509d
0
19
/** @type {import('prettier').Config} */ module.exports = { endOfLine: "lf", semi: false, useTabs: false, singleQuote: true, arrowParens: "avoid", tabWidth: 2, trailingComma: "none", importOrder: [ "^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^t...
brz-chatbot
prettier.config.cjs
JavaScript
0882653d9bbae970d55ff47ffcbced11cc767323c95d4f5c5c4b1c3d583bc493
0
284
<div align="center"> <a href="https://brz-chatbot.vercel.app/"> <img src="https://brz-chatbot.vercel.app/opengraph-image.png" alt="BRZ Chatbot"> </a> <h1>Bundesrechenzentrum Chatbot</h1> </div> <p align="center"> Open-Source-Chatbot, entwickelt mit NextJS 14, unterstützt durch OpenAI/LocalAI/HF Inference API, QDrant &...
brz-chatbot
README.md
Markdown
d37be702fcd7877e9024e38bd7f353cbd4f125eedbef64ca99dffcc0c55cd772
0
742
const { fontFamily } = require('tailwindcss/defaultTheme') const { nextui } = require('@nextui-org/react') /** @type {import('tailwindcss').Config} */ module.exports = { darkMode: ['class'], content: [ 'app/**/*.{ts,tsx}', 'components/**/*.{ts,tsx}', './node_modules/@nextui-org/theme/dist/**/*.{js,ts,j...
brz-chatbot
tailwind.config.js
JavaScript
2612b068a8b843bbbd1173b5a2d3e75ba2a0a2b2208e588a46a234afcc3ab23b
0
871
{ "compilerOptions": { "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, "forceConsistentCasingInFileNames": true, "noEmit": true, "incremental": true, "esModuleInterop": true, "module": "esnext", "moduleResolution": "node", "r...
brz-chatbot
tsconfig.json
JSON
c9bff778977381ad00aa7b18e8f40ae5d206ba8c111fd5981e586122e9cb608b
0
241
'use server' import { revalidatePath } from 'next/cache' import { redirect } from 'next/navigation' import { kv } from '@vercel/kv' import { auth } from '@/auth' import { type Chat } from '@/types' export async function getChats(userId?: string | null) { if (!userId) { return [] } try { const pipeline...
brz-chatbot
app/actions.ts
TypeScript
2d3c1b1173cbdcaca3eb483510bbe2c36205ea137383483688fc9df3727b940b
0
896
id}` }) await pipeline.exec() } else { return } } export async function getMissingKeys() { const keysRequired = ['OPENAI_API_KEY'] return keysRequired .map(key => (process.env[key] ? '' : key)) .filter(key => key !== '') }
brz-chatbot
app/actions.ts
TypeScript
b255c2e750f235ae09e511f32c76a0af143160e132171d4f1255d9362ee49aed
1
68
@tailwind base; @tailwind components; @tailwind utilities; @layer base { :root { --background: 0 0% 100%; --foreground: 0 0% 3.9%; --card: 0 0% 100%; --card-foreground: 0 0% 3.9%; --popover: 0 0% 100%; --popover-foreground: 0 0% 3.9%; --primary: 0 72.2% 50.6%; --primary-foreground: 0 ...
brz-chatbot
app/globals.css
CSS
856200ab0a29b47f297247227af5a59d96cc2b9d47fa351370ade3b471560909
0
480
import { Metadata } from 'next' import { GeistSans } from 'geist/font/sans' import { GeistMono } from 'geist/font/mono' import '@/app/globals.css' import { cn } from '@/lib/utils' import { TailwindIndicator } from '@/components/tailwind-indicator' import { Providers } from '@/components/providers' import moment from 'm...
brz-chatbot
app/layout.tsx
TypeScript
1e931cc059a9c654273c175f69ba860096ef569e858bf7fd874e0e5d1b81dfe2
0
484
import { Header } from '@/components/header' import { ChatHistory } from '@/components/sidebar/chat-history' import { SidebarDesktop } from '@/components/sidebar/sidebar-desktop' import { SidebarMobile } from '@/components/sidebar/sitebar-mobile' import { cn } from '@/lib/utils' import { Inter } from 'next/font/google'...
brz-chatbot
app/(chat)/layout.tsx
TypeScript
8b471538cfeda6f5aeb3753c386e51572c39afc1c17d9fa0c8796481587529eb
0
277
import { nanoid } from '@/lib/utils' import { Chat } from '@/components/chat/chat' import { AI } from '@/lib/chat/actions' import { auth } from '@/auth' import { getMissingKeys } from '../actions' import { Session } from '@/types' export const metadata = { title: 'BRZ Chatbot' } export default async function IndexP...
brz-chatbot
app/(chat)/page.tsx
TypeScript
e1e22812017abb946f8ba5132fab0be3e53f81c69456d6eec68fdd285c58bf72
0
159
import { type Metadata } from 'next' import { notFound, redirect } from 'next/navigation' import { auth } from '@/auth' import { getChat, getMissingKeys } from '@/app/actions' import { Chat } from '@/components/chat/chat' import { AI } from '@/lib/chat/actions' import { Session } from '@/types' import { Header } from ...
brz-chatbot
app/(chat)/chat/[id]/page.tsx
TypeScript
9e3a53c37c188156359a6a8d21b79fc554443626acdd8d7d66dc7d34d5f846da
0
364
'use server' import { signIn } from '@/auth' import { AuthError } from 'next-auth' import { z } from 'zod' import { kv } from '@vercel/kv' import { ResultCode } from '@/lib/utils' import { User } from '@/types' export async function getUser(email: string) { const user = await kv.hgetall<User>(`user:${email}`) ret...
brz-chatbot
app/login/actions.ts
TypeScript
517aa17c5980c7acd0cf61c7820564c050b58e869aa34618933e7fd3f331e786
0
313
import { auth } from '@/auth' import LoginForm from '@/components/auth/login-form' import { Session } from '@/types' import { redirect } from 'next/navigation' export default async function LoginPage() { const session = (await auth()) as Session if (session) { redirect('/') } return ( <main className...
brz-chatbot
app/login/page.tsx
TypeScript
dfbfbdaa7b325b7ea97d0a06d8d7e26105718fcf58576bc93b809eabc767f3bc
0
115
import { redirect } from 'next/navigation' export default async function NewPage() { redirect('/') }
brz-chatbot
app/new/page.tsx
TypeScript
8be87c3e02b301a063eb48cba876721c676c07e47267b8b6cf5bc054be48a92b
0
25
import { type Metadata } from 'next' import { notFound } from 'next/navigation' import { formatDate } from '@/lib/utils' import { getSharedChat } from '@/app/actions' import { ChatList } from '@/components/chat/chat-list' import { FooterText } from '@/components/footer' import { AI, getUIStateFromAIState } from '@/lib...
brz-chatbot
app/share/[id]/page.tsx
TypeScript
8d9540f918ad6526f4d5a98c6f0bf258f8e55304c0024206bced638b9f880bfb
0
455
'use server' import { signIn } from '@/auth' import { ResultCode, getStringFromBuffer } from '@/lib/utils' import { z } from 'zod' import { kv } from '@vercel/kv' import { getUser } from '../login/actions' import { AuthError } from 'next-auth' export async function createUser( email: string, hashedPassword: strin...
brz-chatbot
app/signup/actions.ts
TypeScript
00002d74a143b6df242c2c6686855a20290b2d8bf8e27016e4705fff82a18d3a
0
471
import { auth } from '@/auth' import SignupForm from '@/components/auth/signup-form' import { Session } from '@/types' import { redirect } from 'next/navigation' export default async function SignupPage() { const session = (await auth()) as Session if (session) { redirect('/') } return ( <main classN...
brz-chatbot
app/signup/page.tsx
TypeScript
ec752f870983924eb222cbc5647939ec921cf6a8fef30a1e7df72825f4019e00
0
115
'use client' import * as React from 'react' import { cn } from '@/lib/utils' import { Button, type ButtonProps } from '@/components/ui/button' import { IconArrowDown } from '@/components/ui/icons' interface ButtonScrollToBottomProps extends ButtonProps { isAtBottom: boolean scrollToBottom: () => void } export f...
brz-chatbot
components/button-scroll-to-bottom.tsx
TypeScript
45426383034a9055344b3b0d64cf2c63c4ec55bfc10234ea22f0da2a72f3f184
0
205
import * as React from 'react' import Balancer from 'react-wrap-balancer' import { IconAccuracy, IconLock, IconSecure } from './ui/icons' const cardConfig = [ { title: 'Akkurat', icon: <IconAccuracy />, description: 'Vektorbasierte Referenzen für möglichst präzise Antworten' }, { title: 'Unabhän...
brz-chatbot
components/cards.tsx
TypeScript
f196eb8ce121cdd3d555203880e4c4a64ab42e0c076cb69b22914db248bc79a8
0
307
import Balancer from 'react-wrap-balancer' import { Cards } from '@/components/cards' import { cn } from '@/lib/utils' interface EmptyScreenProps extends React.ComponentProps<'div'> {} export function EmptyScreen({ children, className }: EmptyScreenProps) { return ( <div className={cn( 'w-full min...
brz-chatbot
components/empty-screen.tsx
TypeScript
f1dfd9d812a03f02a92f93bcb146d92f8dcda34374bc66504c75ef2c6aa9b09f
0
568
export function ExternalLink({ href, children }: { href: string children: React.ReactNode }) { return ( <a href={href} target="_blank" className="inline-flex flex-1 justify-center gap-1 leading-4 hover:underline" > <span>{children}</span> <svg aria-hidden="true" ...
brz-chatbot
components/external-link.tsx
TypeScript
c7171e8acb422d76a426748dd420d6dd99c293ca87d8c3d51306c1fcb3866b4a
0
167
import React from 'react' import { cn } from '@/lib/utils' export function FooterText({ className, ...props }: React.ComponentProps<'p'>) { return ( <p className={cn( 'px-2 text-center text-xs leading-normal text-muted-foreground', className )} {...props} > BRZ Chatbo...
brz-chatbot
components/footer.tsx
TypeScript
620927afe979883885a31fde4a49944880e08b771e8f5570069f518005f2e436
0
95
/* eslint-disable @next/next/no-img-element */ import * as React from 'react' import Link from 'next/link' import { auth } from '@/auth' import { Button } from '@/components/ui/button' import { IconGitHub, IconSeparator, IconVercel } from '@/components/ui/icons' import { Session } from '@/types' import { SidebarMobile ...
brz-chatbot
components/header.tsx
TypeScript
e467a77ccf268d093691232a496f96de4e40af789402f1f37197e38035d12c49
0
671
'use client' import * as React from 'react' import { useRouter } from 'next/navigation' import { Button } from '@/components/ui/button' import { AlertDialog, AlertDialogAction, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from...
brz-chatbot
components/imprint-dialog.tsx
TypeScript
1a365af9e4c7c2491a690c1e5d631fbc538aafabfddaa21bc61989a3dedfaf96
0
872
import { FC, memo } from 'react' import ReactMarkdown, { Options } from 'react-markdown' export const MemoizedReactMarkdown: FC<Options> = memo( ReactMarkdown, (prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className )
brz-chatbot
components/markdown.tsx
TypeScript
bb9b97ac62078df627c17957fddcb2002520f5d120ea4fe60ea26889d6494f83
0
63
'use client' import * as React from 'react' import { ThemeProvider as NextThemesProvider } from 'next-themes' import { ThemeProviderProps } from 'next-themes/dist/types' import { TooltipProvider } from '@/components/ui/tooltip' import { SidebarProvider } from '@/lib/hooks/use-sidebar' import { NextUIProvider } from '...
brz-chatbot
components/providers.tsx
TypeScript
38654be7b7a57244520e0560c914457f94e751d5d7e2a1793636680ef3b521ae
0
172
export function TailwindIndicator() { if (process.env.NODE_ENV === 'production') return null return ( <div className="fixed bottom-1 left-1 z-50 flex h-6 w-6 items-center justify-center rounded-full bg-gray-800 p-3 font-mono text-xs text-white"> <div className="block sm:hidden">xs</div> <div classN...
brz-chatbot
components/tailwind-indicator.tsx
TypeScript
6c0b69842ecfbbabcbc9b98d9aeac42dd02152abe3793172dca747a606874da3
0
191
'use client' import * as React from 'react' import { useTheme } from 'next-themes' import { Button } from '@/components/ui/button' import { IconMoon, IconSun } from '@/components/ui/icons' interface ThemeToggleProps extends React.ComponentPropsWithoutRef<'button'> {} export function ThemeToggle({ className, ...props...
brz-chatbot
components/theme-toggle.tsx
TypeScript
e4402ef1a66225c4150af5f33644cef3cf9c7f5731be39169ac6e0c9006e3ee3
0
223
import { Button } from '@/components/ui/button' import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu' import { signOut } from '@/auth' import { Session } from '@/types' export interface UserMenuProps { user: Session['...
brz-chatbot
components/user-menu.tsx
TypeScript
f7cc7a4db126a25d91975440a7fd24aa46fe7564c411b85260a73b2513b7af7f
0
451
'use client' import { useFormState } from 'react-dom' import { authenticate } from '@/app/login/actions' import Link from 'next/link' import { useEffect, useState } from 'react' import { toast } from 'sonner' import { cn, getMessageFromCode } from '@/lib/utils' import { useRouter } from 'next/navigation' import { Icon...
brz-chatbot
components/auth/login-form.tsx
TypeScript
02f1e6dff1193fe170b5a848ff834e141fef9748cc8ede1b1d600f3972b10051
0
717
'use client' import { useFormState, useFormStatus } from 'react-dom' import Link from 'next/link' import { useEffect, useState } from 'react' import { toast } from 'sonner' import { cn, getMessageFromCode } from '@/lib/utils' import { useRouter } from 'next/navigation' import { IconSpinner } from '@/components/ui/icon...
brz-chatbot
components/auth/signup-form.tsx
TypeScript
6d75f1efd1d33987b0bdf372c520ee673c1b82cf759b92a1d94d2dfa1fe249d1
0
721
import React from 'react' import { Card } from '../ui/card' export interface ChatErrorMessageProps extends React.ComponentProps<'div'> { text: string } const ChatErrorMessage = ({ text }: ChatErrorMessageProps) => { return ( <Card className="p-2 px-3 rounded-sm text-secondary-foreground bg-primary/10 border-p...
brz-chatbot
components/chat/chat-error-message.tsx
TypeScript
557bcde2cd457beb9481064716ed4ce67a2a24146b6e406066600da7e6813acc
0
94
import { Session, UIState } from '@/types' import { ExclamationTriangleIcon } from '@radix-ui/react-icons' import Link from 'next/link' import JobCard from '../jobs/job-card' export interface ChatList { messages: UIState session?: Session isShared: boolean } export function ChatList({ messages, session, isShare...
brz-chatbot
components/chat/chat-list.tsx
TypeScript
522978cb0a95a27f0a7b93842495f4be411282ee29da089ee0806ed0b3b26f69
0
364
'use client' import { Button } from '@/components/ui/button' import { IconCheck, IconCopy } from '@/components/ui/icons' import { useCopyToClipboard } from '@/lib/hooks/use-copy-to-clipboard' import { cn } from '@/lib/utils' import { Message } from '@/types' interface ChatMessageActionsProps extends React.ComponentPr...
brz-chatbot
components/chat/chat-message-actions.tsx
TypeScript
12b6b188b1c4eb5dc7a6e7512f706f7633b89d1723852081299860ba6dd77a37
0
263
import { Message } from 'ai' import remarkGfm from 'remark-gfm' import remarkMath from 'remark-math' import { cn } from '@/lib/utils' import { CodeBlock } from '@/components/ui/codeblock' import { MemoizedReactMarkdown } from '@/components/markdown' import { IconBRZ, IconUser } from '@/components/ui/icons' import { Ch...
brz-chatbot
components/chat/chat-message.tsx
TypeScript
68c8d54ac105fedf0e97dd7e44f27149200380062a532e406691805e4c5066d7
0
823
import * as React from 'react' import { shareChat } from '@/app/actions' import { Button } from '@/components/ui/button' import { PromptForm } from '@/components/chat/prompt-form' import { ButtonScrollToBottom } from '@/components/button-scroll-to-bottom' import { IconShare, SparklesIcon } from '@/components/ui/icons'...
brz-chatbot
components/chat/chat-panel.tsx
TypeScript
3f96882e8095e4a829fe96d0b1376a6a37066997b1a86c8c135caca1e964b5d3
0
896