@mu-agent/mu 0.2.4 → 0.3.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.
Files changed (51) hide show
  1. package/README.md +22 -13
  2. package/dist/index.js +343 -279
  3. package/dist/mu.js +522 -432
  4. package/dist/types/ai/errors.d.ts +2 -0
  5. package/dist/types/ai/index.d.ts +4 -3
  6. package/dist/types/ai/providers/citation-markup.d.ts +12 -0
  7. package/dist/types/ai/providers/inception.d.ts +3 -0
  8. package/dist/types/ai/retry.d.ts +7 -0
  9. package/dist/types/ai/sse.d.ts +2 -1
  10. package/dist/types/ai/thinking.d.ts +2 -0
  11. package/dist/types/ai/types.d.ts +5 -0
  12. package/dist/types/core/checkpoint.d.ts +4 -1
  13. package/dist/types/core/commands.d.ts +3 -0
  14. package/dist/types/core/events.d.ts +33 -0
  15. package/dist/types/core/extensions.d.ts +10 -1
  16. package/dist/types/core/index.d.ts +4 -4
  17. package/dist/types/core/loop.d.ts +2 -0
  18. package/dist/types/core/messages.d.ts +3 -1
  19. package/dist/types/core/permission.d.ts +28 -1
  20. package/dist/types/core/process.d.ts +13 -2
  21. package/dist/types/core/profile.d.ts +12 -2
  22. package/dist/types/core/testing/fake-provider.d.ts +3 -1
  23. package/dist/types/core/tools.d.ts +6 -2
  24. package/dist/types/profile-browser/actions/input.d.ts +1 -0
  25. package/dist/types/profile-browser/agent/handoff.d.ts +6 -1
  26. package/dist/types/profile-browser/agent/permissions.d.ts +1 -0
  27. package/dist/types/profile-browser/index.d.ts +0 -2
  28. package/dist/types/profile-coding/checkpoint.d.ts +39 -5
  29. package/dist/types/profile-coding/index.d.ts +5 -7
  30. package/dist/types/profile-coding/permissions.d.ts +16 -1
  31. package/dist/types/profile-coding/prompts.d.ts +0 -1
  32. package/dist/types/profile-coding/shell-permissions.d.ts +5 -0
  33. package/dist/types/profile-coding/terminal-text.d.ts +1 -0
  34. package/dist/types/profile-coding/tools/bash.d.ts +7 -2
  35. package/dist/types/profile-coding/tools/diff.d.ts +8 -0
  36. package/dist/types/profile-coding/tools/files.d.ts +5 -0
  37. package/dist/types/profile-coding/tools/tasks.d.ts +2 -1
  38. package/dist/types/profile-coding/track-commands.d.ts +9 -0
  39. package/dist/types/sdk/agent.d.ts +52 -2
  40. package/dist/types/sdk/commands.d.ts +1 -0
  41. package/dist/types/sdk/index.d.ts +14 -12
  42. package/dist/types/sdk/markdown-commands.d.ts +3 -1
  43. package/dist/types/sdk/mcp-catalog.d.ts +36 -0
  44. package/dist/types/sdk/mcp-config.d.ts +61 -0
  45. package/dist/types/sdk/mcp.d.ts +12 -18
  46. package/dist/types/sdk/skills.d.ts +39 -5
  47. package/dist/types/sdk/structured-output.d.ts +8 -1
  48. package/dist/types/sdk/subagents.d.ts +53 -5
  49. package/dist/types/sdk/tool.d.ts +5 -1
  50. package/package.json +1 -1
  51. package/dist/types/sdk/todo.d.ts +0 -16
@@ -1,13 +1,14 @@
1
- import { type ModelInfo, type ThinkingLevel, type Usage } from "../ai/index.js";
2
- import type { AgentMessage, Extension, PermissionRule, ProfileSubagents } from "../core/index.js";
1
+ import { type ModelInfo, type TextContent, type ThinkingLevel, type Usage } from "../ai/index.js";
2
+ import { type AgentMessage, type Extension, type PermissionRule, type ProfileSubagents } from "../core/index.js";
3
3
  import type { Agent, HaltReason } from "./agent.js";
