mocode-ai 0.4.7 → 0.4.9
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/core.d.ts +112 -0
- package/dist/agent/core.js +51 -11
- package/dist/agent/index.d.ts +19 -0
- package/dist/agent/mode.d.ts +29 -0
- package/dist/agent/spawn.d.ts +36 -0
- package/dist/attachments/image.d.ts +22 -0
- package/dist/commands/config.d.ts +8 -0
- package/dist/config/file.d.ts +23 -0
- package/dist/config/index.d.ts +114 -0
- package/dist/config/index.js +48 -1
- package/dist/config/presets.d.ts +57 -0
- package/dist/context/budget.d.ts +79 -0
- package/dist/context/classifier.d.ts +14 -0
- package/dist/context/encoders/_util.d.ts +11 -0
- package/dist/context/encoders/code.d.ts +2 -0
- package/dist/context/encoders/doc.d.ts +14 -0
- package/dist/context/encoders/graph.d.ts +11 -0
- package/dist/context/encoders/index.d.ts +2 -0
- package/dist/context/encoders/log.d.ts +2 -0
- package/dist/context/encoders/memory.d.ts +2 -0
- package/dist/context/encoders/passthrough.d.ts +11 -0
- package/dist/context/encoders/search.d.ts +2 -0
- package/dist/context/encoders/summary.d.ts +12 -0
- package/dist/context/encoders/table.d.ts +2 -0
- package/dist/context/encoders/tree.d.ts +2 -0
- package/dist/context/index.d.ts +6 -0
- package/dist/context/lifecycle.d.ts +51 -0
- package/dist/context/pipeline.d.ts +9 -0
- package/dist/context/registry.d.ts +9 -0
- package/dist/context/relevance.d.ts +65 -0
- package/dist/context/types.d.ts +36 -0
- package/dist/index.d.ts +1 -0
- package/dist/llm/capabilities.d.ts +19 -0
- package/dist/llm/index.d.ts +111 -0
- package/dist/memory/discover.d.ts +15 -0
- package/dist/memory/index.d.ts +13 -0
- package/dist/memory/reflect.d.ts +34 -0
- package/dist/memory/store.d.ts +124 -0
- package/dist/permissions/index.js +138 -0
- package/dist/pet/bridge.d.ts +73 -0
- package/dist/pet/protocol.d.ts +83 -0
- package/dist/pet/state.d.ts +28 -0
- package/dist/plan/active.d.ts +23 -0
- package/dist/plan/index.d.ts +13 -0
- package/dist/plan/state.d.ts +2 -0
- package/dist/plan/store.d.ts +78 -0
- package/dist/project-skill/index.js +129 -0
- package/dist/project-skill/initializer.js +179 -0
- package/dist/project-snapshot/index.js +177 -0
- package/dist/project-snapshot/static-files.js +87 -0
- package/dist/repl/index.d.ts +22 -0
- package/dist/repl/index.js +159 -1
- package/dist/rollback/index.d.ts +79 -0
- package/dist/sandbox/command.d.ts +3 -0
- package/dist/sandbox/index.d.ts +4 -0
- package/dist/sandbox/jail.d.ts +17 -0
- package/dist/sandbox/policy.d.ts +21 -0
- package/dist/sandbox/root.d.ts +5 -0
- package/dist/session/compact.d.ts +92 -0
- package/dist/session/drop.d.ts +19 -0
- package/dist/session/index.d.ts +13 -0
- package/dist/session/persist.d.ts +30 -0
- package/dist/session/scheduler.d.ts +53 -0
- package/dist/skills/discover.d.ts +33 -0
- package/dist/skills/index.d.ts +13 -0
- package/dist/tools/builtins/ask-human.d.ts +9 -0
- package/dist/tools/builtins/codegraph.d.ts +2 -0
- package/dist/tools/builtins/codegraph.js +17 -4
- package/dist/tools/builtins/drop-context.d.ts +18 -0
- package/dist/tools/builtins/edit-file.d.ts +2 -0
- package/dist/tools/builtins/edit-file.js +1 -0
- package/dist/tools/builtins/glob.d.ts +2 -0
- package/dist/tools/builtins/grep.d.ts +2 -0
- package/dist/tools/builtins/index.d.ts +2 -0
- package/dist/tools/builtins/index.js +7 -0
- package/dist/tools/builtins/memory-forget.d.ts +2 -0
- package/dist/tools/builtins/memory-forget.js +1 -0
- package/dist/tools/builtins/memory-list.d.ts +2 -0
- package/dist/tools/builtins/memory-save.d.ts +2 -0
- package/dist/tools/builtins/memory-save.js +1 -0
- package/dist/tools/builtins/memory-search.d.ts +2 -0
- package/dist/tools/builtins/memory-update.d.ts +2 -0
- package/dist/tools/builtins/memory-update.js +1 -0
- package/dist/tools/builtins/project-skill-update.js +73 -0
- package/dist/tools/builtins/read-file.d.ts +2 -0
- package/dist/tools/builtins/read-file.js +17 -1
- package/dist/tools/builtins/run-command.d.ts +2 -0
- package/dist/tools/builtins/run-command.js +1 -0
- package/dist/tools/builtins/switch-mode.d.ts +2 -0
- package/dist/tools/builtins/task.d.ts +2 -0
- package/dist/tools/builtins/task.js +1 -0
- package/dist/tools/builtins/todolist.d.ts +2 -0
- package/dist/tools/builtins/use-skill.d.ts +2 -0
- package/dist/tools/builtins/web-fetch.d.ts +2 -0
- package/dist/tools/builtins/web-search.d.ts +2 -0
- package/dist/tools/builtins/web-search.js +12 -1
- package/dist/tools/builtins/write-file.d.ts +2 -0
- package/dist/tools/builtins/write-file.js +1 -0
- package/dist/tools/constants.d.ts +52 -0
- package/dist/tools/registry.d.ts +18 -0
- package/dist/tools/types.d.ts +42 -0
- package/dist/ui/batch.d.ts +67 -0
- package/dist/ui/clipboard.d.ts +9 -0
- package/dist/ui/content.d.ts +55 -0
- package/dist/ui/content.js +14 -3
- package/dist/ui/diff.d.ts +34 -0
- package/dist/ui/diff.js +15 -24
- package/dist/ui/intervention.d.ts +46 -0
- package/dist/ui/layout.d.ts +225 -0
- package/dist/ui/layout.js +10 -0
- package/dist/ui/markdown.d.ts +46 -0
- package/dist/ui/mouse.d.ts +29 -0
- package/dist/ui/prompt.d.ts +61 -0
- package/dist/ui/render.d.ts +60 -0
- package/dist/ui/spinner.d.ts +26 -0
- package/dist/ui/theme.d.ts +47 -0
- package/dist/updater/index.d.ts +22 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 等待动画:在 await 长操作(chat / 工具执行 / 压缩)时旋转,避免「卡死」错觉。
|
|
3
|
+
*
|
|
4
|
+
* 两种渲染模式:
|
|
5
|
+
* - onFrame 回调(TUI 态):帧经回调刷状态行(layout.drawStatusBar),内容区保持静止、底栏转圈;
|
|
6
|
+
* 不在内容行用 \r\x1B[K 原地刷(那会擦内容、与滚动区域冲突)。
|
|
7
|
+
* - 无回调(非 TTY / 旧路径):\r\x1B[K 原地刷 braille 帧;非 TTY 退化为启动时打印一行静态提示。
|
|
8
|
+
*
|
|
9
|
+
* stop() 仅在确实旋转过(有 timer)时清场,避免对从未 start 的实例误清状态行。
|
|
10
|
+
*/
|
|
11
|
+
export declare class Spinner {
|
|
12
|
+
private readonly onFrame?;
|
|
13
|
+
private timer;
|
|
14
|
+
private frame;
|
|
15
|
+
private msg;
|
|
16
|
+
constructor(onFrame?: ((msg: string, frame: string | null) => void) | undefined);
|
|
17
|
+
start(msg: string): void;
|
|
18
|
+
private render;
|
|
19
|
+
stop(): void;
|
|
20
|
+
/**
|
|
21
|
+
* 暂停当前活跃 spinner(供 ask_human 介入面板进入前停转,避免 onFrame 覆盖面板)。
|
|
22
|
+
* 未转则 no-op(stop 内 `!this.timer` 守护);停转时 onFrame(msg,null) 触发 clearLiveAtCursor 清续写位帧。
|
|
23
|
+
* 不 resume——ask_human 的活儿就是面板本身,退出后 agent 的 spinner.stop() 是 no-op,下一轮 start 自然重启。
|
|
24
|
+
*/
|
|
25
|
+
static pauseCurrent(): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** 可切换的颜色字段(属性 bold/dim/reverse/reset 跨主题不变,不在此)。 */
|
|
2
|
+
export interface Palette {
|
|
3
|
+
red: string;
|
|
4
|
+
green: string;
|
|
5
|
+
yellow: string;
|
|
6
|
+
blue: string;
|
|
7
|
+
magenta: string;
|
|
8
|
+
cyan: string;
|
|
9
|
+
gray: string;
|
|
10
|
+
brightCyan: string;
|
|
11
|
+
brightMagenta: string;
|
|
12
|
+
/** 用户消息满宽背景色(上滑时易辨认)。 */
|
|
13
|
+
userBg: string;
|
|
14
|
+
/** diff 新增行整行底色——浅深主题下都柔和可辨,跟绿字 fg 配对;SGR 自洽,每行 reset 闭合。 */
|
|
15
|
+
addBg: string;
|
|
16
|
+
/** diff 删除行整行底色——同 addBg,跟红字 fg 配对。 */
|
|
17
|
+
delBg: string;
|
|
18
|
+
}
|
|
19
|
+
export type ColorKey = keyof Palette;
|
|
20
|
+
/**
|
|
21
|
+
* 切主题。name 未知则回退 default(不抛——启动时 config.theme 可能是用户填的任意值)。
|
|
22
|
+
* 仅当实际变更时自增 version(供缓存失效)。 */
|
|
23
|
+
export declare function setTheme(name: string): void;
|
|
24
|
+
export declare function getTheme(): string;
|
|
25
|
+
export declare function listThemes(): string[];
|
|
26
|
+
export declare function themeExists(name: string): boolean;
|
|
27
|
+
/** 主题版本号,每次 setTheme 实际变更自增;供 markdown MEMO 等缓存按版本失效。 */
|
|
28
|
+
export declare function getThemeVersion(): number;
|
|
29
|
+
export declare const ui: {
|
|
30
|
+
isTTY: boolean;
|
|
31
|
+
reset: string;
|
|
32
|
+
bold: string;
|
|
33
|
+
dim: string;
|
|
34
|
+
reverse: string;
|
|
35
|
+
readonly red: string;
|
|
36
|
+
readonly green: string;
|
|
37
|
+
readonly yellow: string;
|
|
38
|
+
readonly blue: string;
|
|
39
|
+
readonly magenta: string;
|
|
40
|
+
readonly cyan: string;
|
|
41
|
+
readonly gray: string;
|
|
42
|
+
readonly brightCyan: string;
|
|
43
|
+
readonly brightMagenta: string;
|
|
44
|
+
readonly userBg: string;
|
|
45
|
+
readonly addBg: string;
|
|
46
|
+
readonly delBg: string;
|
|
47
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface UpdateCache {
|
|
2
|
+
lastCheck?: number;
|
|
3
|
+
latest?: string;
|
|
4
|
+
lastSpawn?: number;
|
|
5
|
+
}
|
|
6
|
+
/** 简易 semver 比较(只管 X.Y.Z 数字,无 pre-release):a>b 返正,a<b 返负,等返 0。 */
|
|
7
|
+
export declare function compareSemver(a: string, b: string): number;
|
|
8
|
+
export interface UpdateDecision {
|
|
9
|
+
notice: string | null;
|
|
10
|
+
spawn: boolean;
|
|
11
|
+
refresh: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** 纯决策:据当前版本 / 缓存 / 时间,算是否提示 / spawn / 后台刷新。无副作用,可离线测。
|
|
14
|
+
* notice 同时携带当前版本(`current`)与最新版本(`latest`),让 REPL 提示能向用户
|
|
15
|
+
* 清晰展示"你正在用的 mocode 是 X,最新是 Y",不只是单调的"有新版本"。 */
|
|
16
|
+
export declare function evaluateUpdate(current: string, cache: UpdateCache, now: number): UpdateDecision;
|
|
17
|
+
/**
|
|
18
|
+
* 启动时调(同步,零延迟):返一行纯文本更新提示或 null。
|
|
19
|
+
* 流程:dev 跳过 → 读当前版本 → 读缓存 → evaluateUpdate 决策 → 按需后台刷新 / spawn → 返提示。
|
|
20
|
+
* 提示由 repl 上色写入内容区开场段(进 INPUT 态前)。
|
|
21
|
+
*/
|
|
22
|
+
export declare function checkAndMaybeUpdate(): string | null;
|