mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-07 12:22:11 +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
|
|
@ -19,6 +19,27 @@
|
|||
import {
|
||||
NodeRuntime,
|
||||
} from "@effect/platform-node";
|
||||
import type {
|
||||
ProcessorConfig,
|
||||
FlowContext,
|
||||
FlowProcessorRuntime,
|
||||
AgentRequest,
|
||||
AgentResponse,
|
||||
TextCompletionRequest,
|
||||
TextCompletionResponse,
|
||||
GraphRagRequest,
|
||||
GraphRagResponse,
|
||||
DocumentRagRequest,
|
||||
DocumentRagResponse,
|
||||
TriplesQueryRequest,
|
||||
TriplesQueryResponse,
|
||||
ToolRequest,
|
||||
ToolResponse,
|
||||
EffectConfigHandler,
|
||||
FlowResourceNotFoundError,
|
||||
MessagingDeliveryError,
|
||||
Spec,
|
||||
} from "@trustgraph/base";
|
||||
import {
|
||||
makeFlowProcessor,
|
||||
makeConsumerSpec,
|
||||
|
|
@ -26,37 +47,19 @@ import {
|
|||
makeRequestResponseSpec,
|
||||
makeFlowProcessorProgram,
|
||||
errorMessage,
|
||||
type ProcessorConfig,
|
||||
type FlowContext,
|
||||
type FlowProcessorRuntime,
|
||||
type AgentRequest,
|
||||
type AgentResponse,
|
||||
type TextCompletionRequest,
|
||||
type TextCompletionResponse,
|
||||
type GraphRagRequest,
|
||||
type GraphRagResponse,
|
||||
type DocumentRagRequest,
|
||||
type DocumentRagResponse,
|
||||
type TriplesQueryRequest,
|
||||
type TriplesQueryResponse,
|
||||
type ToolRequest,
|
||||
type ToolResponse,
|
||||
type EffectConfigHandler,
|
||||
type FlowResourceNotFoundError,
|
||||
type MessagingDeliveryError,
|
||||
type Spec,
|
||||
} from "@trustgraph/base";
|
||||
import {Context, Effect, Layer, Match, Ref} from "effect";
|
||||
import * as O from "effect/Option";
|
||||
import * as Predicate from "effect/Predicate";
|
||||
import * as S from "effect/Schema";
|
||||
|
||||
import type {
|
||||
ExplainData,
|
||||
} from "./tools.js";
|
||||
import {
|
||||
createKnowledgeQueryTool,
|
||||
createDocumentQueryTool,
|
||||
createTriplesQueryTool,
|
||||
createMcpTool,
|
||||
type ExplainData,
|
||||
} from "./tools.js";
|
||||
import { buildReActPrompt } from "./prompt.js";
|
||||
import { filterToolsByGroupAndState } from "../tool-filter.js";
|
||||
|
|
@ -550,9 +553,9 @@ export function parseReActResponse(text: string): {
|
|||
const firstLine = trimmed.slice("Final Answer:".length).trim();
|
||||
const remainingLines = lines.slice(i + 1).join("\n").trim();
|
||||
finalAnswer =
|
||||
firstLine + (remainingLines.length > 0 ? "\n" + remainingLines : "");
|
||||
firstLine + (remainingLines.length > 0 ? `\n${remainingLines}` : "");
|
||||
break;
|
||||
} else if (trimmed.startsWith("Thought:")) {
|
||||
}if (trimmed.startsWith("Thought:")) {
|
||||
currentSection = "thought";
|
||||
const content = trimmed.slice("Thought:".length).trim();
|
||||
if (content.length > 0) {
|
||||
|
|
@ -577,14 +580,14 @@ export function parseReActResponse(text: string): {
|
|||
// Continuation line for current section
|
||||
Match.value(currentSection).pipe(
|
||||
Match.when("thought", () => {
|
||||
thought += "\n" + trimmed;
|
||||
thought += `\n${trimmed}`;
|
||||
}),
|
||||
Match.when("action", () => {
|
||||
// Action should be a single line (tool name), but handle multi-line
|
||||
action += " " + trimmed;
|
||||
action += ` ${trimmed}`;
|
||||
}),
|
||||
Match.when("action_input", () => {
|
||||
actionInput += "\n" + trimmed;
|
||||
actionInput += `\n${trimmed}`;
|
||||
}),
|
||||
Match.exhaustive,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue