@mu-agent/mu 0.0.8 → 0.1.0

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.
@@ -9,6 +9,7 @@ export { builtinProviderConfigs, modelApi, providerBaseUrl, providerConfig, prov
9
9
  export { anthropic, streamAnthropic } from "./providers/anthropic.js";
10
10
  export { gemini, streamGemini } from "./providers/gemini.js";
11
11
  export { discoverGitHubCopilotModels } from "./providers/github-copilot.js";
12
+ export { discoverLlamaCppModels, llamaCpp } from "./providers/llama-cpp.js";
12
13
  export { discoverOpenAICodexModels, openai, openaiCodex, streamOpenAI, } from "./providers/openai.js";
13
14
  export { openaiCompletions, streamOpenAICompletions } from "./providers/openai-completions.js";
14
15
  export { getProvider, providers, registerProvider } from "./registry.js";
@@ -5,7 +5,7 @@ export interface BuiltinProviderConfig {
5
5
  api: LlmApi;
6
6
  baseUrl?: string;
7
7
  env: string[];
8
- auth?: "bearer" | "anthropic" | "google" | "azure" | "cloudflare";
8
+ auth?: "bearer" | "anthropic" | "google" | "azure" | "cloudflare" | "none";
9
9
  headers?: Record<string, string>;
10
10
  }
11
11
  export declare const builtinProviderConfigs: Map<string, BuiltinProviderConfig>;
@@ -0,0 +1,3 @@
1
+ import type { ModelInfo, Provider, ProviderModelDiscoveryOptions } from "../types.js";
2
+ export declare function discoverLlamaCppModels(options: ProviderModelDiscoveryOptions): Promise<ModelInfo[]>;
3
+ export declare const llamaCpp: Provider;
@@ -52,6 +52,7 @@ export interface ToolResultMessage {
52
52
  toolName: string;
53
53
  content: ToolResultContent[];
54
54
  details?: unknown;
55
+ usage?: Usage;
55
56
  isError: boolean;
56
57
  evicted?: boolean;
57
58
  timestamp: number;
@@ -14,6 +14,7 @@ export interface CommandResult {
14
14
  export interface Command {
15
15
  name: string;
16
16
  description: string;
17
+ sessionScoped?: boolean;
17
18
  run: (ctx: CommandContext) => CommandResult | void | Promise<CommandResult | void>;
18
19
  }
19
20
  export declare class CommandRegistry {
@@ -67,6 +67,7 @@ export type AgentEvent = {
67
67
  type: "tool_execution_update";
68
68
  toolCallId: string;
69
69
  partial: ToolResultContent[];
70
+ details?: unknown;
70
71
  } | {
71
72
  type: "tool_execution_end";
72
73
  toolCallId: string;
@@ -18,7 +18,7 @@ export type { PermissionAction, PermissionPreview, PermissionRequest, Permission
18
18
  export { evaluate } from "./permission.js";
19
19
  export type { ManagedProcessHandle, ProcessEvents, Spawner, SpawnRequest, TaskInfo, TaskStatus, } from "./process.js";
20
20
  export { exitNotification, OutputBuffer, ProcessManager } from "./process.js";
21
- export type { PermissionMode, PermissionModeTone, Profile, ProfileFactory, ProfileRuntime, ProfileRuntimeHost, } from "./profile.js";
21
+ export type { PermissionMode, PermissionModeTone, Profile, ProfileFactory, ProfileRuntime, ProfileRuntimeHost, ProfileSubagents, } from "./profile.js";
22
22
  export type { RecoveryAttempt } from "./recovery.js";
23
23
  export { isContextTooLongError, isContextTooLongResult, withContextRecovery, } from "./recovery.js";
24
24
  export type { NewTreeEntry, SessionEntry, SessionStore, TreeEntry } from "./session.js";
@@ -3,7 +3,7 @@ import type { CheckpointProvider } from "./checkpoint.js";
3
3
  import type { Command } from "./commands.js";
4
4
  import type { AgentEvent } from "./events.js";
5
5
  import type { ToolRenderer } from "./extensions.js";
6
- import type { AgentMessage } from "./messages.js";
6
+ import type { AgentMessage, CustomMessage } from "./messages.js";
7
7
  import type { PermissionRule } from "./permission.js";
8
8
  import type { AnyTool } from "./tools.js";
9
9
  export type PermissionModeTone = "restrictive" | "permissive" | "unrestricted";
@@ -16,7 +16,7 @@ export interface PermissionMode {
16
16
  }
17
17
  export interface ProfileRuntimeHost {
18
18
  emit: (event: AgentEvent) => void;
19
- followUp: (message: string) => void;
19
+ followUp: (message: string | CustomMessage) => void;
20
20
  }
21
21
  export interface ProfileRuntime {
22
22
  attach: (host: ProfileRuntimeHost) => void;
@@ -24,6 +24,11 @@ export interface ProfileRuntime {
24
24
  stop?: () => void;
25
25
  shutdown?: () => void | Promise<void>;
26
26
  }
27
+ export interface ProfileSubagents {
28
+ inspectionTools: string[];
29
+ searchPrompt?: string;
30
+ counselPrompt?: string;
31
+ }
27
32
  export interface Profile {
28
33
  name: string;
29
34
  toolset: AnyTool[];
@@ -36,6 +41,8 @@ export interface Profile {
36
41
  commands?: Command[];
37
42
  environment?: () => Promise<Record<string, string>> | Record<string, string>;
38
43
  contextMessages?: () => Promise<AgentMessage[]> | AgentMessage[];
44
+ sideBoundary?: () => string;
45
+ subagents?: ProfileSubagents;
39
46
  refreshContext?: (messages: AgentMessage[], context: {
40
47
  sessionId: string;
41
48
  }) => Promise<AgentMessage[]> | AgentMessage[];
@@ -7,6 +7,7 @@ export type SessionEntry = {
7
7
  createdAt: string;
8
8
  profile: string;
9
9
  environment: Record<string, string>;
10
+ title?: string;
10
11
  } | {
11
12
  type: "message";
12
13
  id: string;
@@ -96,6 +97,7 @@ export declare class SessionTree {
96
97
  get header(): (SessionEntry & {
97
98
  type: "session";
98
99
  }) | undefined;
100
+ setTitle(title: string | undefined): void;
99
101
  get head(): string | null;
100
102
  all(): SessionEntry[];
101
103
  get(id: string): TreeEntry | undefined;
@@ -113,11 +115,13 @@ export interface SessionStore {
113
115
  load(sessionId: string): Promise<SessionTree | undefined>;
114
116
  save(sessionId: string, tree: SessionTree): Promise<void>;
115
117
  list(): Promise<string[]>;
118
+ delete?(sessionId: string): Promise<boolean>;
116
119
  }
117
120
  export declare class MemorySessionStore implements SessionStore {
118
121
  private sessions;
119
122
  load(sessionId: string): Promise<SessionTree | undefined>;
120
123
  save(sessionId: string, tree: SessionTree): Promise<void>;
121
124
  list(): Promise<string[]>;
125
+ delete(sessionId: string): Promise<boolean>;
122
126
  }
123
127
  export {};
@@ -1,8 +1,9 @@
1
- import type { ToolResultContent } from "../ai/index.js";
1
+ import type { ToolResultContent, Usage } from "../ai/index.js";
2
2
  import type { ToolPermissionDetails } from "./permission.js";
3
3
  export interface ToolResult {
4
4
  content: ToolResultContent[];
5
5
  details?: unknown;
6
+ usage?: Usage;
6
7
  isError?: boolean;
7
8
  terminate?: boolean;
8
9
  }
@@ -16,7 +17,7 @@ export interface Tool<Args = Record<string, unknown>> {
16
17
  permissionScope?: (args: Args) => string;
17
18
  permissionPattern?: (args: Args) => string;
18
19
  permissionDetails?: (args: Args) => ToolPermissionDetails | undefined | Promise<ToolPermissionDetails | undefined>;
19
- execute: (toolCallId: string, args: Args, signal: AbortSignal, onUpdate?: (partial: ToolResultContent[]) => void) => Promise<ToolResult>;
20
+ execute: (toolCallId: string, args: Args, signal: AbortSignal, onUpdate?: (partial: ToolResultContent[], details?: unknown) => void) => Promise<ToolResult>;
20
21
  }
21
22
  export type AnyTool = Tool<any>;
22
23
  export declare function errorResult(message: string): ToolResult;
@@ -1,2 +1,5 @@
1
1
  import type { PromptSection } from "../ai/index.js";
2
+ export declare const CODING_SIDE_BOUNDARY = "This is a coding side conversation. Do not modify files, source, git state, configuration, or workspace state unless the user deliberately changes the side conversation's permission mode. Do not request broader permissions or use subagents.";
3
+ export declare const CODING_SEARCH_PROMPT = "Use rg and rg --files through bash for broad discovery, then read only the relevant ranges. Ground every finding in exact workspace-relative paths and 1-based line ranges. Distinguish observed code behavior from hypotheses.";
4
+ export declare const CODING_COUNSEL_PROMPT = "Inspect the current implementation and tests before judging. Cite exact workspace-relative paths and 1-based line ranges for the evidence behind the recommendation.";
2
5
  export declare function codingPrompt(modelRef: string): PromptSection[];
@@ -1,5 +1,5 @@
1
1
  import { type Credential, type ModelInfo, type PromptSection, type Provider, type ThinkingLevel, type Usage } from "../ai/index.js";
2
- import { type AgentEvent, type AgentMessage, type AnyTool, type CheckpointDiffFile, CheckpointHistory, type CheckpointProvider, type EventSink, type ExtensionHost, type PermissionRequest, type PermissionRule, type ProfileRuntime, type SessionStore, SessionTree, type UserContent } from "../core/index.js";
2
+ import { type AgentEvent, type AgentMessage, type AnyTool, type CheckpointDiffFile, CheckpointHistory, type CheckpointProvider, type CustomMessage, type EventSink, type ExtensionHost, type PermissionRequest, type PermissionRule, type ProfileRuntime, type SessionStore, SessionTree, type UserContent } from "../core/index.js";
3
3
  import type { z } from "zod";
4
4
  import { type Budget } from "./budget.js";
5
5
  export type HaltReason = "done" | "aborted" | "error" | "maxTurns" | "maxCostUsd" | "maxTokens";
@@ -40,6 +40,7 @@ export interface CheckpointActionData {
40
40
  kind: "checkpoint";
41
41
  action: "undo" | "redo";
42
42
  files: CheckpointDiffFile[];
43
+ turnCount?: number;
43
44
  messageCount: number;
44
45
  prompt?: string;
45
46
  }
@@ -48,6 +49,11 @@ export interface CheckpointActionResult {
48
49
  message: string;
49
50
  data?: CheckpointActionData;
50
51
  }
52
+ export interface UndoPoint {
53
+ steps: number;
54
+ prompt: string;
55
+ messageCount: number;
56
+ }
51
57
  export interface ManualCompactionResult {
52
58
  status: "completed" | "queued" | "failed" | "cancelled" | "noop";
53
59
  message: string;
@@ -62,6 +68,14 @@ export interface AgentRunOptions<T = unknown> {
62
68
  model?: string | ModelInfo;
63
69
  allowedTools?: string[];
64
70
  }
71
+ export interface ChildAgentOptions {
72
+ model?: ModelInfo;
73
+ thinkingLevel?: ThinkingLevel;
74
+ systemPrompt: string;
75
+ tools: AnyTool[];
76
+ permissions?: PermissionRule[];
77
+ budget?: Budget;
78
+ }
65
79
  export declare class Agent {
66
80
  private readonly options;
67
81
  private model;
@@ -104,12 +118,16 @@ export declare class Agent {
104
118
  get session(): SessionTree;
105
119
  get sessionStore(): SessionStore;
106
120
  get modelRef(): string;
121
+ get modelInfo(): ModelInfo;
107
122
  get contextWindow(): number;
108
123
  get thinking(): ThinkingLevel;
109
124
  get thinkingLevels(): ThinkingLevel[];
110
125
  get isRunning(): boolean;
111
126
  get isCompacting(): boolean;
112
127
  get permissions(): PermissionRule[];
128
+ get tools(): AnyTool[];
129
+ availableModel(ref: string): ModelInfo | undefined;
130
+ createChild(options: ChildAgentOptions): Agent;
113
131
  setPermissions(rules: PermissionRule[]): void;
114
132
  addPermissionRule(rule: PermissionRule): void;
115
133
  setModel(ref: string | ModelInfo): void;
@@ -117,7 +135,7 @@ export declare class Agent {
117
135
  resume(tree: SessionTree): void;
118
136
  newSession(sessionId?: string): void;
119
137
  send(message: string): void;
120
- followUp(message: string): void;
138
+ followUp(message: string | CustomMessage): void;
121
139
  removeQueuedMessage(kind: "steer" | "follow-up", text: string): boolean;
122
140
  emitTaskEvent(event: AgentEvent): void;
123
141
  subscribe(listener: EventSink): () => void;
@@ -130,7 +148,8 @@ export declare class Agent {
130
148
  compactNow(focus?: string): Promise<ManualCompactionResult>;
131
149
  private executeManualCompaction;
132
150
  get checkpointHistory(): CheckpointHistory;
133
- undo(): Promise<CheckpointActionResult>;
151
+ undoPoints(): UndoPoint[];
152
+ undo(turnCount?: number): Promise<CheckpointActionResult>;
134
153
  redo(): Promise<CheckpointActionResult>;
135
154
  sessionDiff(): Promise<Awaited<ReturnType<CheckpointProvider["diff"]>>>;
136
155
  forkPoints(): {
@@ -161,6 +180,7 @@ export declare class Agent {
161
180
  private execute;
162
181
  private executeRun;
163
182
  private providerFor;
183
+ private resolveChildPermission;
164
184
  private publishEvent;
165
185
  private refreshContextAccounting;
166
186
  private publishToSubscribers;
@@ -1,6 +1,6 @@
1
1
  import type { Usage } from "../ai/index.js";
2
2
  import { type CheckpointDiffFile, type Command, CommandRegistry } from "../core/index.js";
3
- import type { CheckpointActionResult, ManualCompactionResult } from "./agent.js";
3
+ import type { CheckpointActionResult, ManualCompactionResult, UndoPoint } from "./agent.js";
4
4
  export interface ForkPoint {
5
5
  id: string;
6
6
  description: string;
@@ -9,12 +9,17 @@ export interface DiffCommandData {
9
9
  kind: "diff";
10
10
  files: CheckpointDiffFile[];
11
11
  }
12
+ export interface UndoPointsCommandData {
13
+ kind: "undo-points";
14
+ points: UndoPoint[];
15
+ }
12
16
  export interface CoreCommandHooks {
13
17
  requestCompaction?: (focus?: string) => ManualCompactionResult | undefined | Promise<ManualCompactionResult | undefined>;
14
18
  usage?: () => Usage & {
15
19
  contextPercent: number;
16
20
  };
17
- undo?: () => Promise<CheckpointActionResult>;
21
+ undo?: (turnCount?: number) => Promise<CheckpointActionResult>;
22
+ undoPoints?: () => UndoPoint[];
18
23
  redo?: () => Promise<CheckpointActionResult>;
19
24
  fork?: (entryId: string) => Promise<{
20
25
  ok: boolean;
@@ -11,4 +11,5 @@ export declare class FileSessionStore implements SessionStore {
11
11
  load(sessionId: string): Promise<SessionTree | undefined>;
12
12
  save(sessionId: string, tree: SessionTree): Promise<void>;
13
13
  list(): Promise<string[]>;
14
+ delete(sessionId: string): Promise<boolean>;
14
15
  }
@@ -1,8 +1,8 @@
1
1
  export type { Credential, ModelDiscoveryOptions, ModelInfo, Provider, ProviderModelDiscoveryOptions, ThinkingLevel, Usage, } from "../ai/index.js";
2
- export { builtinProviderConfigs, defaultModelId, defaultModelRef, defaultThinkingLevel, discoverModels, findModel, listModels, providerHasCredentials, refreshModels, registerModels, registerProvider, supportedThinkingLevels, thinkingLevelForModel, } from "../ai/index.js";
2
+ export { builtinProviderConfigs, defaultModelId, defaultModelRef, defaultThinkingLevel, discoverModels, findModel, listModels, providerConfig, providerHasCredentials, refreshModels, registerModels, registerProvider, supportedThinkingLevels, thinkingLevelForModel, } from "../ai/index.js";
3
3
  export type { AgentEvent, AgentMessage, AnyTool, Command, CommandContext, CommandResult, CustomMessage, Extension, ExtensionAPI, ExtensionEvent, ExtensionEventFor, ExtensionEventType, LifecycleEvent, LifecycleNotification, PermissionMode, PermissionModeTone, PermissionRequest, PermissionRule, ProfileRuntime, ProfileRuntimeHost, SessionStore, StreamDelta, Tool, ToolRenderer, UserContent, } from "../core/index.js";
4
4
  export { CommandRegistry, customMessage, ExtensionHost, errorResult, MemorySessionStore, SessionTree, textResult, userMessage, } from "../core/index.js";
5
- export type { AgentOptions, AgentRunOptions, CheckpointActionData, CheckpointActionResult, HaltReason, ManualCompactionResult, RunResult, } from "./agent.js";
5
+ export type { AgentOptions, AgentRunOptions, CheckpointActionData, CheckpointActionResult, ChildAgentOptions, HaltReason, ManualCompactionResult, RunResult, UndoPoint, } from "./agent.js";
6
6
  export { Agent } from "./agent.js";
7
7
  export type { AuthFile, AuthStoreOptions, OpenAiCallbackServer, OpenAiLoginOptions, OpenAiLoginResult, PlanLoginCallbackServer, PlanLoginOptions, PlanLoginResult, StoredApiKey, StoredCredential, StoredOpenAiOAuth, StoredPlanOAuth, } from "./auth.js";
8
8
  export { createCredentialResolver, defaultAuthFile, loginGitHubCopilot, loginKimiCoding, loginOpenAI, loginOpenRouter, loginXai, preferredAuthProvider, readAuthFile, removeStoredCredential, saveApiKey, storedAuthProviders, } from "./auth.js";
@@ -10,7 +10,7 @@ export type { AuthPageOptions } from "./auth-page.js";
10
10
  export { authErrorPage, authSuccessPage, renderAuthPage } from "./auth-page.js";
11
11
  export type { Budget, BudgetBreach } from "./budget.js";
12
12
  export { checkBudget, totalTokens } from "./budget.js";
13
- export type { DiffCommandData, ForkPoint } from "./commands.js";
13
+ export type { DiffCommandData, ForkPoint, UndoPointsCommandData } from "./commands.js";
14
14
  export { coreCommands, registryWithCoreCommands } from "./commands.js";
15
15
  export type { LoadOptions, LoadReport } from "./extension-loader.js";
16
16
  export { loadExtensions, resolveExtensionFiles } from "./extension-loader.js";
@@ -24,9 +24,13 @@ export type { Profile, ProfileImporter } from "./profile.js";
24
24
  export { loadProfile, optionsFromProfile } from "./profile.js";
25
25
  export type { HookEvent, HookRunner, HookSpec } from "./shell-hooks.js";
26
26
  export { shellHooksExtension } from "./shell-hooks.js";
27
+ export type { SideConversation, SideConversationInput } from "./side.js";
28
+ export { startSideConversation } from "./side.js";
27
29
  export type { Skill } from "./skills.js";
28
30
  export { defaultSkillRoots, discoverSkills, loadSkill, skillListing, skillsExtension, } from "./skills.js";
29
31
  export { STRUCTURED_OUTPUT_TOOL, structuredOutputPrompt, structuredOutputTool, } from "./structured-output.js";
32
+ export type { SubagentDetails, SubagentExtensionOptions, SubagentKind, SubagentProgressUpdate, } from "./subagents.js";
33
+ export { subagentsExtension } from "./subagents.js";
30
34
  export type { ToolDefinition, ToolResult } from "./tool.js";
31
35
  export { tool } from "./tool.js";
32
36
  export type { MarkdownTranscript, TranscriptMarkdownOptions, } from "./transcript-markdown.js";
@@ -0,0 +1,12 @@
1
+ import { type AgentMessage, type PermissionRule } from "../core/index.js";
2
+ import { Agent, type AgentOptions } from "./agent.js";
3
+ export interface SideConversationInput {
4
+ messages: AgentMessage[];
5
+ boundary?: string;
6
+ permissions?: PermissionRule[];
7
+ }
8
+ export interface SideConversation {
9
+ agent: Agent;
10
+ close(): Promise<void>;
11
+ }
12
+ export declare function startSideConversation(options: AgentOptions, input: SideConversationInput): SideConversation;
@@ -0,0 +1,46 @@
1
+ import { type ModelInfo, type ThinkingLevel, type Usage } from "../ai/index.js";
2
+ import type { AgentMessage, Extension, PermissionRule, ProfileSubagents } from "../core/index.js";
3
+ import type { Agent, HaltReason } from "./agent.js";
4
+ export type SubagentKind = "task" | "search" | "counsel";
5
+ export interface SubagentDetails {
6
+ type: "subagent";
7
+ kind: SubagentKind;
8
+ description: string;
9
+ model: string;
10
+ thinkingLevel: ThinkingLevel;
11
+ durationMs: number;
12
+ messages: AgentMessage[];
13
+ usage: Usage;
14
+ reason: HaltReason;
15
+ }
16
+ export interface SubagentProgressUpdate {
17
+ type: "subagent-progress";
18
+ kind: SubagentKind;
19
+ description: string;
20
+ model: string;
21
+ thinkingLevel: ThinkingLevel;
22
+ event: {
23
+ type: "assistant_start";
24
+ } | {
25
+ type: "text_delta";
26
+ text: string;
27
+ } | {
28
+ type: "message";
29
+ message: AgentMessage;
30
+ };
31
+ }
32
+ interface SubagentExtensionBaseOptions {
33
+ parent: () => Agent;
34
+ excludeTools?: readonly string[];
35
+ searchModel?: (parent: Agent) => ModelInfo | undefined;
36
+ counselModel?: (parent: Agent) => ModelInfo | undefined;
37
+ }
38
+ export type SubagentExtensionOptions = SubagentExtensionBaseOptions & ({
39
+ coding: ProfileSubagents;
40
+ inspectionPermissions: PermissionRule[];
41
+ } | {
42
+ coding?: undefined;
43
+ inspectionPermissions?: PermissionRule[];
44
+ });
45
+ export declare function subagentsExtension(options: SubagentExtensionOptions): Extension;
46
+ export {};
@@ -15,7 +15,7 @@ export interface ToolDefinition<Schema extends z.ZodType> {
15
15
  execute: (args: z.infer<Schema>, ctx: {
16
16
  toolCallId: string;
17
17
  signal: AbortSignal;
18
- update: (text: string) => void;
18
+ update: (text: string, details?: unknown) => void;
19
19
  }) => Promise<ToolResult | string> | ToolResult | string;
20
20
  }
21
21
  export declare function tool<Schema extends z.ZodType>(definition: ToolDefinition<Schema>): Tool<z.infer<Schema>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mu-agent/mu",
3
- "version": "0.0.8",
3
+ "version": "0.1.0",
4
4
  "description": "Mu, a general-purpose extensible AI agent platform for the terminal and TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",