mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-01 17:39:39 +02:00
feat(ts): add real quality gates — Biome lint + effect-law ratchet + class inventory
- biome.json (2.4.16, linter-only) wired as "lint" in all six packages - scripts/check-effect-laws.ts: Effect-native law enforcement encoding the adapted beep-effect effect-first/schema-first laws (no native JSON/switch/ sort/fetch/timers, no process.env, no throw new, no Effect.run* outside boundaries, no Schema-suffixed constants, no node:fs/path, AST-based pure-data interface detection per law 38/39) - ratcheting baseline allowlist (95 entries / 290 findings) that must shrink to documented exemptions only; stale counts fail the gate - root lint chains turbo lint + law check + native-class inventory - fix all 163 initial Biome findings: import-type style, templates, two `any`s, ten non-null assertions (librarian getService gate, A.matchRight in atoms, ensureNode returning nodes, main.tsx mount guard) Gates: lint, check:tsgo, build, test (force, 11 tasks) all green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
cf12defcd8
commit
0746d7ffd5
109 changed files with 951 additions and 611 deletions
|
|
@ -10,16 +10,22 @@
|
|||
|
||||
import { AzureOpenAI } from "openai";
|
||||
import { NodeRuntime } from "@effect/platform-node";
|
||||
import type {
|
||||
Llm,
|
||||
LlmProvider,
|
||||
ProcessorConfig,
|
||||
LlmResult,
|
||||
} from "@trustgraph/base";
|
||||
import {
|
||||
makeLlmService,
|
||||
makeFlowProcessorProgram,
|
||||
makeLlmSpecs,
|
||||
type Llm,
|
||||
type LlmProvider,
|
||||
type ProcessorConfig,
|
||||
type LlmResult,
|
||||
} from "@trustgraph/base";
|
||||
import { Effect, Stream } from "effect";
|
||||
import type {
|
||||
TextCompletionConfigError,
|
||||
TextCompletionRuntimeError,
|
||||
} from "./common.ts";
|
||||
import {
|
||||
llmStreamPart,
|
||||
makeTextCompletionLayer,
|
||||
|
|
@ -27,8 +33,6 @@ import {
|
|||
providerStatusError,
|
||||
requiredString,
|
||||
streamTextCompletionChunks,
|
||||
type TextCompletionConfigError,
|
||||
type TextCompletionRuntimeError,
|
||||
} from "./common.ts";
|
||||
|
||||
export type AzureOpenAIProcessorConfig = ProcessorConfig & {
|
||||
|
|
|
|||
|
|
@ -6,23 +6,27 @@
|
|||
|
||||
import { AnthropicClient, AnthropicLanguageModel } from "@effect/ai-anthropic";
|
||||
import { NodeRuntime } from "@effect/platform-node";
|
||||
import type {
|
||||
Llm,
|
||||
LlmProvider,
|
||||
ProcessorConfig,
|
||||
} from "@trustgraph/base";
|
||||
import {
|
||||
makeLlmService,
|
||||
makeFlowProcessorProgram,
|
||||
makeLlmSpecs,
|
||||
type Llm,
|
||||
type LlmProvider,
|
||||
type ProcessorConfig,
|
||||
} from "@trustgraph/base";
|
||||
import { Effect, Layer, Redacted } from "effect";
|
||||
import { FetchHttpClient } from "effect/unstable/http";
|
||||
import type {
|
||||
TextCompletionConfigError,
|
||||
TextCompletionRuntimeError,
|
||||
} from "./common.ts";
|
||||
import {
|
||||
makeLanguageModelProvider,
|
||||
makeTextCompletionLayer,
|
||||
optionalStringConfig,
|
||||
requiredString,
|
||||
type TextCompletionConfigError,
|
||||
type TextCompletionRuntimeError,
|
||||
} from "./common.ts";
|
||||
|
||||
export type ClaudeProcessorConfig = ProcessorConfig & {
|
||||
|
|
|
|||
|
|
@ -1,18 +1,22 @@
|
|||
import type {
|
||||
LlmChunk,
|
||||
LlmResult,
|
||||
LlmProvider,
|
||||
} from "@trustgraph/base";
|
||||
import {
|
||||
Llm,
|
||||
TooManyRequestsError,
|
||||
errorMessage,
|
||||
makeLlmServiceShape,
|
||||
type LlmChunk,
|
||||
type LlmResult,
|
||||
type LlmProvider,
|
||||
} from "@trustgraph/base";
|
||||
import { Config, Context, Effect, Layer, Match, Ref, Result, Stream } from "effect";
|
||||
import type { Context, } from "effect";
|
||||
import { Config, Effect, Layer, Match, Ref, Result, Stream } from "effect";
|
||||
import * as O from "effect/Option";
|
||||
import * as Predicate from "effect/Predicate";
|
||||
import * as S from "effect/Schema";
|
||||
import type * as Scope from "effect/Scope";
|
||||
import { AiError, LanguageModel, Prompt, Response } from "effect/unstable/ai";
|
||||
import type { LanguageModel, Prompt, Response } from "effect/unstable/ai";
|
||||
import { AiError, } from "effect/unstable/ai";
|
||||
|
||||
export class TextCompletionConfigError extends S.TaggedErrorClass<TextCompletionConfigError>()(
|
||||
"TextCompletionConfigError",
|
||||
|
|
|
|||
|
|
@ -8,16 +8,22 @@
|
|||
|
||||
import { Mistral } from "@mistralai/mistralai";
|
||||
import { NodeRuntime } from "@effect/platform-node";
|
||||
import type {
|
||||
Llm,
|
||||
LlmProvider,
|
||||
ProcessorConfig,
|
||||
LlmResult,
|
||||
} from "@trustgraph/base";
|
||||
import {
|
||||
makeLlmService,
|
||||
makeFlowProcessorProgram,
|
||||
makeLlmSpecs,
|
||||
type Llm,
|
||||
type LlmProvider,
|
||||
type ProcessorConfig,
|
||||
type LlmResult,
|
||||
} from "@trustgraph/base";
|
||||
import { Effect, Stream } from "effect";
|
||||
import type {
|
||||
TextCompletionConfigError,
|
||||
TextCompletionRuntimeError,
|
||||
} from "./common.ts";
|
||||
import {
|
||||
llmStreamPart,
|
||||
makeTextCompletionLayer,
|
||||
|
|
@ -26,8 +32,6 @@ import {
|
|||
requiredString,
|
||||
streamTextCompletionChunks,
|
||||
textFromContent,
|
||||
type TextCompletionConfigError,
|
||||
type TextCompletionRuntimeError,
|
||||
} from "./common.ts";
|
||||
|
||||
export type MistralProcessorConfig = ProcessorConfig & {
|
||||
|
|
|
|||
|
|
@ -8,24 +8,28 @@
|
|||
|
||||
import { Ollama } from "ollama";
|
||||
import { NodeRuntime } from "@effect/platform-node";
|
||||
import type {
|
||||
Llm,
|
||||
LlmProvider,
|
||||
ProcessorConfig,
|
||||
LlmResult,
|
||||
} from "@trustgraph/base";
|
||||
import {
|
||||
makeLlmService,
|
||||
makeFlowProcessorProgram,
|
||||
makeLlmSpecs,
|
||||
type Llm,
|
||||
type LlmProvider,
|
||||
type ProcessorConfig,
|
||||
type LlmResult,
|
||||
} from "@trustgraph/base";
|
||||
import { Effect, Stream } from "effect";
|
||||
import type {
|
||||
TextCompletionConfigError,
|
||||
TextCompletionRuntimeError,
|
||||
} from "./common.ts";
|
||||
import {
|
||||
llmStreamPart,
|
||||
makeTextCompletionLayer,
|
||||
optionalStringConfig,
|
||||
providerRuntimeError,
|
||||
streamTextCompletionChunks,
|
||||
type TextCompletionConfigError,
|
||||
type TextCompletionRuntimeError,
|
||||
} from "./common.ts";
|
||||
|
||||
export type OllamaProcessorConfig = ProcessorConfig & {
|
||||
|
|
@ -68,7 +72,7 @@ const makeOllamaProviderFromClient = (
|
|||
_temperature?: number,
|
||||
) => {
|
||||
const modelName = model ?? defaultModel;
|
||||
const fullPrompt = system + "\n\n" + prompt;
|
||||
const fullPrompt = `${system}\n\n${prompt}`;
|
||||
|
||||
return Effect.tryPromise({
|
||||
try: () =>
|
||||
|
|
@ -95,7 +99,7 @@ const makeOllamaProviderFromClient = (
|
|||
_temperature?: number,
|
||||
) => {
|
||||
const modelName = model ?? defaultModel;
|
||||
const fullPrompt = system + "\n\n" + prompt;
|
||||
const fullPrompt = `${system}\n\n${prompt}`;
|
||||
|
||||
return Stream.fromEffect(
|
||||
Effect.tryPromise({
|
||||
|
|
|
|||
|
|
@ -11,16 +11,22 @@
|
|||
|
||||
import OpenAI from "openai";
|
||||
import { NodeRuntime } from "@effect/platform-node";
|
||||
import type {
|
||||
Llm,
|
||||
LlmProvider,
|
||||
ProcessorConfig,
|
||||
LlmResult,
|
||||
} from "@trustgraph/base";
|
||||
import {
|
||||
makeLlmService,
|
||||
makeFlowProcessorProgram,
|
||||
makeLlmSpecs,
|
||||
type Llm,
|
||||
type LlmProvider,
|
||||
type ProcessorConfig,
|
||||
type LlmResult,
|
||||
} from "@trustgraph/base";
|
||||
import { Effect, Stream } from "effect";
|
||||
import type {
|
||||
TextCompletionConfigError,
|
||||
TextCompletionRuntimeError,
|
||||
} from "./common.ts";
|
||||
import {
|
||||
llmStreamPart,
|
||||
makeTextCompletionLayer,
|
||||
|
|
@ -28,8 +34,6 @@ import {
|
|||
providerStatusError,
|
||||
requiredString,
|
||||
streamTextCompletionChunks,
|
||||
type TextCompletionConfigError,
|
||||
type TextCompletionRuntimeError,
|
||||
} from "./common.ts";
|
||||
|
||||
export type OpenAICompatibleProcessorConfig = ProcessorConfig & {
|
||||
|
|
|
|||
|
|
@ -6,16 +6,22 @@
|
|||
|
||||
import OpenAI from "openai";
|
||||
import { NodeRuntime } from "@effect/platform-node";
|
||||
import type {
|
||||
Llm,
|
||||
LlmProvider,
|
||||
ProcessorConfig,
|
||||
LlmResult,
|
||||
} from "@trustgraph/base";
|
||||
import {
|
||||
makeLlmService,
|
||||
makeFlowProcessorProgram,
|
||||
makeLlmSpecs,
|
||||
type Llm,
|
||||
type LlmProvider,
|
||||
type ProcessorConfig,
|
||||
type LlmResult,
|
||||
} from "@trustgraph/base";
|
||||
import { Effect, Stream } from "effect";
|
||||
import type {
|
||||
TextCompletionConfigError,
|
||||
TextCompletionRuntimeError,
|
||||
} from "./common.ts";
|
||||
import {
|
||||
llmStreamPart,
|
||||
makeTextCompletionLayer,
|
||||
|
|
@ -23,8 +29,6 @@ import {
|
|||
providerStatusError,
|
||||
requiredString,
|
||||
streamTextCompletionChunks,
|
||||
type TextCompletionConfigError,
|
||||
type TextCompletionRuntimeError,
|
||||
} from "./common.ts";
|
||||
|
||||
export type OpenAIProcessorConfig = ProcessorConfig & {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue