@mu-agent/mu 0.0.3 → 0.0.5
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/README.md +0 -1
- package/dist/index.js +135 -135
- package/dist/mu.js +234 -229
- package/dist/types/ai/catalog.d.ts +1 -0
- package/dist/types/ai/index.d.ts +1 -1
- package/dist/types/core/compaction.d.ts +1 -0
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/core/session.d.ts +10 -0
- package/dist/types/profile-coding/context.d.ts +0 -5
- package/dist/types/profile-coding/index.d.ts +1 -1
- package/dist/types/profile-coding/permissions.d.ts +10 -1
- package/dist/types/profile-coding/shell.d.ts +1 -0
- package/dist/types/profile-coding/state.d.ts +2 -2
- package/dist/types/profile-coding/tools/files.d.ts +2 -0
- package/dist/types/sdk/agent.d.ts +1 -0
- package/dist/types/sdk/file-store.d.ts +1 -0
- package/dist/types/sdk/index.d.ts +1 -1
- package/dist/types/sdk/shell-hooks.d.ts +1 -1
- package/package.json +1 -1
|
@@ -16,5 +16,6 @@ export declare function registerModels(extra: ModelInfo[]): void;
|
|
|
16
16
|
export declare function findModel(ref: string): ModelInfo | undefined;
|
|
17
17
|
export declare function modelRef(model: ModelInfo): string;
|
|
18
18
|
export declare function providerHasCredentials(provider: string, env?: NodeJS.ProcessEnv): boolean;
|
|
19
|
+
export declare function defaultModelId(provider: string): string | undefined;
|
|
19
20
|
export declare function defaultModelRef(env?: NodeJS.ProcessEnv, authenticatedProviders?: Iterable<string>): string;
|
|
20
21
|
export {};
|
package/dist/types/ai/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { resolveCredential } from "./auth.js";
|
|
2
2
|
export type { ModelDiscoveryOptions } from "./catalog.js";
|
|
3
|
-
export { defaultModelRef, discoverModels, findModel, listModels, modelRef, providerHasCredentials, refreshModels, registerModels, } from "./catalog.js";
|
|
3
|
+
export { defaultModelId, defaultModelRef, discoverModels, findModel, listModels, modelRef, providerHasCredentials, refreshModels, registerModels, } from "./catalog.js";
|
|
4
4
|
export { addUsage, computeCostUsd, zeroUsage } from "./cost.js";
|
|
5
5
|
export type { AiErrorKind } from "./errors.js";
|
|
6
6
|
export { AiError, classifyHttpError, isContextTooLongMessage } from "./errors.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ModelInfo, Provider, StreamOpts, Usage } from "../ai/index.js";
|
|
2
2
|
import type { AgentMessage } from "./messages.js";
|
|
3
|
+
export declare function estimateTextTokens(text: string): number;
|
|
3
4
|
export declare function estimateTokens(messages: AgentMessage[]): number;
|
|
4
5
|
export interface ContextState {
|
|
5
6
|
tokens: number;
|
|
@@ -3,7 +3,7 @@ export { CheckpointHistory } from "./checkpoint.js";
|
|
|
3
3
|
export type { Command, CommandContext, CommandResult } from "./commands.js";
|
|
4
4
|
export { CommandRegistry } from "./commands.js";
|
|
5
5
|
export type { CompactionPlan, CompactionRequest, CompactionResult, CompactorOptions, ContextState, } from "./compaction.js";
|
|
6
|
-
export { AUTO_COMPACT_THRESHOLD, applyCompaction, CompactionError, compact, compactionSummaryMessage, contextState, DEFAULT_KEEP_RECENT_TOKENS, estimateTokens, formatCarryover, planCompaction, SUMMARY_PROMPT, serializeCompactionMessages, shouldCompact, } from "./compaction.js";
|
|
6
|
+
export { AUTO_COMPACT_THRESHOLD, applyCompaction, CompactionError, compact, compactionSummaryMessage, contextState, DEFAULT_KEEP_RECENT_TOKENS, estimateTextTokens, estimateTokens, formatCarryover, planCompaction, SUMMARY_PROMPT, serializeCompactionMessages, shouldCompact, } from "./compaction.js";
|
|
7
7
|
export type { AgentEndReason, AgentEvent, AgentEventType, CompactionStage, CompactionTrigger, EventSink, StreamDelta, } from "./events.js";
|
|
8
8
|
export type { Extension, ExtensionAPI, ExtensionEvent, ExtensionEventFor, ExtensionEventType, InputDirective, LifecycleEvent, LifecycleNotification, ToolCallDirective, ToolCallHookInfo, ToolRenderer, ToolResultDirective, ToolResultHookInfo, } from "./extensions.js";
|
|
9
9
|
export { ExtensionHost } from "./extensions.js";
|
|
@@ -39,6 +39,16 @@ export type SessionEntry = {
|
|
|
39
39
|
entryId: string;
|
|
40
40
|
message: AgentMessage;
|
|
41
41
|
}[];
|
|
42
|
+
} | {
|
|
43
|
+
type: "compaction-attempt";
|
|
44
|
+
id: string;
|
|
45
|
+
parentId: string | null;
|
|
46
|
+
status: "failed" | "cancelled";
|
|
47
|
+
trigger: "manual" | "threshold" | "overflow" | "model-change";
|
|
48
|
+
model: string;
|
|
49
|
+
compactorModel: string;
|
|
50
|
+
timestamp: number;
|
|
51
|
+
usage: Usage;
|
|
42
52
|
} | {
|
|
43
53
|
type: "checkpoint";
|
|
44
54
|
id: string;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { type AgentMessage } from "../core/index.js";
|
|
2
|
-
export declare const DEFAULT_INSTRUCTION_MAX_BYTES: number;
|
|
3
2
|
export declare const DEFAULT_PROJECT_ROOT_MARKERS: string[];
|
|
4
3
|
export declare const DEFAULT_INSTRUCTION_FALLBACKS: string[];
|
|
5
4
|
export declare const INSTRUCTION_PRIMARY_NAMES: string[];
|
|
6
5
|
export interface InstructionSettings {
|
|
7
6
|
enabled?: boolean;
|
|
8
|
-
maxBytes?: number;
|
|
9
7
|
fallbackFilenames?: string[];
|
|
10
8
|
projectRootMarkers?: string[];
|
|
11
9
|
imports?: boolean;
|
|
@@ -22,7 +20,6 @@ export interface InstructionSource {
|
|
|
22
20
|
content: string;
|
|
23
21
|
scope: InstructionScope;
|
|
24
22
|
parent?: string;
|
|
25
|
-
truncated?: boolean;
|
|
26
23
|
}
|
|
27
24
|
export interface InstructionDiagnostic {
|
|
28
25
|
level: "warning";
|
|
@@ -35,8 +32,6 @@ export interface InstructionSnapshot {
|
|
|
35
32
|
sources: InstructionSource[];
|
|
36
33
|
diagnostics: InstructionDiagnostic[];
|
|
37
34
|
bytes: number;
|
|
38
|
-
maxBytes: number;
|
|
39
|
-
truncated: boolean;
|
|
40
35
|
signature: string;
|
|
41
36
|
}
|
|
42
37
|
export declare class InstructionLoader {
|
|
@@ -21,7 +21,7 @@ export interface CodingProfile extends Profile {
|
|
|
21
21
|
export declare function codingProfile(options?: CodingProfileOptions): Promise<CodingProfile>;
|
|
22
22
|
export type { GitRunner, ShadowCheckpointOptions } from "./checkpoint.js";
|
|
23
23
|
export { gitConfigNullDevice, ShadowCheckpointProvider } from "./checkpoint.js";
|
|
24
|
-
export { codingEnvironment, contextMessages, DEFAULT_INSTRUCTION_FALLBACKS,
|
|
24
|
+
export { codingEnvironment, contextMessages, DEFAULT_INSTRUCTION_FALLBACKS, DEFAULT_PROJECT_ROOT_MARKERS, discoverContextFiles, environmentMessage, type InstructionDiagnostic, InstructionLoader, type InstructionLoaderOptions, type InstructionSettings, type InstructionSnapshot, type InstructionSource, } from "./context.js";
|
|
25
25
|
export { CODING_PERMISSION_DEFAULTS, CODING_PERMISSION_MODES, layerPermissions, loadProjectConfig, rememberAllow, } from "./permissions.js";
|
|
26
26
|
export { codingPrompt } from "./prompts.js";
|
|
27
27
|
export { shellCommand, terminateProcessTree, windowsTaskkillCommand } from "./shell.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PermissionMode, PermissionRule } from "../core/index.js";
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
import type { InstructionSettings } from "./context.js";
|
|
3
4
|
export declare const CODING_PERMISSION_DEFAULTS: PermissionRule[];
|
|
4
5
|
export declare const CODING_PERMISSION_MODES: PermissionMode[];
|
|
@@ -6,8 +7,16 @@ export interface ProjectConfig {
|
|
|
6
7
|
permissions?: PermissionRule[];
|
|
7
8
|
model?: string;
|
|
8
9
|
instructions?: InstructionSettings;
|
|
10
|
+
[key: string]: unknown;
|
|
9
11
|
}
|
|
12
|
+
export declare const instructionSettingsSchema: z.ZodObject<{
|
|
13
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
fallbackFilenames: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
15
|
+
projectRootMarkers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
16
|
+
imports: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
claudeRules: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
}, z.core.$strip>;
|
|
10
19
|
export declare function configPath(root: string): string;
|
|
11
|
-
export declare function loadProjectConfig(root: string): Promise<ProjectConfig>;
|
|
20
|
+
export declare function loadProjectConfig(root: string, onWarning?: (message: string) => void): Promise<ProjectConfig>;
|
|
12
21
|
export declare function layerPermissions(...layers: (PermissionRule[] | undefined)[]): PermissionRule[];
|
|
13
22
|
export declare function rememberAllow(root: string, permission: string, pattern: string): Promise<void>;
|
|
@@ -9,4 +9,5 @@ export interface ProcessTreeTarget {
|
|
|
9
9
|
}
|
|
10
10
|
export declare function shellCommand(command: string, options?: ShellCommandOptions): string[];
|
|
11
11
|
export declare function windowsTaskkillCommand(pid: number): string[];
|
|
12
|
+
export declare function shellEnv(overrides?: Record<string, string>, toolDir?: () => string | undefined): Record<string, string | undefined>;
|
|
12
13
|
export declare function terminateProcessTree(process: ProcessTreeTarget, signal: NodeJS.Signals, platform?: NodeJS.Platform): void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare class FileState {
|
|
2
2
|
private reads;
|
|
3
3
|
private modified;
|
|
4
|
-
markRead(path: string): void;
|
|
4
|
+
markRead(path: string, content?: string): void;
|
|
5
5
|
markWritten(path: string): void;
|
|
6
6
|
hasRead(path: string): boolean;
|
|
7
|
-
isStale(path: string): boolean;
|
|
7
|
+
isStale(path: string, currentContent?: string): boolean;
|
|
8
8
|
readFiles(): string[];
|
|
9
9
|
modifiedFiles(): string[];
|
|
10
10
|
}
|
|
@@ -11,6 +11,8 @@ export interface ToolDeps {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
export declare function resolveInRoot(root: string, path: string): string;
|
|
14
|
+
export declare function resolveExistingInRoot(root: string, path: string): Promise<string>;
|
|
15
|
+
export declare function resolveForWriteInRoot(root: string, path: string): Promise<string>;
|
|
14
16
|
export declare function filePermissionDiff(path: string, before: string | undefined, after: string): CheckpointDiffFile;
|
|
15
17
|
export declare function readTool(deps: ToolDeps): import("../../sdk/index.js").Tool<{
|
|
16
18
|
path: string;
|
|
@@ -7,6 +7,7 @@ export declare class FileSessionStore implements SessionStore {
|
|
|
7
7
|
private readonly dir;
|
|
8
8
|
constructor(options?: FileSessionStoreOptions);
|
|
9
9
|
private path;
|
|
10
|
+
private fallbackId;
|
|
10
11
|
load(sessionId: string): Promise<SessionTree | undefined>;
|
|
11
12
|
save(sessionId: string, tree: SessionTree): Promise<void>;
|
|
12
13
|
list(): Promise<string[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { Credential, ModelDiscoveryOptions, ModelInfo, Provider, ProviderModelDiscoveryOptions, ThinkingLevel, Usage, } from "../ai/index.js";
|
|
2
|
-
export { builtinProviderConfigs, defaultModelRef, defaultThinkingLevel, discoverModels, findModel, listModels, providerHasCredentials, refreshModels, registerModels, registerProvider, supportedThinkingLevels, thinkingLevelForModel, } from "../ai/index.js";
|
|
2
|
+
export { builtinProviderConfigs, defaultModelId, defaultModelRef, defaultThinkingLevel, discoverModels, findModel, listModels, 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
5
|
export type { AgentOptions, AgentRunOptions, CheckpointActionData, CheckpointActionResult, HaltReason, ManualCompactionResult, RunResult, } from "./agent.js";
|