@wholiver_hu/metis 0.80.18 → 1.0.0-rc.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/AGENTS.md ADDED
@@ -0,0 +1,112 @@
1
+ # Agent Development Guide
2
+
3
+ This file is for AI coding agents contributing to Metis. Treat it as repository-level operating guidance. User and system instructions always take precedence.
4
+
5
+ ## Objective
6
+
7
+ Help developers change Metis quickly without sacrificing scope control, compatibility, or verification. Prefer evidence from the repository over assumptions.
8
+
9
+ ## Start Every Task
10
+
11
+ 1. Restate the requested outcome and concrete acceptance criteria.
12
+ 2. Read `git status` and preserve unrelated user changes.
13
+ 3. Search for relevant code, tests, docs, and existing abstractions before editing.
14
+ 4. Read the nearest applicable `AGENTS.md` if a nested one exists.
15
+ 5. Identify affected modes: TUI, print, JSON, RPC, SDK, Extensions, Packages.
16
+ 6. Decide the smallest validation set that can prove the change works.
17
+
18
+ If `.codegraph/` exists and its tools work, use CodeGraph before broad text search for code understanding. If the index is missing or malformed, state that once and fall back to `rg` and targeted file reads.
19
+
20
+ ## Repository Map
21
+
22
+ | Area | Primary paths |
23
+ | --- | --- |
24
+ | CLI entry and mode selection | `src/main.ts`, `src/cli/`, `src/modes/` |
25
+ | Agent session and SDK | `src/core/agent-session.ts`, `src/core/agent-session-runtime.ts`, `src/core/sdk.ts` |
26
+ | Built-in model tools | `src/core/tools/` |
27
+ | Extensions | `src/core/extensions/`, `docs/extensions.md`, `examples/extensions/` |
28
+ | Package loading | `src/core/package-manager.ts`, `docs/packages.md` |
29
+ | Dream and built-ins | `src/core/builtins/` |
30
+ | TUI | `src/modes/interactive/`, `vendor/metis-tui/` |
31
+ | RPC | `src/modes/rpc/`, `src/rpc-entry.ts` |
32
+ | Public exports | `src/index.ts` |
33
+ | Tests | `test/`, `vitest.config.ts` |
34
+ | User documentation | `README.md`, `README.zh-CN.md`, `docs/` |
35
+
36
+ Do not modify `vendor/` unless the requested behavior belongs to a vendored package. Do not edit generated `dist/` output by hand.
37
+
38
+ ## Implementation Loop
39
+
40
+ 1. **Investigate** — trace callers, state ownership, error handling, tests, and documentation.
41
+ 2. **Plan** — list files to change and checks to run. Avoid speculative rewrites.
42
+ 3. **Implement** — follow existing TypeScript and ESM patterns. Keep public types explicit.
43
+ 4. **Test** — cover success, failure, cancellation, empty input, boundaries, and regression risk.
44
+ 5. **Review** — inspect the diff for unrelated changes, stale docs, and accidental generated files.
45
+ 6. **Verify prompt fidelity** — compare the result with every original requirement and later clarification.
46
+
47
+ Never report completion while a required build, test, file, or user requirement remains unfinished.
48
+
49
+ ## Extension Changes
50
+
51
+ When adding or changing an Extension API:
52
+
53
+ - inspect `src/core/extensions/types.ts`, `runner.ts`, `loader.ts`, `wrapper.ts`, and public exports;
54
+ - preserve event ordering and document synchronous versus asynchronous behavior;
55
+ - pass cancellation through `AbortSignal` where work can block;
56
+ - define strict TypeBox schemas for registered tools;
57
+ - verify behavior in `tui`, `print`, `json`, and `rpc` modes;
58
+ - add or update a runnable example under `examples/extensions/`;
59
+ - update `docs/extensions.md` and `docs/packages.md` when distribution changes;
60
+ - test load, reload, shutdown, errors, state persistence, and dependency resolution.
61
+
62
+ Extensions run with full user permissions. Do not weaken trust checks or add silent destructive behavior.
63
+
64
+ ## Public API Changes
65
+
66
+ For exported types or functions:
67
+
68
+ - update `src/index.ts` and relevant subpath exports;
69
+ - check SDK and RPC consumers;
70
+ - avoid breaking changes unless explicitly authorized;
71
+ - document migration steps for unavoidable breaking changes;
72
+ - add type-level and runtime coverage.
73
+
74
+ ## Validation Commands
75
+
76
+ Run checks proportional to risk:
77
+
78
+ ```bash
79
+ npm run build
80
+ npm test
81
+ npm test -- test/specific.test.ts
82
+ ```
83
+
84
+ For docs and SVG changes also run:
85
+
86
+ ```bash
87
+ git diff --check
88
+ xmllint --noout docs/images/*.svg
89
+ ```
90
+
91
+ If a command hangs, identify the exact stage and process, stop only processes started by the current task, try one safe equivalent path, and report the unresolved blocker. A timeout is not a passing result.
92
+
93
+ ## Git and Workspace Safety
94
+
95
+ - Preserve unrelated modifications in dirty worktrees.
96
+ - Stage explicit files when scope is mixed.
97
+ - Do not use `git reset --hard`, discard user work, or force-push without explicit authorization.
98
+ - Do not commit secrets, `.env`, logs, sessions, local indexes, `outputs/`, or `dist/`.
99
+ - Use concise Conventional Commit messages.
100
+ - Do not publish, open a PR, or change external state unless the user requested it.
101
+
102
+ ## Handoff
103
+
104
+ Report:
105
+
106
+ - outcome first;
107
+ - files changed;
108
+ - validation run and exact result;
109
+ - any command that could not complete;
110
+ - remaining user action, only when truly required.
111
+
112
+ Keep the handoff concise. Do not hide uncertainty or claim tests passed when they did not run.