framework-agents 0.1.0 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -810,7 +810,7 @@ interface ToolResult {
810
810
  interface Tool<TArgs = any, TOutput = any> {
811
811
  name: string;
812
812
  description: string;
813
- schema: z.ZodType<TArgs>;
813
+ schema: z.ZodType<TArgs, z.ZodTypeDef, any>;
814
814
  /** Optional second arg receives ToolContext (state + invocationState). */
815
815
  execute: (args: TArgs, ctx?: ToolContext) => Promise<TOutput>;
816
816
  /**
@@ -818,10 +818,26 @@ interface Tool<TArgs = any, TOutput = any> {
818
818
  * Default: JSON/string content, no artifact. Override to keep raw payloads
819
819
  * (retrieval metadata, debug blobs) out of the model's context.
820
820
  */
821
- toResult?: (output: any) => ToolResult;
821
+ toResult?: (output: TOutput) => ToolResult;
822
+ }
823
+ /**
824
+ * The defineTool() input: TSchema drives inference — `execute` receives the
825
+ * schema's INPUT type (the agent loop passes the model's RAW args; parse
826
+ * inside `execute` when you need strict validation — no manual generic
827
+ * annotations needed):
828
+ *
829
+ * defineTool({ schema: z.object({ city: z.string() }),
830
+ * execute: async ({ city }) => ... }) // city: string
831
+ */
832
+ interface ToolSpec<TSchema extends z.ZodTypeAny = z.ZodTypeAny, TOutput = unknown> {
833
+ name: string;
834
+ description: string;
835
+ schema: TSchema;
836
+ execute: (args: z.input<TSchema>, ctx?: ToolContext) => Promise<TOutput>;
837
+ toResult?: (output: TOutput) => ToolResult;
822
838
  }
823
839
  declare function defaultToResult(output: unknown): ToolResult;
824
- declare function defineTool<TArgs, TOutput>(tool: Tool<TArgs, TOutput>): Tool<TArgs, TOutput>;
840
+ declare function defineTool<TSchema extends z.ZodTypeAny = z.ZodTypeAny, TOutput = unknown>(tool: ToolSpec<TSchema, TOutput>): Tool<z.output<TSchema>, TOutput>;
825
841
  /** Validating registry — single place tools are looked up + arg-checked. */
826
842
  declare class ToolRegistry {
827
843
  private tools;
@@ -1613,7 +1629,7 @@ declare class A2AServer {
1613
1629
  * Frontend/server-component client for Framework agents.
1614
1630
  * Framework-agnostic (fetch + async iterators): use directly in TanStack
1615
1631
  * Query loaders, Next.js route handlers/components, Svelte, or plain DOM.
1616
- * React bindings live in @fabisch/react (thin layer over this client).
1632
+ * React bindings live in framework-agents-react (thin layer over this client).
1617
1633
  */
1618
1634
  interface AgentClientOptions {
1619
1635
  fetchFn?: typeof fetch;
@@ -1640,7 +1656,7 @@ declare class AgentClient {
1640
1656
  * `${endpoint}/stream`, so mount this at `app/api/agent/stream/route.ts` and
1641
1657
  * point `useAgent({ endpoint: "/api/agent" })` (or AgentClient) at the parent:
1642
1658
  *
1643
- * import { AgentClient, handleAgentRoute } from "@fabisch/agents";
1659
+ * import { AgentClient, handleAgentRoute } from "framework-agents";
1644
1660
  * const client = new AgentClient(process.env.AGENT_URL!);
1645
1661
  * export const POST = (req: Request) => handleAgentRoute(req, client);
1646
1662
  *
@@ -1900,8 +1916,8 @@ declare function retrievalTool(retriever: Retriever, opts?: {
1900
1916
  k?: number;
1901
1917
  name?: string;
1902
1918
  }): Tool<{
1919
+ k: number;
1903
1920
  query: string;
1904
- k?: number | undefined;
1905
1921
  }, ScoredDoc[]>;
1906
1922
  /** SPARQL-backed retriever: keyword match over the closure, rendered as text. */
1907
1923
  declare function sparqlRetriever(store: {
@@ -2356,8 +2372,8 @@ declare class EntityLinker {
2356
2372
  }
2357
2373
  /** link_entity agent tool: mention -> canonical IRIs with scores. */
2358
2374
  declare function linkEntityTool(linker: EntityLinker): Tool<{
2375
+ k: number;
2359
2376
  mention: string;
2360
- k?: number | undefined;
2361
2377
  }, LinkedEntity[]>;
2362
2378
  interface MappingProposal {
2363
2379
  id: string;
@@ -2725,7 +2741,7 @@ declare function sparqlSelectTool(store: GraphStore): Tool<{
2725
2741
  /** Ontology lookup: find classes/properties/labels matching a term. */
2726
2742
  declare function ontologyLookupTool(store: GraphStore): Tool<{
2727
2743
  term: string;
2728
- limit?: number | undefined;
2744
+ limit: number;
2729
2745
  }, {
2730
2746
  subject: string;
2731
2747
  predicate: string;
@@ -2839,4 +2855,4 @@ declare function estimateCostUsd(usage: {
2839
2855
  outputPerMillion: number;
2840
2856
  }): number;
2841
2857
 
2842
- export { A2AClient, type A2AClientOptions, A2AServer, type A2AServerOptions, Agent, type AgentCard, AgentClient, type AgentClientOptions, AgentError, type AgentEvents, type AgentId, type AgentMiddleware, type AgentOptions, type AgentResult, AgentState, type AnthropicOptions, AnthropicProvider, type AnyMcpClient, AudioBlockSchema, type BackoffOptions, type Brand, type Budget, type ChatMessage, ChatMessageSchema, type Checkpointer, type ClaimVerdict, ClearToolUsesEdit, type ClearToolUsesOptions, CompactedMemory, type CompactionOptions, type CompleteOptions, type ConformanceCheck, type ConformanceReport, type ConformanceResult, type ConsoleEventsOptions, ConsoleSpanSink, type ContentBlock, ContentBlockSchema, type ConversationManager, type DoneEvent, EntityLinker, type EvalCase, type EvalExpect, type EvalScore, type ExecutedToolCall, FileBlockSchema, FileCheckpointer, FileMemory, type FrameworkConfig, type FrameworkFile, FrameworkFileSchema, GraphMemory, type GraphRule, type GraphStore, type HandoffSignal, type HitlDecideRequest, type HitlDecision, HitlInterrupt, type HookContext, type ImageBlock, ImageBlockSchema, InMemoryGraphStore, InMemoryMemory, InMemoryRetriever, InMemoryStorage, type InvocationState, JSONLD_PREFIXES, JsonlSpanSink, LABEL_PREDICATES, type LinkedEntity, type LoadedFrameworkFile, LocalFileStorage, type MappingDecision, type MappingProposal, MappingProposals, type MappingProposalsOptions, type McpClient, type McpClientOptions, McpHttpClient, McpStdioClient, type McpToolDef, type Memory, MemorySpanSink, type MigrationReport, type MigrationResult, MockModelProvider, type ModelCapability, type ModelCompletion, type ModelPrice, type ModelProvider, type ModelRequest, type NodeShape, NonStandardBlockSchema, NullConversationManager, OWL_VOCAB, type OllamaOptions, OllamaProvider, type OntologyReview, type OpenAICompatibleOptions, OpenAICompatibleProvider, type OrchestratedResult, type OrchestrationPlan, type OrchestrationStrategy, type OutputVersion, type PIIDetector, type PIIMatch, type PIIStrategy, type PatternBinding, type PromptTemplate, type PropertyShape, type Quad, type ReasoningBlock, ReasoningBlockSchema, RemoteSparqlAdapter, type RemoteSparqlOptions, type ResolvedAgentDef, type ResponseFormat, type ResponseFormatWire, type ResponseStrategy, type Result, type Retriever, type RetryFilter, type RetryMiddlewareOptions, type RunId, type RunOptions, type SandboxBackend, type SandboxOptions, type ScoredDoc, type ServedAgent, SessionManager, type SessionManagerOptions, type ShapeInductionOptions, type ShapeReport, type Skill, type SkillLoaderOptions, SkillRegistry, SlidingWindowConversationManager, type SlidingWindowOptions, type Snapshot, type SnapshotData, type SnapshotField, type Span, type SpanSink, type SparqlAuth, type SparqlRow, type SparqlSelect, type StepEvent, type Storage, type StoreOptions, type StreamEvent, SummarizingConversationManager, type SummarizingOptions, Swarm, type SwarmOptions, type SwarmResult, type SwarmStatus, type SwarmStreamEvent, TBOX_PREDICATES, type TBoxMigrationSpec, type TakeSnapshotOptions, type TermStat, type TextBlock, TextBlockSchema, type ThreadCheckpoint, type TimelineEntry, type TodoItem, type TokenBudgets, type TokenUsage, type Tool, ToolCallBlockSchema, type ToolCallEvent, type ToolCallRef, type ToolCallRequest, type ToolContext, type ToolName, ToolRegistry, ToolRejection, type ToolResult, type ToolResultEvent, type TriplePattern, TurtleQuadSchema, type WorkflowNode, type WorkflowOptions, __resetConfig, a2aAsTool, abPrompts, adoptShapes, assertCanHandle, assistant, backoffDelayMs, buildServedAgent, claimCheckTool, collectStream, connectMcpHttp, connectMcpStdio, consoleEvents, contextEditingMiddleware, createMiddleware, createSandboxBackend, createSubAgentMiddleware, defaultSummarize, defaultToResult, definePrompt, defineTool, deserializeMessages, discoverSkills, estimateCostUsd, estimateTokens, executeSelect, filesystemMiddleware, filesystemTools, getRetryable, graphAddTool, handleAgentRoute, hasImages, historyTokens, hitlKey, humanInTheLoopMiddleware, imagesOf, initChatModel, instantiate, jsonSchemaToZod, jsonldToQuads, linkEntityTool, llmToolSelectorMiddleware, loadConfig, loadEnvFile, loadFrameworkConfig, loadJsonl, loadPromptFile, loadSkillsInto, logError, matchGlob, matchPatterns, matchSkills, mcpToolsToFramework, messageTokens, migrateTBox, modelCallLimit, modelFallbackMiddleware, modelRetryMiddleware, ollama, ontologyLookupTool, parseSelect, parseSkillFile, parseStructured, piiMiddleware, policyFilterMiddleware, priceFor, printReport, proposeMappingTool, proposeShapes, proposeShapesTool, providerFromEnv, providerStrategy, quadsToJsonLd, readHandoffSignal, remoteSparqlTool, responseFormatJsonSchema, responseFormatName, retrievalTool, reviewOntology, reviewOntologyTool, runConformance, runEval, runJavascriptTool, runOrchestrated, runWithBudget, runWorkflow, scoreSkills, selectSnapshotFields, serializeMessages, serveFramework, sleep, sparqlRetriever, sparqlSelectTool, stampRetryable, summarizationMiddleware, supportsColor, supportsVision, system, textOf, todoListMiddleware, tokenize, toolCallLimitMiddleware, toolEmulatorMiddleware, toolResult, toolRetry, toolRetryMiddleware, toolStrategy, tracingEvents, trimDangling, usageCost, user, wireTextOf, withFileLock };
2858
+ export { A2AClient, type A2AClientOptions, A2AServer, type A2AServerOptions, Agent, type AgentCard, AgentClient, type AgentClientOptions, AgentError, type AgentEvents, type AgentId, type AgentMiddleware, type AgentOptions, type AgentResult, AgentState, type AnthropicOptions, AnthropicProvider, type AnyMcpClient, AudioBlockSchema, type BackoffOptions, type Brand, type Budget, type ChatMessage, ChatMessageSchema, type Checkpointer, type ClaimVerdict, ClearToolUsesEdit, type ClearToolUsesOptions, CompactedMemory, type CompactionOptions, type CompleteOptions, type ConformanceCheck, type ConformanceReport, type ConformanceResult, type ConsoleEventsOptions, ConsoleSpanSink, type ContentBlock, ContentBlockSchema, type ConversationManager, type DoneEvent, EntityLinker, type EvalCase, type EvalExpect, type EvalScore, type ExecutedToolCall, FileBlockSchema, FileCheckpointer, FileMemory, type FrameworkConfig, type FrameworkFile, FrameworkFileSchema, GraphMemory, type GraphRule, type GraphStore, type HandoffSignal, type HitlDecideRequest, type HitlDecision, HitlInterrupt, type HookContext, type ImageBlock, ImageBlockSchema, InMemoryGraphStore, InMemoryMemory, InMemoryRetriever, InMemoryStorage, type InvocationState, JSONLD_PREFIXES, JsonlSpanSink, LABEL_PREDICATES, type LinkedEntity, type LoadedFrameworkFile, LocalFileStorage, type MappingDecision, type MappingProposal, MappingProposals, type MappingProposalsOptions, type McpClient, type McpClientOptions, McpHttpClient, McpStdioClient, type McpToolDef, type Memory, MemorySpanSink, type MigrationReport, type MigrationResult, MockModelProvider, type ModelCapability, type ModelCompletion, type ModelPrice, type ModelProvider, type ModelRequest, type NodeShape, NonStandardBlockSchema, NullConversationManager, OWL_VOCAB, type OllamaOptions, OllamaProvider, type OntologyReview, type OpenAICompatibleOptions, OpenAICompatibleProvider, type OrchestratedResult, type OrchestrationPlan, type OrchestrationStrategy, type OutputVersion, type PIIDetector, type PIIMatch, type PIIStrategy, type PatternBinding, type PromptTemplate, type PropertyShape, type Quad, type ReasoningBlock, ReasoningBlockSchema, RemoteSparqlAdapter, type RemoteSparqlOptions, type ResolvedAgentDef, type ResponseFormat, type ResponseFormatWire, type ResponseStrategy, type Result, type Retriever, type RetryFilter, type RetryMiddlewareOptions, type RunId, type RunOptions, type SandboxBackend, type SandboxOptions, type ScoredDoc, type ServedAgent, SessionManager, type SessionManagerOptions, type ShapeInductionOptions, type ShapeReport, type Skill, type SkillLoaderOptions, SkillRegistry, SlidingWindowConversationManager, type SlidingWindowOptions, type Snapshot, type SnapshotData, type SnapshotField, type Span, type SpanSink, type SparqlAuth, type SparqlRow, type SparqlSelect, type StepEvent, type Storage, type StoreOptions, type StreamEvent, SummarizingConversationManager, type SummarizingOptions, Swarm, type SwarmOptions, type SwarmResult, type SwarmStatus, type SwarmStreamEvent, TBOX_PREDICATES, type TBoxMigrationSpec, type TakeSnapshotOptions, type TermStat, type TextBlock, TextBlockSchema, type ThreadCheckpoint, type TimelineEntry, type TodoItem, type TokenBudgets, type TokenUsage, type Tool, ToolCallBlockSchema, type ToolCallEvent, type ToolCallRef, type ToolCallRequest, type ToolContext, type ToolName, ToolRegistry, ToolRejection, type ToolResult, type ToolResultEvent, type ToolSpec, type TriplePattern, TurtleQuadSchema, type WorkflowNode, type WorkflowOptions, __resetConfig, a2aAsTool, abPrompts, adoptShapes, assertCanHandle, assistant, backoffDelayMs, buildServedAgent, claimCheckTool, collectStream, connectMcpHttp, connectMcpStdio, consoleEvents, contextEditingMiddleware, createMiddleware, createSandboxBackend, createSubAgentMiddleware, defaultSummarize, defaultToResult, definePrompt, defineTool, deserializeMessages, discoverSkills, estimateCostUsd, estimateTokens, executeSelect, filesystemMiddleware, filesystemTools, getRetryable, graphAddTool, handleAgentRoute, hasImages, historyTokens, hitlKey, humanInTheLoopMiddleware, imagesOf, initChatModel, instantiate, jsonSchemaToZod, jsonldToQuads, linkEntityTool, llmToolSelectorMiddleware, loadConfig, loadEnvFile, loadFrameworkConfig, loadJsonl, loadPromptFile, loadSkillsInto, logError, matchGlob, matchPatterns, matchSkills, mcpToolsToFramework, messageTokens, migrateTBox, modelCallLimit, modelFallbackMiddleware, modelRetryMiddleware, ollama, ontologyLookupTool, parseSelect, parseSkillFile, parseStructured, piiMiddleware, policyFilterMiddleware, priceFor, printReport, proposeMappingTool, proposeShapes, proposeShapesTool, providerFromEnv, providerStrategy, quadsToJsonLd, readHandoffSignal, remoteSparqlTool, responseFormatJsonSchema, responseFormatName, retrievalTool, reviewOntology, reviewOntologyTool, runConformance, runEval, runJavascriptTool, runOrchestrated, runWithBudget, runWorkflow, scoreSkills, selectSnapshotFields, serializeMessages, serveFramework, sleep, sparqlRetriever, sparqlSelectTool, stampRetryable, summarizationMiddleware, supportsColor, supportsVision, system, textOf, todoListMiddleware, tokenize, toolCallLimitMiddleware, toolEmulatorMiddleware, toolResult, toolRetry, toolRetryMiddleware, toolStrategy, tracingEvents, trimDangling, usageCost, user, wireTextOf, withFileLock };
package/dist/index.js CHANGED
@@ -71,7 +71,7 @@ import {
71
71
  usageCost,
72
72
  user,
73
73
  wireTextOf
74
- } from "./chunk-77OZE2QD.js";
74
+ } from "./chunk-VIGLIWEY.js";
75
75
 
76
76
  // src/config/index.ts
77
77
  import { existsSync } from "fs";
@@ -2246,7 +2246,7 @@ var McpHttpClient = class {
2246
2246
  this.serverId = opts.serverId ?? url;
2247
2247
  this.headers = opts.headers ?? {};
2248
2248
  this.fetchFn = opts.fetchFn ?? fetch;
2249
- this.clientName = opts.clientName ?? "fabisch-agents";
2249
+ this.clientName = opts.clientName ?? "framework-agents";
2250
2250
  }
2251
2251
  async rpc(method, params) {
2252
2252
  return this.rpcInner(method, params, true);
@@ -2317,7 +2317,7 @@ var McpStdioClient = class {
2317
2317
  this.command = command;
2318
2318
  this.args = args;
2319
2319
  this.serverId = opts.serverId ?? `${command} ${args.join(" ")}`.trim();
2320
- this.clientName = opts.clientName ?? "fabisch-agents";
2320
+ this.clientName = opts.clientName ?? "framework-agents";
2321
2321
  }
2322
2322
  command;
2323
2323
  args;
@@ -3064,7 +3064,7 @@ async function migrateTBox(oldStore, spec, opts = {}) {
3064
3064
  rules: spec.rules ?? oldStore.ontologyRules()
3065
3065
  });
3066
3066
  const explicit = (await oldStore.match(null, null, null)).filter((q) => q.source !== "entailment");
3067
- const tboxGraph = opts.tboxGraph === false ? void 0 : opts.tboxGraph ?? `urn:fabisch:ontology:${spec.to}`;
3067
+ const tboxGraph = opts.tboxGraph === false ? void 0 : opts.tboxGraph ?? `urn:framework:ontology:${spec.to}`;
3068
3068
  report.tboxGraph = tboxGraph;
3069
3069
  const isAxiom = (q, predicatesInUse2) => {
3070
3070
  if (TBOX_PREDICATES.has(q.predicate)) return true;