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 |
|---|---|---|---|---|---|---|
string) => {
useSessionStore.getState().setError(msg);
},
};
const connection = new GeminiConnection(deps);
connection.connect({
token: "test-token",
model: "gemini-2.5-flash-live-preview",
});
lastCreatedWs.simulateError("Connection refused");
exp... | aucta | apps/mobile/hooks/useGeminiSession.test.ts | TypeScript | e8c0e047dbb17fa79d4b04f84a242e2af71f0bdb516e79b5f45017d86782121d | 3 | 896 |
expect(useSessionStore.getState().toolNames).toContain("logFinding");
});
it("endSession tool call is handled client-side without server relay", async () => {
const mockDispatch = vi.fn();
const relay = new ToolRelay({ dispatchToolCalls: mockDispatch });
let connectionInstance: GeminiConnect... | aucta | apps/mobile/hooks/useGeminiSession.test.ts | TypeScript | 3e4d98684eb269f75991ee94539d37f28e86017bb725dbb5ce88e18edeb323f7 | 4 | 657 |
import { useRef, useCallback, useEffect } from "react";
import { useTRPC } from "@/lib/api";
import { useMutation } from "@tanstack/react-query";
import { useSessionStore } from "@/stores/session-store";
import {
GeminiConnection,
type GeminiConnectionDeps,
} from "@/lib/gemini/connection";
import { AudioPlayback }... | aucta | apps/mobile/hooks/useGeminiSession.ts | TypeScript | 468d789095fcea106e63bd459e0865b59d99cdb7545935303d2e5362b3f63d3c | 0 | 896 |
/ Check for client-side endSession tool (SESS-09, D-12)
const endSessionCall = toolCall.functionCalls.find(
(fc) => fc.name === "endSession",
);
if (endSessionCall) {
// Send success response back to Gemini so it can speak the goodbye
connectionRef.current?.sendToo... | aucta | apps/mobile/hooks/useGeminiSession.ts | TypeScript | 3ecb7f25a7a8128455e22942c6817c819554352d8bc0b2c48f5f269c3935bd2b | 1 | 896 |
= freshConnection;
freshConnection.connect({
token: freshToken.token,
model: freshToken.model,
toolDeclarations: freshToken.toolDeclarations,
resumptionHandle,
});
return true;
} catch {
... | aucta | apps/mobile/hooks/useGeminiSession.ts | TypeScript | 0698a83f2fbfe1ea811422b8eb19af6bcba1395c2538229b76bf30d4f0ed6852 | 2 | 896 |
0;
// Persist session end data to server
if (state.serverSessionId) {
endSessionMutation.mutate({
sessionId: state.serverSessionId,
status: "completed",
durationMs,
languageDetected: state.languageDetected ?? undefined,
tokenCountInput: state.tokenCountInput,
... | aucta | apps/mobile/hooks/useGeminiSession.ts | TypeScript | f6c20c01ed70ef2b76f54dd7e10dcf3abc3df06325a6651a7b7c8c20ff6b0139 | 3 | 260 |
import { useState, useCallback } from "react";
import { useCameraPermissions, useMicrophonePermissions } from "expo-camera";
export type PermissionStatus = "undetermined" | "granted" | "denied";
/**
* Checks and requests camera + microphone permissions using Expo Camera APIs.
* Both permissions are required before ... | aucta | apps/mobile/hooks/usePermissions.ts | TypeScript | f44e232091b02dd9208ee6827a43a29e587ae05ab112242fe7433f0f5b0d614a | 0 | 229 |
import { createTRPCContext } from "@trpc/tanstack-react-query";
import type { AppRouter } from "@aucta/api";
export const { TRPCProvider, useTRPC } = createTRPCContext<AppRouter>();
| aucta | apps/mobile/lib/api.ts | TypeScript | 24d567d0fe6ef0654a94a1b8a8e57eef30c4718097f3ac103d32098a40a89305 | 0 | 44 |
import { createAuthClient } from "better-auth/react";
import { expoClient } from "@better-auth/expo/client";
import { organizationClient } from "better-auth/client/plugins";
import * as SecureStore from "expo-secure-store";
import { API_URL } from "./api-url";
console.log("[Auth] Client baseURL:", API_URL);
export co... | aucta | apps/mobile/lib/auth-client.ts | TypeScript | 05847a52002790822f044b3a24c5856cc1a2eb9d0d9429a65cc0adf4e05661b0 | 0 | 145 |
import * as SecureStore from "expo-secure-store";
export const secureStorage = {
getItem: (key: string) => SecureStore.getItemAsync(key),
setItem: (key: string, value: string) => SecureStore.setItemAsync(key, value),
removeItem: (key: string) => SecureStore.deleteItemAsync(key),
};
| aucta | apps/mobile/lib/storage.ts | TypeScript | 91ace3bb5b5ded35e67a2cf417e48d14382ecbf59fcea8bb70a79abdfaebb4be | 0 | 74 |
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
const mockOnAudioReady = vi.fn().mockReturnValue({ status: "success" });
const mockStart = vi.fn().mockReturnValue({ status: "success" });
const mockStop = vi.fn().mockReturnValue({ status: "success", path: "", size: 0, duration: 0 });
const moc... | aucta | apps/mobile/lib/gemini/audio-capture.test.ts | TypeScript | d020fbec80e78030269b62f4a82ceb1124d01ac837fee83ce5f033dc589cce75 | 0 | 896 |
);
});
it("destroy() stops and cleans up recorder", async () => {
await capture.start();
capture.destroy();
expect(mockPause).toHaveBeenCalled();
expect(mockStop).toHaveBeenCalled();
expect(mockClearOnAudioReady).toHaveBeenCalled();
expect(mockClearOnError).toHaveBeenCalled();
expect((c... | aucta | apps/mobile/lib/gemini/audio-capture.test.ts | TypeScript | 2d27f692d9057b23c0862ca9a69d13f88a4205204965bfac31e4bd1e2bcda5a8 | 1 | 669 |
import { AUDIO_INPUT_SAMPLE_RATE, AUDIO_INPUT_CHANNELS } from "./protocol";
/**
* Convert Float32 PCM samples (-1.0 to 1.0) to base64-encoded Int16 PCM.
* Gemini Live API expects 16-bit PCM, 16kHz, little-endian.
*/
function float32ToPcm16Base64(float32: Float32Array): string {
const int16 = new Int16Array(float3... | aucta | apps/mobile/lib/gemini/audio-capture.ts | TypeScript | f50b2a146adce8eba8f67f587f922276de8782ffda25c22c75a19dc3836c376d | 0 | 711 |
import { describe, it, expect, vi, beforeEach } from "vitest";
import { MockAudioContext } from "./__mocks__/audio";
import { AudioPlayback } from "./audio-playback";
/**
* Helper: encode a 16-bit PCM buffer (little-endian) as base64.
* Each sample is two bytes; values are signed Int16.
*/
function pcm16ToBase64(sa... | aucta | apps/mobile/lib/gemini/audio-playback.test.ts | TypeScript | f16c8ed47a2f5741beba98639dafcadaef75d20a1363603286bba86972753afb | 0 | 896 |
, 400]);
playback.enqueueChunk(base64);
const oldCtx = (playback as any).ctx as MockAudioContext;
playback.interrupt();
const newCtx = (playback as any).ctx as MockAudioContext;
expect(newCtx).not.toBe(oldCtx);
expect(oldCtx.state).toBe("closed");
expect((playback as any).nextStartTime).to... | aucta | apps/mobile/lib/gemini/audio-playback.test.ts | TypeScript | a8c1206a2a4328b4d24038a2a86bff3357190edba80e58fe8ab672620ff74ee5 | 1 | 356 |
import { AUDIO_OUTPUT_SAMPLE_RATE } from "./protocol";
/**
* Decode a base64 string to a Uint8Array.
* Uses atob() available in React Native 0.83+.
*/
function base64ToUint8Array(base64: string): Uint8Array {
const binary = atob(base64);
const bytes = new Uint8Array(binary.length);
for (let i = 0; i < binary.... | aucta | apps/mobile/lib/gemini/audio-playback.ts | TypeScript | 006e2a41ae09cb0fa70288a706a748a0079e15f01b7c6a17e4db541c4e6bedc5 | 0 | 831 |
import { describe, it, expect, vi, beforeEach } from "vitest";
import { MockWebSocket } from "./__mocks__/websocket";
import { GeminiConnection } from "./connection";
import type { GeminiConnectionDeps, GeminiConnectionConfig } from "./connection";
import { GEMINI_WS_URL, AUDIO_INPUT_MIME } from "./protocol";
// Captu... | aucta | apps/mobile/lib/gemini/connection.test.ts | TypeScript | 0222c6db2855d205361709e3fd3eec50751a201e33a0ab4540a0ac3c2aaddaf8 | 0 | 896 |
);
it("omits tools from setup when no declarations provided", () => {
connection.connect(createDefaultConfig());
lastCreatedWs.simulateOpen();
const setup = JSON.parse(lastCreatedWs.sentMessages[0]);
expect(setup.config.tools).toBeUndefined();
});
});
describe("message handling", ... | aucta | apps/mobile/lib/gemini/connection.test.ts | TypeScript | c11bb4dab2a420a56d5902c0ee23a278aeb1d089ab87d7f63acdee5b79d8d7a1 | 1 | 896 |
not OPEN", () => {
connection.connect(createDefaultConfig());
// Do NOT simulateOpen() -- ws is CONNECTING
connection.sendAudio("pcm-base64-data");
expect(lastCreatedWs.sentMessages).toHaveLength(0);
});
});
describe("sendVideo()", () => {
it("sends correct realtimeInput.video mess... | aucta | apps/mobile/lib/gemini/connection.test.ts | TypeScript | f5c330d89823d87b7d07f6b276f0a7527c9148e81875ea5ca7b709409f3785a3 | 2 | 781 |
import {
GEMINI_WS_URL,
AUDIO_INPUT_MIME,
isSetupComplete,
isServerContent,
isToolCall,
isSessionResumptionUpdate,
isGoAway,
} from "./protocol";
export interface GeminiConnectionDeps {
onAudioData: (pcmBase64: string) => void;
onToolCall: (toolCall: {
functionCalls: Array<{
id: string;
... | aucta | apps/mobile/lib/gemini/connection.ts | TypeScript | 50de2660146915a11efe4fe41ffe968f7963b6290a35b0a87fb506a7363ac46a | 0 | 896 |
data as string);
if (isSetupComplete(msg)) {
this.deps.onSetupComplete();
return;
}
if (isServerContent(msg)) {
const content = msg.serverContent;
if (content.modelTurn?.parts) {
for (const part of content.modelTurn.parts) {
if (part.inlineData?.data) {
... | aucta | apps/mobile/lib/gemini/connection.ts | TypeScript | 38edb11932bbcdc85b9535043249757b30f5a281be5a779209291ea7803a1a6e | 1 | 196 |
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
import { FrameCapture } from "./frame-capture";
const mockManipulateAsync = vi.fn().mockResolvedValue({
base64: "resized-jpeg-data",
uri: "file://resized.jpg",
width: 768,
height: 576,
});
vi.mock("expo-image-manipulator", () => ({
ma... | aucta | apps/mobile/lib/gemini/frame-capture.test.ts | TypeScript | 2aab7bd6a6a619434a57fdf6cb2a0d45684250f6357abe3965e79d87fc81a040 | 0 | 896 |
caught silently, frame skipped", async () => {
mockTakePictureAsync.mockRejectedValue(new Error("Camera paused"));
frameCapture.start();
await vi.advanceTimersByTimeAsync(1000);
// Should not throw, and onFrame should not be called
expect(onFrame).not.toHaveBeenCalled();
});
it("skips frame w... | aucta | apps/mobile/lib/gemini/frame-capture.test.ts | TypeScript | 76746379da8df27b0e02d08fe25eef016a9fcecc7f63a022ecf6da36158ad04b | 1 | 402 |
import type { CameraView } from "expo-camera";
import { manipulateAsync, SaveFormat } from "expo-image-manipulator";
import { CAPTURE_INTERVAL_MS, JPEG_QUALITY, FRAME_MAX_DIMENSION } from "./protocol";
export interface FrameCaptureDeps {
cameraRef: React.RefObject<CameraView>;
onFrame: (jpegBase64: string) => void... | aucta | apps/mobile/lib/gemini/frame-capture.ts | TypeScript | 181a735fcbdecfe573f305353374bc98abfc860d145e3a64477c0000e41d26e4 | 0 | 503 |
export const GEMINI_WS_URL =
"wss://generativelanguage.googleapis.com/ws/google.ai.generativelanguage.v1alpha.GenerativeService.BidiGenerateContentConstrained";
// --- Audio Constants ---
export const AUDIO_INPUT_SAMPLE_RATE = 16000;
export const AUDIO_INPUT_CHANNELS = 1;
export const AUDIO_INPUT_MIME = "audio/pcm;r... | aucta | apps/mobile/lib/gemini/protocol.ts | TypeScript | b047a54415dc9df8686656bbfc98add16a1d0f2d2fedd6e30e9de2cbc307c63b | 0 | 896 |
" in msg;
}
export function isToolCall(msg: unknown): msg is ToolCallMessage {
return typeof msg === "object" && msg !== null && "toolCall" in msg;
}
export function isSessionResumptionUpdate(msg: unknown): msg is SessionResumptionUpdate {
return typeof msg === "object" && msg !== null && "sessionResumptionUpdate... | aucta | apps/mobile/lib/gemini/protocol.ts | TypeScript | e751d85a1a631317027d49193f535507d417efd93a89e290cd859a04eb8e4fe4 | 1 | 157 |
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
import { calculateBackoff, reconnectWithBackoff } from "./reconnection";
import type { ReconnectDeps } from "./reconnection";
import {
BACKOFF_BASE_MS,
BACKOFF_MAX_MS,
BACKOFF_JITTER_MS,
RECONNECT_TIMEOUT_MS,
} from "./protocol";
describ... | aucta | apps/mobile/lib/gemini/reconnection.test.ts | TypeScript | a8442a76cae7a4fa29d649de7e9fc50467b1a8b97ec4b63ddcb5d3e5c18efd92 | 0 | 896 |
toHaveBeenCalledOnce();
expect(mockOnSuccess).not.toHaveBeenCalled();
});
it("updates connectionQuality to 'reconnecting' during attempts", async () => {
mockConnect
.mockResolvedValueOnce(false)
.mockResolvedValueOnce(true);
const promise = reconnectWithBackoff(createDeps());
// Adva... | aucta | apps/mobile/lib/gemini/reconnection.test.ts | TypeScript | 003951fc36e03837707b7b79f37632fc46df50471e70a6461ee78e32ce637d78 | 1 | 237 |
import type { ConnectionQuality } from "../../stores/session-store";
import {
BACKOFF_BASE_MS,
BACKOFF_MAX_MS,
BACKOFF_JITTER_MS,
RECONNECT_TIMEOUT_MS,
} from "./protocol";
export interface ReconnectDeps {
connect: () => Promise<boolean>;
onSuccess: () => void;
onGiveUp: () => void;
getSessionStore: ()... | aucta | apps/mobile/lib/gemini/reconnection.ts | TypeScript | ace2d1013eb639f76e7e98fa46fe3a0c75d6b6453be971c637ef24750ec3fd2c | 0 | 287 |
import { describe, it, expect, vi, beforeEach } from "vitest";
import { ToolRelay } from "./tool-relay";
describe("ToolRelay", () => {
let toolRelay: ToolRelay;
let mockDispatch: ReturnType<typeof vi.fn>;
const sampleToolCall = {
functionCalls: [
{ id: "call-1", name: "lookupErrorCode", args: { errorC... | aucta | apps/mobile/lib/gemini/tool-relay.test.ts | TypeScript | c279eb68042ce9c0eae4bdc9f5fc79dc290c9325b120616767248ded0eeff1d9 | 0 | 571 |
/**
* Dependency interface for ToolRelay.
* The dispatchToolCalls function is wired to trpcClient.session.dispatchToolCalls.mutate
* in the orchestration hook (Plan 05). Injecting it as a dependency makes ToolRelay
* testable without a real tRPC client.
*/
export interface ToolRelayDeps {
dispatchToolCalls: (inp... | aucta | apps/mobile/lib/gemini/tool-relay.ts | TypeScript | 8ed2f3b4981e7311e06611b3ebaba0e7742f013bbd82a5afd69b61540fc911a1 | 0 | 377 |
export class MockAudioBuffer {
numberOfChannels: number;
length: number;
sampleRate: number;
duration: number;
channelData: Map<number, Float32Array> = new Map();
constructor(options: { numberOfChannels: number; length: number; sampleRate: number }) {
this.numberOfChannels = options.numberOfChannels;
... | aucta | apps/mobile/lib/gemini/__mocks__/audio.ts | TypeScript | 4cdeb049a4004c619fec81ee15e0088608c1f738b93d7b61d4156c5d7ba1da1f | 0 | 416 |
export class MockWebSocket {
static CONNECTING = 0;
static OPEN = 1;
static CLOSING = 2;
static CLOSED = 3;
readyState = MockWebSocket.CONNECTING;
url: string;
sentMessages: string[] = [];
onopen: ((event: any) => void) | null = null;
onmessage: ((event: any) => void) | null = null;
onclose: ((eve... | aucta | apps/mobile/lib/gemini/__mocks__/websocket.ts | TypeScript | 95e394d24ced6630c7656c111b3a952225dd650d2c196e791c1d36306459e6fc | 0 | 331 |
import { describe, it, expect, beforeEach, vi } from "vitest";
// In-memory storage mock for react-native-mmkv
const memoryStore = new Map<string, string>();
vi.mock("react-native-mmkv", () => ({
createMMKV: () => ({
getString: (key: string) => memoryStore.get(key),
set: (key: string, value: string) => memo... | aucta | apps/mobile/lib/storage/session-cache.test.ts | TypeScript | 70a414db21b797880cb543580f56e968bd7ac17e360684aa6c987767ad186d34 | 0 | 896 |
toEqual([]);
});
it("returns all cached sessions in order", () => {
cacheSession(makeSession("ses_001"));
cacheSession(makeSession("ses_002"));
cacheSession(makeSession("ses_003"));
const all = getCachedSessions();
expect(all).toHaveLength(3);
expect(all.map((s) => s.id)).t... | aucta | apps/mobile/lib/storage/session-cache.test.ts | TypeScript | 622d3fe1343f6b486811742b130a6523cf05c32a3f38e6b088af086b13cb9cfe | 1 | 327 |
import { createMMKV } from "react-native-mmkv";
const storage = createMMKV({ id: "session-cache" });
const KEYS = {
sessionIds: "cache:sessionIds",
session: (id: string) => `cache:session:${id}`,
lastSynced: "cache:lastSynced",
} as const;
const MAX_CACHED = 20;
export interface CachedSession {
id: string;
... | aucta | apps/mobile/lib/storage/session-cache.ts | TypeScript | dbeaeb133aee33c4d9303c37ae9198d2b933eebe7926059ddda8c62de8499fab | 0 | 561 |
import { createContext, useContext, useEffect, type ReactNode } from "react";
import { authClient } from "@/lib/auth-client";
interface SessionContextValue {
session: {
user: {
id: string;
name: string;
email: string;
};
activeOrganizationId: string | null;
} | null;
isLoading: bool... | aucta | apps/mobile/providers/session-provider.tsx | TypeScript | cab1193bcc9da2882a089f7470d82ecd649155e4ca0c06b13be16433f1378036 | 0 | 367 |
import type { AppRouter } from "@aucta/api";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { createTRPCClient, httpBatchLink } from "@trpc/client";
import { type ReactNode, useState } from "react";
import { TRPCProvider } from "@/lib/api";
import { authClient } from "@/lib/auth-client... | aucta | apps/mobile/providers/trpc-provider.tsx | TypeScript | f0b9aa834da7fd7f3748ba4b33cea3c65f88e7ba97a79d8ff42f37439e9375a8 | 0 | 775 |
import { describe, it, expect, beforeEach } from "vitest";
import { useSessionStore } from "./session-store";
describe("useSessionStore", () => {
beforeEach(() => {
useSessionStore.getState().reset();
});
describe("initial state", () => {
it("has status idle", () => {
expect(useSessionStore.getSta... | aucta | apps/mobile/stores/session-store.test.ts | TypeScript | 9dc18c3ccf68da98eb85b52263abe03821bd26d58f3203a4bc33f0de60ceddbc | 0 | 896 |
", () => {
useSessionStore.getState().setConnectionQuality("reconnecting");
expect(useSessionStore.getState().connectionQuality).toBe("reconnecting");
});
it("updates connectionQuality to lost", () => {
useSessionStore.getState().setConnectionQuality("lost");
expect(useSessionStore.getS... | aucta | apps/mobile/stores/session-store.test.ts | TypeScript | fb370159e7952b2b2b93f931bb0405a115dadd5d8402d09b3b17062de64b8a13 | 1 | 896 |
expect(useSessionStore.getState().sessionId).toBe("session_abc");
});
it("clears session ID with null", () => {
useSessionStore.getState().setSessionId("session_abc");
useSessionStore.getState().setSessionId(null);
expect(useSessionStore.getState().sessionId).toBeNull();
});
});
desc... | aucta | apps/mobile/stores/session-store.test.ts | TypeScript | 1d422e97058dd2a92c8510c97002b0f85b0be9ceec2c8b94fb40b5c3f64c4217 | 2 | 594 |
import { create } from "zustand";
export type SessionStatus =
| "idle"
| "requesting-permissions"
| "disclosure"
| "connecting"
| "active"
| "disconnected"
| "reconnecting"
| "completed"
| "failed"
| "timeout";
export type ConnectionQuality = "connected" | "reconnecting" | "lost";
export interfac... | aucta | apps/mobile/stores/session-store.ts | TypeScript | 4f40e434ff9f82917de015a7b06bc18b54b2ba890ddbe0e84ee1d82b9f631bb8 | 0 | 896 |
= get();
const durationMs = state.sessionStartTime
? Date.now() - state.sessionStartTime
: 0;
return {
durationMs,
toolNames: state.toolNames,
findingsCount: state.findingsCount,
languageDetected: state.languageDetected,
};
},
reset: () => set(in... | aucta | apps/mobile/stores/session-store.ts | TypeScript | de58f5e9198f9cd972b7a99ca8f1cc79352564f2a890bd2d4e555417a78d455c | 1 | 66 |
{
"name": "@aucta/server",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "bun --watch src/index.ts",
"start": "bun src/index.ts",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@aucta/api": "workspace:*",
"@trpc/server": "^11.16.0",
"inngest": "^4.1.... | aucta | apps/server/package.json | JSON | f7b06eb5af57f799c85059d935a8e500a27351ccc50a1b82fb76442ecb458133 | 0 | 126 |
{
"compilerOptions": {
"target": "ES2024",
"module": "ES2022",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"outDir": "dist",
"rootDir": "src",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"noUncheckedI... | aucta | apps/server/tsconfig.json | JSON | a83ee4568626f263985c9183ec2a6c367838c06c27844f05c3474a45941df11b | 0 | 113 |
import { config } from "dotenv";
import { resolve } from "node:path";
// Load env vars from monorepo root before any other imports
config({ path: resolve(import.meta.dir, "../../../.env.local") });
const { fetchRequestHandler } = await import("@trpc/server/adapters/fetch");
const { appRouter } = await import("@aucta/... | aucta | apps/server/src/index.ts | TypeScript | fae6624c4b749b04ca73404f8f0f18776b925e25a8ae598166e1e23e37dfaee2 | 0 | 761 |
{
"name": "@aucta/ai",
"version": "0.0.0",
"private": true,
"type": "module",
"exports": {
".": "./src/index.ts",
"./tools/*": "./src/tools/*.ts",
"./prompts/*": "./src/prompts/*.ts",
"./knowledge": "./src/knowledge/index.ts",
"./knowledge/*": "./src/knowledge/*.ts"
},
"scripts": {
... | aucta | packages/ai/package.json | JSON | 6c1ebe362482139533a841ff3ac529a21514186d53258ae4a6374a7b93a66d0c | 0 | 222 |
{
"extends": "../config/tsconfig.library.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src"
},
"include": ["src", "src/**/*.json"]
}
| aucta | packages/ai/tsconfig.json | JSON | 828f918de374779b96c601fda2a2b7d241dbc0838f621c424d69dc2be2648e34 | 0 | 61 |
import { defineProject } from "vitest/config";
export default defineProject({
test: {
name: "ai",
environment: "node",
include: ["src/**/*.test.ts"],
},
});
| aucta | packages/ai/vitest.config.ts | TypeScript | d0f278d9e54decfe473d31e644605e373387afa64f00ccb872a1b1a6e5a6e096 | 0 | 53 |
// Bun runtime provides setTimeout globally but lib: ES2024 does not include timer types
declare function setTimeout(callback: (...args: any[]) => void, ms?: number): number;
// Web Crypto API global -- available in Bun, Node.js 19+, Deno, browsers.
// Redeclared here because @aucta/shared's global.d.ts is not visible... | aucta | packages/ai/src/global.d.ts | TypeScript | b41c5692f9ccd6e3f65b468d3917db1499666d78ff2815b4d55935fb17ffea4e | 0 | 117 |
export { buildTool } from "./tools/base.js";
export type {
ToolDef,
AnyToolDef,
ToolContext,
ToolResult,
GeminiFunctionDeclaration,
} from "./tools/base.js";
export { assembleToolPool } from "./tools/registry.js";
export type { ToolPool } from "./tools/registry.js";
export { dispatchToolCalls } from "./tools/... | aucta | packages/ai/src/index.ts | TypeScript | 573c623fe91ddd0c148b6a0b96eb4709b938fa1559c07d55e1d62ff372360e27 | 0 | 255 |
export interface ToolContext {
orgId: string;
userId: string;
sessionId: string;
}
export type ToolResult<T> =
| { success: true; data: T }
| { success: false; error: string; code: string };
export interface GeminiFunctionDeclaration {
name: string;
description: string;
parameters: Record<string, unkn... | aucta | packages/ai/src/types.ts | TypeScript | 7b713c672a13cbb1b9c36cd7f25e7e7dac6b2d13c133582ec1311177d17ce931 | 0 | 71 |
{
"manufacturer": "Daikin",
"codes": [
{
"code": "U0",
"meaning": "Low pressure drop or refrigerant shortage",
"severity": "high",
"repairSteps": [
"Check refrigerant charge level",
"Inspect for refrigerant leaks at all connections",
"Check expansion valve operati... | aucta | packages/ai/src/data/error-codes/daikin.json | JSON | 80883adeccb97c07f5f4e1fe16c4a43b346c4858bffdacb55d9de536c68bb505 | 0 | 896 |
operation",
"Check refrigerant charge (possible overcharge)",
"Inspect for non-condensable gases in system",
"Check high pressure switch wiring and operation"
],
"possibleCauses": ["Dirty condenser coil", "Fan motor failure", "Refrigerant overcharge", "Non-condensable gases"],
... | aucta | packages/ai/src/data/error-codes/daikin.json | JSON | 76ce2dc1ea225f7b733c72aa3ae2612f05f806209a70083d4006769ac9f3d4d9 | 1 | 896 |
Sensor error"],
"equipmentTypes": ["split", "multi-split", "VRV"]
},
{
"code": "H6",
"meaning": "Indoor unit position detection sensor error",
"severity": "low",
"repairSteps": [
"Check position detection switch or sensor",
"Inspect swing motor and mechanism",
... | aucta | packages/ai/src/data/error-codes/daikin.json | JSON | 18b03d8e7c2af405c4aa22e344795df82c761e00d0967dc6d3310b1f022a89ef | 2 | 896 |
IPM (Intelligent Power Module) on outdoor PCB",
"Check compressor mechanical operation"
],
"possibleCauses": ["Compressor failure", "Low voltage", "Liquid slugging", "IPM failure"],
"equipmentTypes": ["split", "multi-split", "VRV"]
}
]
}
| aucta | packages/ai/src/data/error-codes/daikin.json | JSON | 1ef9c2deeba9e6d108f126b6b93a646642c824f476c7ec9caad26db56193751c | 3 | 67 |
import { describe, it, expect } from "vitest";
import { JsonErrorCodeRepository } from "./index.js";
describe("JsonErrorCodeRepository", () => {
const repo = new JsonErrorCodeRepository();
it("looks up Daikin U4 and returns entry with meaning containing 'communication'", async () => {
const entry = await repo... | aucta | packages/ai/src/data/error-codes/error-code-repository.test.ts | TypeScript | 1121df8a7591e1ef05baaea78cf0ad3666e66b21d3a5c4b833a6ddf7711b94c2 | 0 | 658 |
{
"manufacturer": "Fujitsu",
"codes": [
{
"code": "EE:EE",
"meaning": "Communication error between indoor and outdoor units",
"severity": "high",
"repairSteps": [
"Check wiring connections between indoor and outdoor units",
"Verify correct wire configuration (S1/S2/S3)",
... | aucta | packages/ai/src/data/error-codes/fujitsu.json | JSON | f34be813ececfb18bf835fa8369e0c746252162896dbe4fabdcbfd9315130280 | 0 | 896 |
float switch operation",
"Check for correct installation angle"
],
"possibleCauses": ["Blocked drain", "Pump failure", "Float switch stuck", "Installation error"],
"equipmentTypes": ["split", "multi-split"]
},
{
"code": "06",
"meaning": "Outdoor unit freeze or overheat prot... | aucta | packages/ai/src/data/error-codes/fujitsu.json | JSON | 2c059fe21104dd0177c1fa3eb2ba93e09497cf4c58c5992f15e6526aeb34bcd8 | 1 | 896 |
sensor operation",
"Verify drain line gradient"
],
"possibleCauses": ["Blocked drain", "Pump malfunction", "Sensor fault", "Improper drain slope"],
"equipmentTypes": ["split", "multi-split"]
},
{
"code": "A5",
"meaning": "Indoor unit anti-freeze protection activated",
... | aucta | packages/ai/src/data/error-codes/fujitsu.json | JSON | d7573225820a8a0a3c3902dbdc6b4f07d472374f5ac5e99b84921655c48457f1 | 2 | 777 |
import { z } from "zod";
import daikinData from "./daikin.json" with { type: "json" };
import mitsubishiData from "./mitsubishi-electric.json" with { type: "json" };
import fujitsuData from "./fujitsu.json" with { type: "json" };
export const ErrorCodeEntrySchema = z.object({
manufacturer: z.string(),
code: z.stri... | aucta | packages/ai/src/data/error-codes/index.ts | TypeScript | 35d8905eb2a0df31d6e8d8ed3aa07441cbc60456761eec53d56e9a79fb5258b2 | 0 | 455 |
{
"manufacturer": "Mitsubishi Electric",
"codes": [
{
"code": "E0",
"meaning": "Remote controller signal receiving error",
"severity": "low",
"repairSteps": [
"Check remote controller batteries",
"Verify no obstruction between remote and indoor unit receiver",
"Ch... | aucta | packages/ai/src/data/error-codes/mitsubishi-electric.json | JSON | 7aa9f8a9ab21db991b4b5ee158636aee6c4a29880e919bac519dea2e5adae38f | 0 | 896 |
,
"severity": "high",
"repairSteps": [
"Check refrigerant charge level",
"Inspect for refrigerant leaks",
"Check electronic expansion valve operation",
"Verify discharge thermistor is functioning",
"Check indoor coil airflow"
],
"possibleCauses": ["Low cha... | aucta | packages/ai/src/data/error-codes/mitsubishi-electric.json | JSON | a51d8279faf361ab8859453e5d35157be86808c63eb138fa17831c7b59e261d2 | 1 | 896 |
"Dirty heat sink", "Fan failure", "High ambient"],
"equipmentTypes": ["split", "multi-split", "city-multi"]
},
{
"code": "P5",
"meaning": "Compressor overcurrent during operation",
"severity": "critical",
"repairSteps": [
"Check system operating pressures",
"Verify ... | aucta | packages/ai/src/data/error-codes/mitsubishi-electric.json | JSON | 0604334157d5b59e7f905425b1986f828ea111171fcb17e5c824bfff56b8ace3 | 2 | 896 |
"Verify drain pump operation if fitted",
"Check drain sensor and float switch",
"Flush drain line with water or approved cleaner"
],
"possibleCauses": ["Blocked drain line", "Drain pump failure", "Dirty drain pan", "Float switch stuck"],
"equipmentTypes": ["split", "multi-split", "city... | aucta | packages/ai/src/data/error-codes/mitsubishi-electric.json | JSON | db6045ca60584a9851983aeb2535a17826239ed80801618dcbc8c258cb77c179 | 3 | 84 |
export { GeminiEmbeddingService } from "./retrieve/embeddings.js";
export type { EmbeddingServiceConfig } from "./retrieve/embeddings.js";
export { createQdrantClient, ensureCollection } from "./retrieve/qdrant-client.js";
export type { QdrantClientConfig } from "./retrieve/qdrant-client.js";
export {
CONFIDENCE_ATTR... | aucta | packages/ai/src/knowledge/index.ts | TypeScript | 6629eace923413d4b3e10b5f20d24243c1216cdfc67b239752bfa0a693d192b2 | 0 | 306 |
import { describe, it, expect, vi, beforeEach } from "vitest";
const { mockGenerateContent } = vi.hoisted(() => ({
mockGenerateContent: vi.fn(),
}));
vi.mock("@google/genai", () => ({
GoogleGenAI: class {
models = {
generateContent: mockGenerateContent,
};
},
}));
import { compileArticle, type Ar... | aucta | packages/ai/src/knowledge/compile/article-compiler.test.ts | TypeScript | d932bbc200ccaba2b21b0a22e2373362fad1540d555d4bbdb19a76c0f829a83d | 0 | 896 |
.secondArticle,
sourceSessionIds: ["ses_001", "ses_003"],
};
mockGenerateContent.mockResolvedValue({
text: JSON.stringify({
title: "Merged",
summary: "Merged article",
contentMd: "Merged content",
tags: [],
}),
});
const result = await compileArticle(
... | aucta | packages/ai/src/knowledge/compile/article-compiler.test.ts | TypeScript | 011fbf7feb72a3a89ba2f7a3e082ebece925c6376eb48473cc5d459e5ab83cba | 1 | 266 |
import { GoogleGenAI } from "@google/genai";
export interface ArticleForCompilation {
id: string;
title: string;
contentMd: string;
category: string;
equipmentBrand: string | null;
equipmentModel: string | null;
procedureType: string | null;
sourceSessionIds: string[] | null;
version: number;
}
expo... | aucta | packages/ai/src/knowledge/compile/article-compiler.ts | TypeScript | 7d07a4c48cc06adc48a466dfe83b28afda783dbb1e2add4609eaec8e3b4cf195 | 0 | 867 |
import { describe, it, expect, vi, beforeEach } from "vitest";
import { generateLinks, type LinkerDeps } from "./linker.js";
describe("linker", () => {
const mockArticleRepo = {
findById: vi.fn(),
findByEquipment: vi.fn(),
create: vi.fn(),
findByOrgId: vi.fn(),
update: vi.fn(),
updateEmbeddin... | aucta | packages/ai/src/knowledge/compile/linker.test.ts | TypeScript | 16359ef353c8539dcd325ec6142331c000c9ff68b48085ad507e660abf6c762e | 0 | 896 |
toBe(0);
expect(mockLinkRepo.create).not.toHaveBeenCalled();
});
it("deletes old links before creating new ones (idempotent)", async () => {
mockArticleRepo.findById.mockResolvedValue({
id: "art_001",
equipmentBrand: "Daikin",
equipmentModel: "FTXM25",
});
mockArticleRepo.findByE... | aucta | packages/ai/src/knowledge/compile/linker.test.ts | TypeScript | ab7ad7de7fca4043dd907666e84ce45421c49fdfd529e41231e9af100381eeef | 1 | 212 |
import type { KnowledgeArticleDTO } from "@aucta/shared/schemas/knowledge-article.schema";
import type { CreateKnowledgeLinkDTO } from "@aucta/shared/schemas/knowledge-link.schema";
export interface LinkerDeps {
articleRepo: {
findById: (id: string) => Promise<KnowledgeArticleDTO | null>;
findByEquipment: (o... | aucta | packages/ai/src/knowledge/compile/linker.ts | TypeScript | c53ace9fec734e531ad7f218c90d5d4978cdb98682d55c6dea57aee6f562b709 | 0 | 380 |
export const CONFIDENCE_ATTRIBUTION = {
unverified: "Based on unverified observation from a field session",
technician_reviewed: "Based on technician-confirmed procedure",
expert_approved: "Based on verified procedure",
manufacturer_sourced: "Per manufacturer documentation",
} as const;
export type ConfidenceL... | aucta | packages/ai/src/knowledge/core/constants.ts | TypeScript | 1054f5c6947a5299f2f2bc32ecb2308f467780a758f17ecc3ab8ec3f69bf4010 | 0 | 239 |
import type { ArticleCategory, ConfidenceLevel } from "@aucta/shared/schemas/knowledge-article.schema";
export interface KnowledgeSearchResult {
id: string;
title: string;
summary: string | null;
contentMd: string;
confidenceLevel: ConfidenceLevel;
equipmentBrand: string | null;
equipmentModel: string | ... | aucta | packages/ai/src/knowledge/core/types.ts | TypeScript | 23bdaea469c22b60698be50e28c55ae5341924e586dd835373502aa935601fee | 0 | 175 |
import { describe, it, expect, vi, beforeEach } from "vitest";
import type { HealthCheckDeps } from "./health-check.js";
import { runHealthCheck } from "./health-check.js";
const mockFindStaleArticles = vi.fn();
const mockFindCoverageGaps = vi.fn();
const mockFindConflictingArticles = vi.fn();
const deps: HealthCheck... | aucta | packages/ai/src/knowledge/health/health-check.test.ts | TypeScript | f1543f7e3f20278a104e346d4e7eda7430880cca41c9f38e1478e9adbda50363 | 0 | 758 |
import type { HealthCheckResult } from "../core/types.js";
const DEFAULT_STALE_DAYS = 90;
export interface HealthCheckDeps {
findStaleArticles: (
orgId: string,
staleDays: number,
) => Promise<
Array<{ id: string; title: string; updatedAt: Date | string }>
>;
findCoverageGaps: (
orgId: string,... | aucta | packages/ai/src/knowledge/health/health-check.ts | TypeScript | 72c841e8e1b77599484bd4d288cb5336a2b99f17bdaf86c38155f693adb36026 | 0 | 345 |
import { describe, it, expect, vi, beforeEach } from "vitest";
const { mockGenerateContent } = vi.hoisted(() => ({
mockGenerateContent: vi.fn(),
}));
vi.mock("@google/genai", () => ({
GoogleGenAI: class {
models = {
generateContent: mockGenerateContent,
};
},
}));
import {
extractLearnings,
t... | aucta | packages/ai/src/knowledge/ingest/session-ingester.test.ts | TypeScript | 442b5b53d4c141a78b9d1a4b307ade9b5c003d521d8fb7fa8cd171d44c901a69 | 0 | 896 |
([]);
});
it("returns empty array when Gemini text is undefined", async () => {
mockGenerateContent.mockResolvedValue({ text: undefined });
const result = await extractLearnings(baseInput, "test-api-key");
expect(result).toEqual([]);
});
it("includes findings and summary in the prom... | aucta | packages/ai/src/knowledge/ingest/session-ingester.test.ts | TypeScript | f0ffd3c47f665195be26004adde0b76614891f8160959ebe0a7f6017f23ec2f3 | 1 | 194 |
import { GoogleGenAI } from "@google/genai";
/**
* Plain interface for Inngest JSON serialization compatibility.
* Mirrors the shape from SessionRepository.findWithDetails() but uses
* primitive types only (no Date objects).
*/
export interface SessionIngestionInput {
session: {
id: string;
orgId: string... | aucta | packages/ai/src/knowledge/ingest/session-ingester.ts | TypeScript | 1dd2870da0948b3289d1c51df0b74cd8e5595a9606aa7f846ef4d5eb8c68bbf1 | 0 | 841 |
import { describe, it, expect } from "vitest";
import { getAttributionPhrase, buildKnowledgeContext } from "./context-builder.js";
import type { KnowledgeSearchResult } from "../core/types.js";
describe("getAttributionPhrase", () => {
it("returns correct phrase for manufacturer_sourced", () => {
expect(getAttrib... | aucta | packages/ai/src/knowledge/retrieve/context-builder.test.ts | TypeScript | 0fa98cd18a049c6d7ba296b22920b700354434da95e836a0ae7f5fdeca310aa2 | 0 | 859 |
import { CONFIDENCE_ATTRIBUTION } from "../core/constants.js";
import type { KnowledgeSearchResult } from "../core/types.js";
import type { PromptLayer } from "../../prompts/builder.js";
export function getAttributionPhrase(confidenceLevel: string): string {
return (
CONFIDENCE_ATTRIBUTION[
confidenceLevel... | aucta | packages/ai/src/knowledge/retrieve/context-builder.ts | TypeScript | eb40170c24311080b1848ff21df367fb2fa45c0f5f230691a1e4b1efc88543a4 | 0 | 312 |
import { describe, expect, it, vi, beforeEach } from "vitest";
import { GeminiEmbeddingService } from "./embeddings.js";
const mockEmbedContent = vi.fn();
vi.mock("@google/genai", () => {
return {
GoogleGenAI: class MockGoogleGenAI {
models = { embedContent: mockEmbedContent };
},
};
});
describe("... | aucta | packages/ai/src/knowledge/retrieve/embeddings.test.ts | TypeScript | 464be9f97676e6374ca35a9ea7595aff17253f9ec7be5109e861aa3070bb8c27 | 0 | 530 |
import { GoogleGenAI } from "@google/genai";
import { EMBEDDING_CONFIG } from "../core/constants.js";
export interface EmbeddingServiceConfig {
apiKey: string;
}
export class GeminiEmbeddingService {
private ai: GoogleGenAI;
constructor(config: EmbeddingServiceConfig) {
this.ai = new GoogleGenAI({ apiKey: ... | aucta | packages/ai/src/knowledge/retrieve/embeddings.ts | TypeScript | b44af9965686d54a60bec9d41a570ffceed9f72e975a2f6c29dae3620eade999 | 0 | 320 |
import { describe, expect, it, vi, beforeEach } from "vitest";
import { ensureCollection } from "./qdrant-client.js";
function createMockQdrantClient() {
return {
getCollections: vi.fn(),
createCollection: vi.fn().mockResolvedValue(undefined),
createPayloadIndex: vi.fn().mockResolvedValue(undefined),
}... | aucta | packages/ai/src/knowledge/retrieve/qdrant-client.test.ts | TypeScript | d1c7e37385a18ee892f40e50ba81cc8a4141c20c1a9e3032230f4eb87dbb4528 | 0 | 484 |
import { QdrantClient } from "@qdrant/js-client-rest";
import { QDRANT_CONFIG, EMBEDDING_CONFIG } from "../core/constants.js";
export interface QdrantClientConfig {
url: string;
apiKey?: string;
}
export function createQdrantClient(config: QdrantClientConfig): QdrantClient {
return new QdrantClient({
url: c... | aucta | packages/ai/src/knowledge/retrieve/qdrant-client.ts | TypeScript | 50370960bd74bd7853342a26d1f726932cfa4aa7aa84ebb832da3e0d9b1e7e58 | 0 | 304 |
import { describe, it, expect, vi, beforeEach } from "vitest";
import { hybridSearch, type HybridSearchDeps } from "./search.js";
import { QDRANT_CONFIG, CONFIDENCE_SCORE_BOOST } from "../core/constants.js";
function createMockDeps(): HybridSearchDeps {
return {
qdrantClient: {
query: vi.fn(),
} as any... | aucta | packages/ai/src/knowledge/retrieve/search.test.ts | TypeScript | ea329428622fed4d838917565296d848b474a458c22eb64b07955af719430e7b | 0 | 896 |
unverified observation from a field session",
});
});
it("returns empty array when Qdrant returns no points", async () => {
(deps.qdrantClient.query as ReturnType<typeof vi.fn>).mockResolvedValue({
points: [],
});
const results = await hybridSearch(deps, {
query: "nonexistent",
o... | aucta | packages/ai/src/knowledge/retrieve/search.test.ts | TypeScript | 997e47a62401b1bb4e12a0c89fe2b0769202b04ef13fbb53448e46900c36f557 | 1 | 896 |
content_md: "Some content",
confidence_level: "expert_approved",
equipment_brand: "Daikin",
equipment_model: "FTXM25",
procedure_type: null,
category: "equipment",
org_id: "org_test",
},
},
];
(deps.qdrantClient.query as ReturnType<typeo... | aucta | packages/ai/src/knowledge/retrieve/search.test.ts | TypeScript | 8c2b61835dd9743302839201aad3db69e795fe044b8dab01aeac73a431025b57 | 2 | 483 |
import type { QdrantClient } from "@qdrant/js-client-rest";
import type { GeminiEmbeddingService } from "./embeddings.js";
import type {
KnowledgeSearchResult,
KnowledgeSearchOptions,
} from "../core/types.js";
import { QDRANT_CONFIG, CONFIDENCE_SCORE_BOOST } from "../core/constants.js";
import { getAttributionPhra... | aucta | packages/ai/src/knowledge/retrieve/search.ts | TypeScript | 45adb9060efe25b87cdf8d4ec366caa177ca5fc980c3fe356c4b0cf7b55bb231 | 0 | 694 |
import { describe, it, expect } from "vitest";
import { buildEffectiveSystemPrompt } from "./builder.js";
import type { PromptLayer } from "./builder.js";
import { coreRolePrompt } from "./core.js";
import { hvacExpertisePrompt } from "./hvac-expertise.js";
import { safetyRulesPrompt } from "./safety.js";
describe("bu... | aucta | packages/ai/src/prompts/builder.test.ts | TypeScript | 76d3a39be60ab505443288ed333fa5f24082d989332d35ccd84d9c84acafdce7 | 0 | 896 |
{
expect(safetyRulesPrompt.content).toContain(
"does not replace professional training",
);
});
it("contains 'REFUSE' (D-06 refuse + redirect)", () => {
expect(safetyRulesPrompt.content).toContain("REFUSE");
});
it("contains 'low-GWP' (COMP-05 F-Gas alternatives)", () => {
expect(safetyR... | aucta | packages/ai/src/prompts/builder.test.ts | TypeScript | 8df9aed1fd01dbd1685ed475604cb71918c4ffdd1b15e4918423356ee391cfbe | 1 | 435 |
export interface PromptLayer {
id: string;
content: string;
required: boolean;
}
export function buildEffectiveSystemPrompt(layers: PromptLayer[]): string {
return layers
.filter((layer) => layer.content.trim().length > 0)
.map((layer) => layer.content.trim())
.join("\n\n---\n\n");
}
| aucta | packages/ai/src/prompts/builder.ts | TypeScript | eb5e1c2d7ca1f6db8b9a6ffa6b7fc34648f97e031040cdc632637f38ada76fc5 | 0 | 87 |
import type { PromptLayer } from "./builder.js";
export const coreRolePrompt: PromptLayer = {
id: "core-role",
content: `You are Aucta, an AI copilot for HVAC technicians. You provide real-time guidance during service, maintenance, and installation work.
IMPORTANT: You are an AI system, not a human expert. This i... | aucta | packages/ai/src/prompts/core.ts | TypeScript | 52c9002a09660315440bd18d10a6f47a12abaff8226de4baee772dea58b1b54a | 0 | 160 |
import type { PromptLayer } from "./builder.js";
export const hvacExpertisePrompt: PromptLayer = {
id: "hvac-expertise",
content: `HVAC DOMAIN KNOWLEDGE:
Diagnostic approach:
- Start with the most common cause, then work through possibilities systematically
- Ask the technician what they observe: sounds, smells, ... | aucta | packages/ai/src/prompts/hvac-expertise.ts | TypeScript | 52098f19c10ffcd16999201745889c97f08cfe83ea85839c5a5ca8a795ca6035 | 0 | 253 |
import type { PromptLayer } from "./builder.js";
export const safetyRulesPrompt: PromptLayer = {
id: "safety-rules",
content: `SAFETY RULES (always active):
1. ELECTRICAL WORK: When you see or the technician mentions electrical panels, wiring, or high-voltage components, remind about lockout/tagout procedures bef... | aucta | packages/ai/src/prompts/safety.ts | TypeScript | ad9732cd67b5221140980f34a42107e3bea3ded0b86fdcd7069129ddc047f4a6 | 0 | 314 |
import { describe, it, expect } from "vitest";
import { z } from "zod";
import { buildTool } from "./base.js";
import type { ToolContext } from "../types.js";
const testInputSchema = z.object({
manufacturer: z.string().describe("Equipment manufacturer name"),
errorCode: z.string().describe("The error code"),
});
... | aucta | packages/ai/src/tools/base.test.ts | TypeScript | 315bd0cadea8e36af14b078ee81a97f8cd0fabe8d09b91885fc536ca83c0b3b1 | 0 | 896 |
;
});
it("prompt() returns GeminiFunctionDeclaration with name, description, and parameters", () => {
const tool = createTestTool();
const declaration = tool.prompt();
expect(declaration.name).toBe("testTool");
expect(declaration.description).toBe("A test tool for unit tests");
expect(declarati... | aucta | packages/ai/src/tools/base.test.ts | TypeScript | c939dfda90be9132b0f3d0131ba1b35e981a1f4c3059332fb25d24c4eb54e77c | 1 | 324 |
import { z } from "zod";
import type {
ToolContext,
ToolResult,
GeminiFunctionDeclaration,
} from "../types.js";
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Required for heterogeneous tool collections (registry, dispatcher). Runtime safety is enforced by Zod validation in validateInput().
e... | aucta | packages/ai/src/tools/base.ts | TypeScript | 316abd7bc1843f4046399361535b3e7ab29d1b3b7e2ad162310dbb08cd81c58c | 0 | 479 |
import { describe, it, expect } from "vitest";
import { dispatchToolCalls, type ToolCallEvent } from "./dispatcher.js";
import { assembleToolPool } from "./registry.js";
import { buildTool } from "./base.js";
import { z } from "zod";
import type { ToolContext } from "../types.js";
const mockContext: ToolContext = {
... | aucta | packages/ai/src/tools/dispatcher.test.ts | TypeScript | 0caed8e87fb3184a260b5c01ee4e21fcc08c991a8e1aa409635e81e9eab52601 | 0 | 896 |
});
});
it("returns VALIDATION_ERROR for invalid input (D-12)", async () => {
const pool = assembleToolPool([createStrictTool()]);
const toolCall: ToolCallEvent = {
functionCalls: [
{ id: "call_3", name: "strict", args: { count: "not-a-number" } },
],
};
const result = await di... | aucta | packages/ai/src/tools/dispatcher.test.ts | TypeScript | 85dfdc4fcc80c2c21aa5df10695169403996450b625abb9ad6657a31ff512271 | 1 | 586 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.