min-agent 0.1.1 → 0.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "min-agent",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "Minimal AI coding agent with tool use, MCP, and skills support",
6
6
  "license": "MIT",
package/dist/agent.d.ts DELETED
@@ -1,23 +0,0 @@
1
- import { type ModelMessage, type LanguageModelUsage } from "ai";
2
- /** Build user message content, optionally with images */
3
- export declare function buildUserContent(message: string, imagePaths?: string[]): Promise<any>;
4
- /** Single-shot: send one message, get response, exit */
5
- export declare function runAgent(message: string, modelId?: string, imagePaths?: string[]): Promise<void>;
6
- /** Interactive multi-turn chat session */
7
- export declare function runChat(modelId?: string, resumeSessionId?: string): Promise<void>;
8
- /** When set, `runOnce` does not write to TTY; use for HTTP / programmatic callers. */
9
- export interface RunOnceCallbacks {
10
- onAssistantDisplayDelta?: (delta: string) => void;
11
- onThinkingDelta?: (delta: string) => void;
12
- onToolCall?: (toolName: string, input: unknown) => void;
13
- onToolResult?: (toolName: string, output: unknown) => void;
14
- onCompaction?: (line: string) => void;
15
- onStreamError?: (message: string) => void;
16
- onRunFinish?: (info: {
17
- stepCount: number;
18
- usage: LanguageModelUsage | undefined;
19
- hasError: boolean;
20
- aborted: boolean;
21
- }) => void;
22
- }
23
- export declare function runOnce(messages: ModelMessage[], instructions: string[], modelId?: string, abortSignal?: AbortSignal, callbacks?: RunOnceCallbacks): Promise<void>;
@@ -1,23 +0,0 @@
1
- /**
2
- * Split "thinking" fragments (inline XML-style blocks some models leak into text)
3
- * from displayable assistant text. Thinking is emitted to stderr; display goes to Markdown.
4
- */
5
- /**
6
- * Incremental filter: feed raw model text deltas; get display text (for stdout / history)
7
- * and thinking text (for stderr). Handles tags split across chunks.
8
- */
9
- export declare class ThinkingBodySplitter {
10
- private buf;
11
- feed(chunk: string): {
12
- display: string;
13
- thinking: string;
14
- };
15
- /** End of stream: flush remainder; incomplete thinking block → stderr only. */
16
- flush(): {
17
- display: string;
18
- thinking: string;
19
- };
20
- private drain;
21
- }
22
- /** Final strip for assistant message (complete tags only). */
23
- export declare function stripThinkingFromAssistantText(text: string): string;
package/dist/cli.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,14 +0,0 @@
1
- import { type ModelMessage, type LanguageModel } from "ai";
2
- export interface CompactionConfig {
3
- maxTokens?: number;
4
- keepRecentTurns?: number;
5
- }
6
- /** Rough token estimation */
7
- export declare function estimateTokens(messages: ModelMessage[]): number;
8
- /** Check if compaction is needed */
9
- export declare function needsCompaction(messages: ModelMessage[], config?: CompactionConfig): boolean;
10
- /** Compact messages by summarizing older history */
11
- export declare function compactMessages(messages: ModelMessage[], model: LanguageModel, config?: CompactionConfig): Promise<{
12
- messages: ModelMessage[];
13
- compacted: boolean;
14
- }>;
package/dist/config.d.ts DELETED
@@ -1,17 +0,0 @@
1
- export interface ProviderConfig {
2
- type?: "openai-compatible" | "openai" | "ollama";
3
- baseURL: string;
4
- apiKey: string;
5
- defaultModel?: string;
6
- }
7
- export interface AppConfig {
8
- provider?: ProviderConfig;
9
- instructions?: string[];
10
- }
11
- export declare function getConfigDir(): string;
12
- export declare function getRulesFile(): string;
13
- export declare function loadConfig(): AppConfig;
14
- export declare function saveConfig(config: AppConfig): void;
15
- export declare function isConfigured(): boolean;
16
- export declare function fetchModels(baseURL: string, apiKey: string): Promise<string[]>;
17
- export declare function runSetup(): Promise<void>;
package/dist/confirm.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export declare function setAutoApprove(value: boolean): void;
2
- export declare function isAutoApprove(): boolean;
3
- /** Ask user for confirmation. Returns true if approved. */
4
- export declare function confirm(message: string): Promise<boolean>;
5
- /** Check if a shell command is potentially dangerous */
6
- export declare function isDangerousCommand(command: string): boolean;
@@ -1 +0,0 @@
1
- export declare function loadInstructions(): Promise<string[]>;
@@ -1,15 +0,0 @@
1
- /**
2
- * Lightweight streaming markdown renderer for terminal.
3
- * Tracks state across text deltas to apply ANSI formatting.
4
- */
5
- export declare class MarkdownRenderer {
6
- private buffer;
7
- private inCodeBlock;
8
- private codeLang;
9
- /** Process a text delta and return formatted output */
10
- write(text: string): string;
11
- /** Flush remaining buffer */
12
- flush(): string;
13
- private formatInline;
14
- private formatLine;
15
- }
package/dist/mcp.d.ts DELETED
@@ -1,61 +0,0 @@
1
- import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
- import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
3
- import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
4
- import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
5
- import { type Tool } from "ai";
6
- export interface McpServerConfig {
7
- /** Local stdio server: command + args. Ignored when `url` is set. */
8
- command?: string[];
9
- /** Remote MCP endpoint (http/https). When set, connects via HTTP transport instead of stdio. */
10
- url?: string;
11
- /**
12
- * Remote transport mode.
13
- * - `streamable-http`: MCP Streamable HTTP (default for new remote servers)
14
- * - `sse`: legacy HTTP + SSE transport
15
- * - `auto`: try streamable-http first, then fall back to sse
16
- */
17
- remoteTransport?: "streamable-http" | "sse" | "auto";
18
- /** Shorthand: sets `Authorization: Bearer <token>` if not already present in `headers`. */
19
- token?: string;
20
- /** Extra HTTP headers for remote transports. */
21
- headers?: Record<string, string>;
22
- environment?: Record<string, string>;
23
- enabled?: boolean;
24
- timeout?: number;
25
- }
26
- export interface McpConfig {
27
- mcpServers: Record<string, McpServerConfig>;
28
- }
29
- type McpClientTransport = StdioClientTransport | StreamableHTTPClientTransport | SSEClientTransport;
30
- interface ConnectedServer {
31
- client: Client;
32
- transport: McpClientTransport;
33
- tools: Array<{
34
- name: string;
35
- description?: string;
36
- inputSchema: any;
37
- }>;
38
- }
39
- export interface McpCheckResult {
40
- name: string;
41
- enabled: boolean;
42
- ok: boolean;
43
- toolCount: number;
44
- error?: string;
45
- }
46
- export declare function loadMcpConfig(): McpConfig;
47
- export declare function saveMcpConfig(config: McpConfig): void;
48
- export declare function isRemoteMcpConfig(config: McpServerConfig): boolean;
49
- /** One-line summary for CLI / logs (no secrets). */
50
- export declare function formatMcpServerBinding(config: McpServerConfig): string;
51
- export declare function connectMcpServer(name: string, config: McpServerConfig): Promise<ConnectedServer | null>;
52
- export declare function checkMcpServer(name: string, config: McpServerConfig): Promise<McpCheckResult>;
53
- export declare function checkAllMcpServers(): Promise<McpCheckResult[]>;
54
- export declare function initMcp(): Promise<void>;
55
- export declare function shutdownMcp(): Promise<void>;
56
- export declare function getMcpTools(): Record<string, Tool>;
57
- export declare function getMcpStatus(): Record<string, {
58
- connected: boolean;
59
- tools: string[];
60
- }>;
61
- export {};
package/dist/memory.d.ts DELETED
@@ -1,31 +0,0 @@
1
- import { type Tool } from "ai";
2
- /**
3
- * Memory system for min-agent.
4
- *
5
- * Memories are stored as a JSON array in ~/.min-agent/memory.json.
6
- * Each memory has a content string, tags, and timestamp.
7
- *
8
- * The agent can:
9
- * - memory_save: Save a new memory (user preference, project context, learned fact)
10
- * - memory_search: Search memories by keyword
11
- * - memory_list: List all memories
12
- * - memory_delete: Delete a memory by index
13
- *
14
- * Memories are automatically injected into the system prompt so the agent
15
- * "remembers" things across sessions.
16
- */
17
- export interface Memory {
18
- content: string;
19
- tags: string[];
20
- created: string;
21
- }
22
- export declare function loadMemories(): Memory[];
23
- export declare function addMemory(content: string, tags?: string[]): Memory;
24
- export declare function deleteMemory(index: number): boolean;
25
- export declare function searchMemories(query: string): Array<Memory & {
26
- index: number;
27
- }>;
28
- /** Build a system prompt section from stored memories */
29
- export declare function getMemorySystemPrompt(): string;
30
- /** Create the memory tools for the agent */
31
- export declare function getMemoryTools(): Record<string, Tool>;
package/dist/output.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import type { LanguageModelUsage } from "ai";
2
- export declare function printHeader(modelId?: string): void;
3
- export declare function printDivider(): void;
4
- export declare function printToolCall(name: string, input: unknown): void;
5
- export declare function printToolResult(name: string, result: unknown): void;
6
- export declare function printDone(steps: number, usage: LanguageModelUsage): void;
package/dist/plugins.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { type Tool } from "ai";
2
- export declare function loadPluginTools(): Promise<Record<string, Tool>>;
@@ -1,2 +0,0 @@
1
- import type { LanguageModel } from "ai";
2
- export declare function resolveModel(modelId?: string): LanguageModel;
package/dist/serve.d.ts DELETED
@@ -1,9 +0,0 @@
1
- /**
2
- * HTTP API server: exposes chat / models / health for programmatic use.
3
- * Run: min-agent serve [--host 127.0.0.1] [--port 8787]
4
- */
5
- export interface ServeOptions {
6
- host?: string;
7
- port?: number;
8
- }
9
- export declare function runServe(opts?: ServeOptions): Promise<void>;
@@ -1,17 +0,0 @@
1
- import type { ModelMessage } from "ai";
2
- export interface SessionMeta {
3
- id: string;
4
- title: string;
5
- created: string;
6
- updated: string;
7
- messageCount: number;
8
- }
9
- interface SessionData {
10
- meta: SessionMeta;
11
- messages: ModelMessage[];
12
- }
13
- export declare function saveSession(messages: ModelMessage[], existingId?: string): string;
14
- export declare function loadSession(id: string): SessionData | null;
15
- export declare function listSessions(): SessionMeta[];
16
- export declare function deleteSession(id: string): boolean;
17
- export {};
package/dist/skills.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import { type Tool } from "ai";
2
- export interface SkillInfo {
3
- name: string;
4
- description: string;
5
- location: string;
6
- content: string;
7
- }
8
- export declare function discoverSkills(): void;
9
- export declare function getSkills(): SkillInfo[];
10
- export declare function getSkill(name: string): SkillInfo | undefined;
11
- export declare function getSkillsTool(): Tool;
12
- export declare function getSkillsSystemPrompt(): string;
@@ -1,31 +0,0 @@
1
- /** Default limits (aligned with common agent tooling practice). */
2
- export declare const TOOL_OUTPUT_MAX_LINES = 2000;
3
- export declare const TOOL_OUTPUT_MAX_BYTES: number;
4
- export type TruncateDirection = "head" | "tail";
5
- export interface TruncateToolOutputOptions {
6
- maxLines?: number;
7
- maxBytes?: number;
8
- direction?: TruncateDirection;
9
- }
10
- export interface TruncateToolOutputResult {
11
- content: string;
12
- truncated: boolean;
13
- outputPath?: string;
14
- }
15
- /** Write full text to ~/.min-agent/tool-output/ and return absolute path. */
16
- export declare function writeFullToolOutput(fullText: string): string;
17
- /** Keep end of text within line/byte limits (good for shell logs). */
18
- export declare function tailPreview(text: string, maxLines: number, maxBytes: number): {
19
- text: string;
20
- cut: boolean;
21
- };
22
- /** Keep start of text within line/byte limits (good for files / HTTP bodies). */
23
- export declare function headPreview(text: string, maxLines: number, maxBytes: number): {
24
- text: string;
25
- cut: boolean;
26
- };
27
- /**
28
- * If text exceeds limits, write full text to disk and return a preview + path hint.
29
- * Otherwise returns the original string.
30
- */
31
- export declare function truncateToolOutput(text: string, options?: TruncateToolOutputOptions): TruncateToolOutputResult;
@@ -1,6 +0,0 @@
1
- type BashInput = {
2
- command: string;
3
- timeout?: number;
4
- };
5
- export declare const bashTool: import("ai").Tool<BashInput, string>;
6
- export {};
@@ -1,7 +0,0 @@
1
- type EditInput = {
2
- filePath: string;
3
- oldText: string;
4
- newText: string;
5
- };
6
- export declare const editTool: import("ai").Tool<EditInput, string>;
7
- export {};
@@ -1,6 +0,0 @@
1
- type GlobInput = {
2
- pattern: string;
3
- cwd?: string;
4
- };
5
- export declare const globTool: import("ai").Tool<GlobInput, string>;
6
- export {};
@@ -1,7 +0,0 @@
1
- type GrepInput = {
2
- pattern: string;
3
- path?: string;
4
- include?: string;
5
- };
6
- export declare const grepTool: import("ai").Tool<GrepInput, string>;
7
- export {};
@@ -1,37 +0,0 @@
1
- export declare function createTools(): {
2
- bash: import("ai").Tool<{
3
- command: string;
4
- timeout?: number;
5
- }, string>;
6
- read: import("ai").Tool<{
7
- filePath: string;
8
- startLine?: number;
9
- endLine?: number;
10
- }, string>;
11
- write: import("ai").Tool<{
12
- filePath: string;
13
- content: string;
14
- }, string>;
15
- edit: import("ai").Tool<{
16
- filePath: string;
17
- oldText: string;
18
- newText: string;
19
- }, string>;
20
- glob: import("ai").Tool<{
21
- pattern: string;
22
- cwd?: string;
23
- }, string>;
24
- grep: import("ai").Tool<{
25
- pattern: string;
26
- path?: string;
27
- include?: string;
28
- }, string>;
29
- web_search: import("ai").Tool<{
30
- query: string;
31
- categories?: string;
32
- }, string>;
33
- web_fetch: import("ai").Tool<{
34
- url: string;
35
- method?: string;
36
- }, string>;
37
- };
@@ -1,7 +0,0 @@
1
- type ReadInput = {
2
- filePath: string;
3
- startLine?: number;
4
- endLine?: number;
5
- };
6
- export declare const readTool: import("ai").Tool<ReadInput, string>;
7
- export {};
@@ -1,6 +0,0 @@
1
- type WebFetchInput = {
2
- url: string;
3
- method?: string;
4
- };
5
- export declare const webFetchTool: import("ai").Tool<WebFetchInput, string>;
6
- export {};
@@ -1,6 +0,0 @@
1
- type WebSearchInput = {
2
- query: string;
3
- categories?: string;
4
- };
5
- export declare const webSearchTool: import("ai").Tool<WebSearchInput, string>;
6
- export {};
@@ -1,6 +0,0 @@
1
- type WriteInput = {
2
- filePath: string;
3
- content: string;
4
- };
5
- export declare const writeTool: import("ai").Tool<WriteInput, string>;
6
- export {};