@uibot/agents 0.0.0-stage → 0.2.1
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/agent-fs-source.d.ts +11 -0
- package/dist/agent-loader.d.ts +13 -0
- package/dist/agent-registry.d.ts +12 -0
- package/dist/context-tools.d.ts +23 -0
- package/dist/create-agent.d.ts +33 -0
- package/dist/execution-tools.d.ts +30 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +1520 -0
- package/dist/model-factory.d.ts +41 -0
- package/dist/playground-tools.d.ts +2 -0
- package/dist/run-agent.d.ts +43 -0
- package/dist/skill-registry.d.ts +21 -0
- package/dist/types.d.ts +38 -0
- package/package.json +47 -4
- package/README.md +0 -3
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Agent } from "@uibot/contracts";
|
|
2
|
+
/**
|
|
3
|
+
* Scan `<rootDir>/.uibot/agents/` for `*.md` files and load each as an `Agent`.
|
|
4
|
+
* Skips files that fail to parse (logs a warning) rather than crashing.
|
|
5
|
+
*/
|
|
6
|
+
export declare function scanAgentsDir(rootDir: string): Agent[];
|
|
7
|
+
/**
|
|
8
|
+
* Load all agent definitions from the filesystem into a simple `AgentRegistry`-compatible map.
|
|
9
|
+
* Returns an array; pass to `createAgentRegistry` as `definitions`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function loadAgentsFromFs(rootDir: string): Agent[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Agent, AgentFrontmatter } from "@uibot/contracts";
|
|
2
|
+
/** Parse and validate an agent `.md` frontmatter block. */
|
|
3
|
+
export declare function parseAgentFrontmatter(raw: string): AgentFrontmatter;
|
|
4
|
+
/** Error thrown when an agent file cannot be loaded or parsed. */
|
|
5
|
+
export declare class AgentLoadError extends Error {
|
|
6
|
+
readonly filePath: string;
|
|
7
|
+
constructor(message: string, filePath: string);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Load and parse a single agent `.md` file.
|
|
11
|
+
* Throws `AgentLoadError` if the file is missing frontmatter or required fields.
|
|
12
|
+
*/
|
|
13
|
+
export declare function loadAgentFile(filePath: string): Agent;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Agent, AgentRegistry } from "@uibot/contracts";
|
|
2
|
+
import type { ModelFactory } from "./model-factory.js";
|
|
3
|
+
import type { ChatOpenAI } from "@langchain/openai";
|
|
4
|
+
export interface UIBotAgentRegistry extends AgentRegistry {
|
|
5
|
+
/** Resolve the LLM instance for the given agent definition. */
|
|
6
|
+
resolveModel(agent: Agent): ChatOpenAI;
|
|
7
|
+
}
|
|
8
|
+
export interface CreateAgentRegistryOptions {
|
|
9
|
+
definitions: Agent[];
|
|
10
|
+
modelFactory: ModelFactory;
|
|
11
|
+
}
|
|
12
|
+
export declare function createAgentRegistry(options: CreateAgentRegistryOptions): UIBotAgentRegistry;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ContextFragment, ContextIndexStatus, ContextKind } from "@uibot/context";
|
|
2
|
+
export interface AgentContextIndexOptions {
|
|
3
|
+
includeExtensions?: string[];
|
|
4
|
+
maxFileSizeBytes?: number;
|
|
5
|
+
maxFiles?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface AgentContextSearchOptions {
|
|
8
|
+
query: string;
|
|
9
|
+
kinds?: ContextKind[];
|
|
10
|
+
maxFragments?: number;
|
|
11
|
+
maxTokens?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface AgentContextSearchResult {
|
|
14
|
+
fragments: ContextFragment[];
|
|
15
|
+
status: ContextIndexStatus;
|
|
16
|
+
}
|
|
17
|
+
export interface AgentContextService {
|
|
18
|
+
indexCodebase(options?: AgentContextIndexOptions): Promise<ContextIndexStatus>;
|
|
19
|
+
searchContext(options: AgentContextSearchOptions): Promise<AgentContextSearchResult>;
|
|
20
|
+
clearContextIndex(): Promise<void>;
|
|
21
|
+
contextStatus(): Promise<ContextIndexStatus>;
|
|
22
|
+
}
|
|
23
|
+
export declare function createContextTools(service: AgentContextService): unknown[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { BaseMessage } from "@langchain/core/messages";
|
|
2
|
+
import type { Agent, Skill } from "@uibot/contracts";
|
|
3
|
+
import type { ChatOpenAI } from "@langchain/openai";
|
|
4
|
+
/**
|
|
5
|
+
* Minimal interface for a deep agent as used by runAgent.
|
|
6
|
+
* Kept narrow to avoid exposing complex LangGraph generics in our public API.
|
|
7
|
+
*/
|
|
8
|
+
export interface UIBotDeepAgent {
|
|
9
|
+
streamEvents(input: {
|
|
10
|
+
messages: BaseMessage[];
|
|
11
|
+
}, options: Record<string, unknown>): AsyncIterable<Record<string, unknown>>;
|
|
12
|
+
}
|
|
13
|
+
export interface CreateUIBotAgentOptions {
|
|
14
|
+
agent: Agent;
|
|
15
|
+
model: ChatOpenAI;
|
|
16
|
+
/** Skills to inject into the system prompt for this agent's run. */
|
|
17
|
+
skills?: Skill[];
|
|
18
|
+
tools?: unknown[];
|
|
19
|
+
/** When provided, replaces the agent definition's system prompt entirely. */
|
|
20
|
+
systemPromptOverride?: string;
|
|
21
|
+
/** Runtime prompt context appended after registry skills. */
|
|
22
|
+
additionalContext?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build a DeepAgent from a UIBot Agent definition.
|
|
26
|
+
*
|
|
27
|
+
* Selected skills are injected into the system prompt via a markdown section.
|
|
28
|
+
* deepagents' filesystem-based `createSkillsMiddleware` is an opt-in upgrade
|
|
29
|
+
* for when a full FilesystemBackend is available.
|
|
30
|
+
*/
|
|
31
|
+
export declare function createUIBotAgent(options: CreateUIBotAgentOptions): UIBotDeepAgent;
|
|
32
|
+
/** Combine agent system prompt with selected skills as a markdown section. */
|
|
33
|
+
export declare function buildSystemPrompt(agent: Agent, skills?: Skill[]): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ExecutionLanguage, ExecutionRuntime } from "@uibot/contracts";
|
|
2
|
+
export interface ExecutionToolAuditEvent {
|
|
3
|
+
phase: "start" | "end";
|
|
4
|
+
toolName: "run_code";
|
|
5
|
+
language: ExecutionLanguage | string;
|
|
6
|
+
codeHash: string;
|
|
7
|
+
codeBytes: number;
|
|
8
|
+
timeoutMs: number;
|
|
9
|
+
fetchAllowed: boolean;
|
|
10
|
+
envKeys: string[];
|
|
11
|
+
rejectedEnvKeys: string[];
|
|
12
|
+
success?: boolean;
|
|
13
|
+
errorCode?: string | undefined;
|
|
14
|
+
durationMs?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface CreateExecutionToolsOptions {
|
|
17
|
+
allowedLanguages?: ExecutionLanguage[];
|
|
18
|
+
envAllowlist?: string[];
|
|
19
|
+
allowFetch?: boolean;
|
|
20
|
+
defaultTimeoutMs?: number;
|
|
21
|
+
maxTimeoutMs?: number;
|
|
22
|
+
audit?: (event: ExecutionToolAuditEvent) => void | Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Maximum length of the code field, in UTF-8 bytes. Defaults to 64 KiB.
|
|
25
|
+
* Larger payloads are rejected before reaching the runtime — a useful
|
|
26
|
+
* upstream guard against runaway prompts. Set explicitly to override.
|
|
27
|
+
*/
|
|
28
|
+
maxCodeBytes?: number;
|
|
29
|
+
}
|
|
30
|
+
export declare function createExecutionTools(runtime: ExecutionRuntime, options?: CreateExecutionToolsOptions): unknown[];
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type { AgentStreamEvent } from "./types.js";
|
|
2
|
+
export { loadAgentFile, parseAgentFrontmatter, AgentLoadError } from "./agent-loader.js";
|
|
3
|
+
export { scanAgentsDir, loadAgentsFromFs } from "./agent-fs-source.js";
|
|
4
|
+
export { createModelFactory, type ModelFactory, type ModelFactoryOptions, } from "./model-factory.js";
|
|
5
|
+
export { createAgentRegistry, type UIBotAgentRegistry, type CreateAgentRegistryOptions, } from "./agent-registry.js";
|
|
6
|
+
export { createSkillRegistry, type UIBotSkillRegistry, type CreateSkillRegistryOptions, } from "./skill-registry.js";
|
|
7
|
+
export { createUIBotAgent, buildSystemPrompt, type CreateUIBotAgentOptions, } from "./create-agent.js";
|
|
8
|
+
export { runAgent, type RunAgentInput, type RunAgentOptions } from "./run-agent.js";
|
|
9
|
+
export { createPlaygroundTools } from "./playground-tools.js";
|
|
10
|
+
export { createContextTools, type AgentContextService } from "./context-tools.js";
|
|
11
|
+
export { createExecutionTools, type CreateExecutionToolsOptions, type ExecutionToolAuditEvent, } from "./execution-tools.js";
|