4
- export type SubagentKind = "task" | "search" | "counsel" | "recall";
4
+ export type SubagentKind = "task" | "counsel" | "recall";
5
5
  export interface SubagentDetails {
6
6
  type: "subagent";
7
7
  kind: SubagentKind;
8
8
  description: string;
9
9
  model: string;
10
10
  thinkingLevel: ThinkingLevel;
11
+ ownModel?: boolean;
11
12
  durationMs: number;
12
13
  messages: AgentMessage[];
13
14
  usage: Usage;
@@ -19,6 +20,7 @@ export interface SubagentProgressUpdate {
19
20
  description: string;
20
21
  model: string;
21
22
  thinkingLevel: ThinkingLevel;
23
+ ownModel?: boolean;
22
24
  event: {
23
25
  type: "assistant_start";
24
26
  } | {
@@ -29,12 +31,46 @@ export interface SubagentProgressUpdate {
29
31
  message: AgentMessage;
30
32
  };
31
33
  }
34
+ export interface SubagentRouteOverride {
35
+ model?: ModelInfo;
36
+ thinkingLevel?: ThinkingLevel;
37
+ unavailable?: string;
38
+ }
39
+ export interface SubagentCallChoice {
40
+ model?: ModelInfo;
41
+ thinkingLevel?: ThinkingLevel;
42
+ }
43
+ export interface SubagentRoute {
44
+ kind: SubagentKind;
45
+ model: string;
46
+ thinkingLevel?: ThinkingLevel;
47
+ pinned?: boolean;
48
+ unavailable?: string;
49
+ }
50
+ export interface SubagentsCommandData {
51
+ kind: "subagents";
52
+ routes: SubagentRoute[];
53
+ }
54
+ export interface BackgroundSubagentDetails {
55
+ type: "subagent-background";
56
+ subagentId: string;
57
+ kind: SubagentKind;
58
+ description: string;
59
+ }
60
+ export interface BackgroundSubagentResultDetails {
61
+ type: "subagent-background-result";
62
+ subagentId: string;
63
+ toolCallId: string;
64
+ status: "done" | "error" | "stopped";
65
+ content: TextContent[];
66
+ result?: SubagentDetails;
67
+ }
32
68
  interface SubagentExtensionBaseOptions {
33
69
  parent: () => Agent;
34
70
  taskSession?: ProfileSubagents["taskSession"];
35
71
  excludeTools?: readonly string[];
36
- searchModel?: (parent: Agent) => ModelInfo | undefined;
37
- counselModel?: (parent: Agent) => ModelInfo | undefined;
72
+ modelChoices?: (parent: Agent) => ModelInfo[] | Promise<ModelInfo[]>;
73
+ routeOverride?: (kind: SubagentKind, parent: Agent) => SubagentRouteOverride | undefined | Promise<SubagentRouteOverride | undefined>;
38
74
  }
39
75
  export type SubagentExtensionOptions = SubagentExtensionBaseOptions & ({
40
76
  coding: ProfileSubagents;
@@ -43,5 +79,17 @@ export type SubagentExtensionOptions = SubagentExtensionBaseOptions & ({
43
79
  coding?: undefined;
44
80
  inspectionPermissions?: PermissionRule[];
45
81
  });
82
+ export declare function subagentThinking(kind: SubagentKind, model: ModelInfo, parentThinking: ThinkingLevel): ThinkingLevel;
83
+ export declare function matchModel(query: string, models: readonly ModelInfo[]): {
84
+ model: ModelInfo;
85
+ } | {
86
+ matches: ModelInfo[];
87
+ };
88
+ export declare function similarModels(query: string, models: readonly ModelInfo[]): ModelInfo[];
89
+ export interface SubagentRoutesStyle {
90
+ name?: (kind: SubagentKind, text: string) => string;
91
+ route?: (text: string) => string;
92
+ }
93
+ export declare function formatSubagentRoutes(routes: readonly SubagentRoute[], style?: SubagentRoutesStyle): string[];
46
94
  export declare function subagentsExtension(options: SubagentExtensionOptions): Extension;
47
95
  export {};
@@ -1,4 +1,4 @@
1
- import type { AnyTool, Tool, ToolPermissionDetails, ToolResult } from "../core/index.js";
1
+ import type { AnyTool, PermissionTarget, Tool, ToolPermissionDetails, ToolResult } from "../core/index.js";
2
2
  import { z } from "zod";
3
3
  export type { ToolResult };
4
4
  export interface ToolDefinition<Schema extends z.ZodType> {
@@ -9,13 +9,17 @@ export interface ToolDefinition<Schema extends z.ZodType> {
9
9
  isConcurrencySafe?: (args: z.infer<Schema>) => boolean;
10
10
  executionMode?: "sequential";
11
11
  changesState?: boolean | ((args: z.infer<Schema>) => boolean);
12
+ changedResources?: (args: z.infer<Schema>) => string[];
12
13
  permissionScope?: (args: z.infer<Schema>) => string;
13
14
  permissionPattern?: (args: z.infer<Schema>) => string;
15
+ permissionTargets?: (args: z.infer<Schema>) => PermissionTarget[];
14
16
  permissionDetails?: (args: z.infer<Schema>) => ToolPermissionDetails | undefined | Promise<ToolPermissionDetails | undefined>;
17
+ canBackground?: (args: z.infer<Schema>) => boolean;
15
18
  execute: (args: z.infer<Schema>, ctx: {
16
19
  toolCallId: string;
17
20
  signal: AbortSignal;
18
21
  update: (text: string, details?: unknown) => void;
22
+ background: AbortSignal;
19
23
  }) => Promise<ToolResult | string> | ToolResult | string;
20
24
  }
21
25
  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.2.4",
3
+ "version": "0.3.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",
@@ -1,16 +0,0 @@
1
- export interface TodoItem {
2
- content: string;
3
- status: "pending" | "in_progress" | "completed";
4
- }
5
- export declare class TodoStore {
6
- private items;
7
- replace(items: TodoItem[]): void;
8
- all(): TodoItem[];
9
- }
10
- export declare function renderTodos(items: TodoItem[]): string;
11
- export declare function todoTool(store: TodoStore): import("../core/index.js").Tool<{
12
- items: {
13
- content: string;
14
- status: "completed" | "pending" | "in_progress";
15
- }[];
16
- }>;