mia-code 0.2.0 → 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.
- package/.miette/260321.md +1 -0
- package/.miette/260323.md +9 -0
- package/.miette/260331.md +2 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/2604020008--d3417f2c-df12-4f0f-8a1b-d88e7968f822/d3417f2c-df12-4f0f-8a1b-d88e7968f822.md +63 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/2604020008--e6c3fc5d-4a70-4523-ba7d-a3250da4c235/e6c3fc5d-4a70-4523-ba7d-a3250da4c235.md +72 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/2604020008--efeb00a2-b17a-4d32-b1f0-b90c37a8d24e/efeb00a2-b17a-4d32-b1f0-b90c37a8d24e.md +62 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/83a2d7f9-24a5-4cf4-98d5-036c82f872e8.json +302 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/83a2d7f9-24a5-4cf4-98d5-036c82f872e8.md +149 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/AGENTS.md +31 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/meta-decomposition-3-children.md +67 -0
- package/.pde/2604040129--61f9dd4d-7aa6-45e6-a58b-e480b1aa6737/61f9dd4d-7aa6-45e6-a58b-e480b1aa6737--from-mia-openclaw-workspace.md +125 -0
- package/.pde/2604040129--61f9dd4d-7aa6-45e6-a58b-e480b1aa6737/STATUS.md +1 -0
- package/.pde/4f02ba94-9f52-422e-9389-b16f9b37f358.json +177 -0
- package/.pde/4f02ba94-9f52-422e-9389-b16f9b37f358.md +77 -0
- package/.pde/6ad9244d-5340-490f-b76c-c86728b9de52.json +222 -0
- package/.pde/6ad9244d-5340-490f-b76c-c86728b9de52.md +99 -0
- package/.pde/8b566792-ed15-4606-96f9-2b6f593d7e6b.json +111 -0
- package/.pde/8b566792-ed15-4606-96f9-2b6f593d7e6b.md +67 -0
- package/.pde/c7f1e74b-05a5-40e2-9f01-4cc48d2528f7.json +349 -0
- package/.pde/c7f1e74b-05a5-40e2-9f01-4cc48d2528f7.md +147 -0
- package/.pde/dfc00a78-1da0-4c09-8a16-c6982644051b.json +118 -0
- package/.pde/dfc00a78-1da0-4c09-8a16-c6982644051b.md +64 -0
- package/GUILLAUME.md +8 -0
- package/KINSHIP.md +9 -0
- package/MIA_CODE_ARCHITECTURE_REPORT.md +718 -0
- package/contextual_research/260119-MIA-CODE--98090899-8aff-4e11-9dc3-8b99466d1.md +1101 -0
- package/contextual_research/MIA.md +38 -0
- package/contextual_research/MIAWAPASCONE.md +59 -0
- package/contextual_research/MIETTE.md +38 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/2504.00218v2.pdf +7483 -12
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/2505.00212v3.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/CONTENT.md +1014 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/DESIGN.gemini.md +242 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/INDEX.md +45 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2504.00218v2.md +2025 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2504.00218v2.pdf +7483 -12
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2505.00212v3.md +1755 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2505.00212v3.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_12_decomposed_prompting.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_19_hugginggpt_planning.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_1_coordination_challenges.md +766 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_1_coordination_challenges.pdf +3431 -4
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_28_guardrails_multi_agent.md +260 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_28_guardrails_multi_agent.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_2_navigating_complexity.md +558 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_2_navigating_complexity.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_34_hierarchical_multi_agent.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_5_open_intent_extraction.pdf +0 -0
- package/contextual_research/PODCAST.md +109 -0
- package/contextual_research/langchain-principles-roadmap.md +157 -0
- package/contextual_research/persona-to-narrative-character-inquiry_260201.md +50 -0
- package/dist/cli.js +35 -11
- package/dist/geminiHeadless.js +8 -2
- package/dist/index.js +2 -1
- package/dist/mcp/miaco-server.js +10 -1
- package/dist/mcp/miatel-server.js +10 -1
- package/dist/mcp/miawa-server.js +10 -1
- package/dist/mcp/utils.d.ts +6 -1
- package/dist/mcp/utils.js +24 -3
- package/dist/sessionStore.d.ts +8 -2
- package/dist/sessionStore.js +39 -3
- package/dist/types.d.ts +1 -0
- package/miaco/README.md +124 -0
- package/miaco/dist/commands/chart.d.ts +6 -0
- package/miaco/dist/commands/chart.d.ts.map +1 -0
- package/miaco/dist/commands/chart.js +222 -0
- package/miaco/dist/commands/chart.js.map +1 -0
- package/miaco/dist/commands/decompose.d.ts +6 -0
- package/miaco/dist/commands/decompose.d.ts.map +1 -0
- package/miaco/dist/commands/decompose.js +98 -0
- package/miaco/dist/commands/decompose.js.map +1 -0
- package/miaco/dist/commands/schema.d.ts +6 -0
- package/miaco/dist/commands/schema.d.ts.map +1 -0
- package/miaco/dist/commands/schema.js +66 -0
- package/miaco/dist/commands/schema.js.map +1 -0
- package/miaco/dist/commands/stc.d.ts +11 -0
- package/miaco/dist/commands/stc.d.ts.map +1 -0
- package/miaco/dist/commands/stc.js +590 -0
- package/miaco/dist/commands/stc.js.map +1 -0
- package/miaco/dist/commands/trace.d.ts +6 -0
- package/miaco/dist/commands/trace.d.ts.map +1 -0
- package/miaco/dist/commands/trace.js +83 -0
- package/miaco/dist/commands/trace.js.map +1 -0
- package/miaco/dist/commands/validate.d.ts +6 -0
- package/miaco/dist/commands/validate.d.ts.map +1 -0
- package/miaco/dist/commands/validate.js +58 -0
- package/miaco/dist/commands/validate.js.map +1 -0
- package/miaco/dist/decompose.d.ts +93 -0
- package/miaco/dist/decompose.d.ts.map +1 -0
- package/miaco/dist/decompose.js +562 -0
- package/miaco/dist/decompose.js.map +1 -0
- package/miaco/dist/index.d.ts +18 -0
- package/miaco/dist/index.d.ts.map +1 -0
- package/miaco/dist/index.js +83 -0
- package/miaco/dist/index.js.map +1 -0
- package/miaco/dist/storage.d.ts +60 -0
- package/miaco/dist/storage.d.ts.map +1 -0
- package/miaco/dist/storage.js +100 -0
- package/miaco/dist/storage.js.map +1 -0
- package/miaco/package-lock.json +4103 -0
- package/miaco/package.json +40 -0
- package/miaco/tsconfig.json +18 -0
- package/miaco/version-patch-commit-and-publish.sh +1 -0
- package/miatel/MISSION_251231.md +3 -0
- package/miatel/README.md +107 -0
- package/miatel/dist/commands/analyze.d.ts +6 -0
- package/miatel/dist/commands/analyze.d.ts.map +1 -0
- package/miatel/dist/commands/analyze.js +100 -0
- package/miatel/dist/commands/analyze.js.map +1 -0
- package/miatel/dist/commands/arc.d.ts +6 -0
- package/miatel/dist/commands/arc.d.ts.map +1 -0
- package/miatel/dist/commands/arc.js +71 -0
- package/miatel/dist/commands/arc.js.map +1 -0
- package/miatel/dist/commands/beat.d.ts +6 -0
- package/miatel/dist/commands/beat.d.ts.map +1 -0
- package/miatel/dist/commands/beat.js +165 -0
- package/miatel/dist/commands/beat.js.map +1 -0
- package/miatel/dist/commands/theme.d.ts +6 -0
- package/miatel/dist/commands/theme.d.ts.map +1 -0
- package/miatel/dist/commands/theme.js +54 -0
- package/miatel/dist/commands/theme.js.map +1 -0
- package/miatel/dist/index.d.ts +18 -0
- package/miatel/dist/index.d.ts.map +1 -0
- package/miatel/dist/index.js +80 -0
- package/miatel/dist/index.js.map +1 -0
- package/miatel/dist/storage.d.ts +55 -0
- package/miatel/dist/storage.d.ts.map +1 -0
- package/miatel/dist/storage.js +100 -0
- package/miatel/dist/storage.js.map +1 -0
- package/miatel/package-lock.json +4103 -0
- package/miatel/package.json +35 -0
- package/miatel/src/commands/analyze.ts +109 -0
- package/miatel/src/commands/arc.ts +78 -0
- package/miatel/src/commands/beat.ts +176 -0
- package/miatel/src/commands/theme.ts +60 -0
- package/miatel/src/index.ts +94 -0
- package/miatel/src/storage.ts +156 -0
- package/miatel/tsconfig.json +18 -0
- package/miawa/MISSION_251231.md +144 -0
- package/miawa/README.md +133 -0
- package/miawa/dist/commands/beat.d.ts +6 -0
- package/miawa/dist/commands/beat.d.ts.map +1 -0
- package/miawa/dist/commands/beat.js +69 -0
- package/miawa/dist/commands/beat.js.map +1 -0
- package/miawa/dist/commands/ceremony.d.ts +6 -0
- package/miawa/dist/commands/ceremony.d.ts.map +1 -0
- package/miawa/dist/commands/ceremony.js +239 -0
- package/miawa/dist/commands/ceremony.js.map +1 -0
- package/miawa/dist/commands/circle.d.ts +6 -0
- package/miawa/dist/commands/circle.d.ts.map +1 -0
- package/miawa/dist/commands/circle.js +75 -0
- package/miawa/dist/commands/circle.js.map +1 -0
- package/miawa/dist/commands/eva.d.ts +6 -0
- package/miawa/dist/commands/eva.d.ts.map +1 -0
- package/miawa/dist/commands/eva.js +73 -0
- package/miawa/dist/commands/eva.js.map +1 -0
- package/miawa/dist/commands/wound.d.ts +6 -0
- package/miawa/dist/commands/wound.d.ts.map +1 -0
- package/miawa/dist/commands/wound.js +74 -0
- package/miawa/dist/commands/wound.js.map +1 -0
- package/miawa/dist/index.d.ts +19 -0
- package/miawa/dist/index.d.ts.map +1 -0
- package/miawa/dist/index.js +91 -0
- package/miawa/dist/index.js.map +1 -0
- package/miawa/dist/storage.d.ts +73 -0
- package/miawa/dist/storage.d.ts.map +1 -0
- package/miawa/dist/storage.js +100 -0
- package/miawa/dist/storage.js.map +1 -0
- package/miawa/package-lock.json +4103 -0
- package/miawa/package.json +36 -0
- package/miawa/src/commands/beat.ts +74 -0
- package/miawa/src/commands/ceremony.ts +256 -0
- package/miawa/src/commands/circle.ts +83 -0
- package/miawa/src/commands/eva.ts +84 -0
- package/miawa/src/commands/wound.ts +79 -0
- package/miawa/src/index.ts +108 -0
- package/miawa/src/storage.ts +179 -0
- package/miawa/tsconfig.json +18 -0
- package/package.json +7 -5
- package/references/acp/CLAUDE.md +7 -0
- package/references/acp/agent-plan.md +84 -0
- package/references/acp/clients.md +31 -0
- package/references/acp/extensibility.md +137 -0
- package/references/acp/initialization.md +225 -0
- package/references/acp/prompt-turn.md +321 -0
- package/references/acp/proxy-chains.md +562 -0
- package/references/acp/schema.md +3171 -0
- package/references/acp/session-list.md +334 -0
- package/references/acp/session-modes.md +170 -0
- package/references/acp/slash-commands.md +99 -0
- package/references/acp/terminals.md +281 -0
- package/references/acp/tool-calls.md +311 -0
- package/references/acp/typescript.md +29 -0
- package/references/claude/agent-teams.md +399 -0
- package/references/claude/chrome.md +231 -0
- package/references/claude/headless.md +158 -0
- package/references/claude/hooks-guide.md +708 -0
- package/references/claude/output-styles.md +112 -0
- package/references/claude/plugins.md +432 -0
- package/references/claude/skills.md +693 -0
- package/references/claude/sub-agents.md +816 -0
- package/references/copilot/acp/agents.md +32 -0
- package/references/copilot/acp/architecture.md +37 -0
- package/references/copilot/acp/clients.md +31 -0
- package/references/copilot/acp/introduction.md +42 -0
- package/references/copilot/acp/registry.md +339 -0
- package/references/copilot/acp-server.md +117 -0
- package/references/copilot/create-copilot-instructions.md +840 -0
- package/references/langchain/llms.txt +833 -0
- package/references/langchain/python/agents.md +677 -0
- package/references/langchain/python/context-engineering.md +1195 -0
- package/references/langchain/python/human-in-the-loop.md +326 -0
- package/references/langchain/python/long-term-memory.md +168 -0
- package/references/langchain/python/mcp.md +949 -0
- package/references/langchain/python/multi-agents/custom-workflow.md +187 -0
- package/references/langchain/python/multi-agents/handoffs.md +436 -0
- package/references/langchain/python/multi-agents/overview.md +295 -0
- package/references/langchain/python/multi-agents/router.md +150 -0
- package/references/langchain/python/multi-agents/skills.md +92 -0
- package/references/langchain/python/multi-agents/subagents.md +486 -0
- package/references/langchain/python/retrieval.md +320 -0
- package/references/langchain/python/runtime.md +141 -0
- package/references/langchain/python/short-term-memory.md +658 -0
- package/references/langchain/python/structured-output.md +712 -0
- package/references/langfuse/llms.txt +148 -0
- package/references/langgraph/javascript/llms.txt +275 -0
- package/references/skills/home.md +259 -0
- package/references/skills/integrate-skills.md +103 -0
- package/references/skills/specification.md +254 -0
- package/references/skills/what-are-skills.md +74 -0
- package/rispecs/README.md +164 -0
- package/rispecs/_sync_/miadi-code/SPEC.md +313 -0
- package/rispecs/_sync_/miadi-code/STATUS.md +177 -0
- package/rispecs/_sync_/miadi-code/dashboard/SPEC.md +465 -0
- package/rispecs/_sync_/miadi-code/dashboard/STATUS.md +212 -0
- package/rispecs/_sync_/miadi-code/multiline-input/SPEC.md +232 -0
- package/rispecs/_sync_/miadi-code/multiline-input/STATUS.md +108 -0
- package/rispecs/_sync_/miadi-code/pde/SPEC.md +253 -0
- package/rispecs/_sync_/miadi-code/pde/STATUS.md +56 -0
- package/rispecs/_sync_/miadi-code/stc/SPEC.md +397 -0
- package/rispecs/_sync_/miadi-code/stc/STATUS.md +70 -0
- package/rispecs/ava-langstack/inquiry-routing-upgrade.spec.md +119 -0
- package/rispecs/borrowed_from_opencode/001-client-server-architecture.rispec.md +98 -0
- package/rispecs/borrowed_from_opencode/002-event-bus-system.rispec.md +125 -0
- package/rispecs/borrowed_from_opencode/003-instance-state-pattern.rispec.md +136 -0
- package/rispecs/borrowed_from_opencode/004-namespace-module-pattern.rispec.md +151 -0
- package/rispecs/borrowed_from_opencode/005-zod-schema-validation.rispec.md +139 -0
- package/rispecs/borrowed_from_opencode/006-named-error-system.rispec.md +155 -0
- package/rispecs/borrowed_from_opencode/007-structured-logging.rispec.md +138 -0
- package/rispecs/borrowed_from_opencode/008-lazy-initialization.rispec.md +127 -0
- package/rispecs/borrowed_from_opencode/009-multi-agent-system.rispec.md +97 -0
- package/rispecs/borrowed_from_opencode/010-agent-definition-config.rispec.md +135 -0
- package/rispecs/borrowed_from_opencode/011-agent-permission-rulesets.rispec.md +151 -0
- package/rispecs/borrowed_from_opencode/012-agent-prompt-templates.rispec.md +141 -0
- package/rispecs/borrowed_from_opencode/013-agent-generation.rispec.md +142 -0
- package/rispecs/borrowed_from_opencode/014-plan-build-mode-toggle.rispec.md +155 -0
- package/rispecs/borrowed_from_opencode/015-subagent-task-delegation.rispec.md +146 -0
- package/rispecs/borrowed_from_opencode/016-agent-model-selection.rispec.md +151 -0
- package/rispecs/borrowed_from_opencode/017-compaction-agent.rispec.md +150 -0
- package/rispecs/borrowed_from_opencode/018-session-persistence.rispec.md +125 -0
- package/rispecs/borrowed_from_opencode/019-session-compaction.rispec.md +132 -0
- package/rispecs/borrowed_from_opencode/020-session-forking.rispec.md +134 -0
- package/rispecs/borrowed_from_opencode/021-session-revert-snapshot.rispec.md +135 -0
- package/rispecs/borrowed_from_opencode/022-session-sharing.rispec.md +165 -0
- package/rispecs/borrowed_from_opencode/023-session-summary-diffs.rispec.md +165 -0
- package/rispecs/borrowed_from_opencode/024-child-sessions.rispec.md +164 -0
- package/rispecs/borrowed_from_opencode/025-session-title-generation.rispec.md +162 -0
- package/rispecs/borrowed_from_opencode/026-message-parts-model.rispec.md +201 -0
- package/rispecs/borrowed_from_opencode/027-streaming-message-deltas.rispec.md +212 -0
- package/rispecs/borrowed_from_opencode/028-multi-provider-architecture.rispec.md +184 -0
- package/rispecs/borrowed_from_opencode/029-provider-authentication.rispec.md +225 -0
- package/rispecs/borrowed_from_opencode/030-model-registry.rispec.md +222 -0
- package/rispecs/borrowed_from_opencode/031-cost-tracking.rispec.md +243 -0
- package/rispecs/borrowed_from_opencode/032-provider-transform-pipeline.rispec.md +282 -0
- package/rispecs/borrowed_from_opencode/033-provider-sdk-abstraction.rispec.md +338 -0
- package/rispecs/borrowed_from_opencode/034-tool-registry.rispec.md +110 -0
- package/rispecs/borrowed_from_opencode/035-tool-context-injection.rispec.md +155 -0
- package/rispecs/borrowed_from_opencode/036-tool-output-truncation.rispec.md +138 -0
- package/rispecs/borrowed_from_opencode/037-batch-tool.rispec.md +129 -0
- package/rispecs/borrowed_from_opencode/038-multi-edit-tool.rispec.md +167 -0
- package/rispecs/borrowed_from_opencode/039-apply-patch-tool.rispec.md +161 -0
- package/rispecs/borrowed_from_opencode/040-code-search-tool.rispec.md +143 -0
- package/rispecs/borrowed_from_opencode/041-web-fetch-tool.rispec.md +131 -0
- package/rispecs/borrowed_from_opencode/042-web-search-tool.rispec.md +159 -0
- package/rispecs/borrowed_from_opencode/043-todo-tool.rispec.md +156 -0
- package/rispecs/borrowed_from_opencode/044-plan-mode-tool.rispec.md +139 -0
- package/rispecs/borrowed_from_opencode/045-task-tool.rispec.md +146 -0
- package/rispecs/borrowed_from_opencode/046-question-tool.rispec.md +170 -0
- package/rispecs/borrowed_from_opencode/047-external-directory-tool.rispec.md +166 -0
- package/rispecs/borrowed_from_opencode/048-file-read-write-tools.rispec.md +205 -0
- package/rispecs/borrowed_from_opencode/049-lsp-server-management.rispec.md +104 -0
- package/rispecs/borrowed_from_opencode/050-lsp-hover-completion.rispec.md +102 -0
- package/rispecs/borrowed_from_opencode/051-lsp-diagnostics.rispec.md +86 -0
- package/rispecs/borrowed_from_opencode/052-lsp-root-detection.rispec.md +109 -0
- package/rispecs/borrowed_from_opencode/053-remote-mcp-servers.rispec.md +119 -0
- package/rispecs/borrowed_from_opencode/054-mcp-oauth-flow.rispec.md +107 -0
- package/rispecs/borrowed_from_opencode/055-mcp-tool-conversion.rispec.md +118 -0
- package/rispecs/borrowed_from_opencode/056-mcp-connection-monitoring.rispec.md +106 -0
- package/rispecs/borrowed_from_opencode/057-local-mcp-servers.rispec.md +116 -0
- package/rispecs/borrowed_from_opencode/058-rich-tui.rispec.md +108 -0
- package/rispecs/borrowed_from_opencode/059-streaming-display.rispec.md +116 -0
- package/rispecs/borrowed_from_opencode/060-permission-prompts.rispec.md +130 -0
- package/rispecs/borrowed_from_opencode/061-session-navigation.rispec.md +155 -0
- package/rispecs/borrowed_from_opencode/062-syntax-highlighting.rispec.md +151 -0
- package/rispecs/borrowed_from_opencode/063-keybinding-system.rispec.md +181 -0
- package/rispecs/borrowed_from_opencode/064-multi-level-config.rispec.md +155 -0
- package/rispecs/borrowed_from_opencode/065-jsonc-config.rispec.md +190 -0
- package/rispecs/borrowed_from_opencode/066-config-env-variables.rispec.md +153 -0
- package/rispecs/borrowed_from_opencode/067-config-deep-merging.rispec.md +178 -0
- package/rispecs/borrowed_from_opencode/068-remote-org-config.rispec.md +183 -0
- package/rispecs/borrowed_from_opencode/069-config-markdown-frontmatter.rispec.md +206 -0
- package/rispecs/borrowed_from_opencode/070-managed-config-directory.rispec.md +232 -0
- package/rispecs/borrowed_from_opencode/071-plugin-architecture.rispec.md +104 -0
- package/rispecs/borrowed_from_opencode/072-plugin-hooks.rispec.md +123 -0
- package/rispecs/borrowed_from_opencode/073-plugin-auto-install.rispec.md +115 -0
- package/rispecs/borrowed_from_opencode/074-permission-system.rispec.md +133 -0
- package/rispecs/borrowed_from_opencode/075-git-worktree-management.rispec.md +126 -0
- package/rispecs/borrowed_from_opencode/076-snapshot-system.rispec.md +124 -0
- package/rispecs/borrowed_from_opencode/077-snapshot-diff.rispec.md +117 -0
- package/rispecs/borrowed_from_opencode/078-snapshot-restore.rispec.md +128 -0
- package/rispecs/borrowed_from_opencode/079-worktree-branch-naming.rispec.md +122 -0
- package/rispecs/borrowed_from_opencode/080-sqlite-storage.rispec.md +134 -0
- package/rispecs/borrowed_from_opencode/081-database-migrations.rispec.md +148 -0
- package/rispecs/borrowed_from_opencode/082-database-transactions.rispec.md +138 -0
- package/rispecs/borrowed_from_opencode/083-deferred-effects.rispec.md +148 -0
- package/rispecs/borrowed_from_opencode/084-permission-rules.rispec.md +123 -0
- package/rispecs/borrowed_from_opencode/085-permission-glob-patterns.rispec.md +113 -0
- package/rispecs/borrowed_from_opencode/086-permission-merging.rispec.md +134 -0
- package/rispecs/borrowed_from_opencode/087-permission-modes.rispec.md +145 -0
- package/rispecs/borrowed_from_opencode/088-http-api-server.rispec.md +165 -0
- package/rispecs/borrowed_from_opencode/089-openapi-spec-generation.rispec.md +164 -0
- package/rispecs/borrowed_from_opencode/090-websocket-support.rispec.md +136 -0
- package/rispecs/borrowed_from_opencode/091-sse-streaming.rispec.md +168 -0
- package/rispecs/borrowed_from_opencode/092-mdns-discovery.rispec.md +145 -0
- package/rispecs/borrowed_from_opencode/093-javascript-sdk.rispec.md +200 -0
- package/rispecs/borrowed_from_opencode/094-skill-system.rispec.md +187 -0
- package/rispecs/borrowed_from_opencode/095-skill-discovery.rispec.md +182 -0
- package/rispecs/borrowed_from_opencode/096-desktop-remote-driving.rispec.md +175 -0
- package/rispecs/borrowed_from_opencode/INDEX.md +255 -0
- package/rispecs/core.rispecs.md +261 -0
- package/rispecs/engines.rispecs.md +241 -0
- package/rispecs/formatting.rispecs.md +252 -0
- package/rispecs/living-specifications.rispecs.md +361 -0
- package/rispecs/mcp.rispecs.md +197 -0
- package/rispecs/pde.rispecs.md +399 -0
- package/rispecs/pi-mono-envisionning/ENVISIONING.md +366 -0
- package/rispecs/pi-mono-envisionning/storytelling-horizon.rispecs.md +76 -0
- package/rispecs/pi-mono-envisionning/widget.rispecs.md +2 -0
- package/rispecs/relation-to-mcp-structural-thinking.kin.md +72 -0
- package/rispecs/research-for-better-framework/CLAUDE.md +7 -0
- package/rispecs/research-for-better-framework/survey-pi-openclaw-opencode-openhands.md +210 -0
- package/rispecs/session.rispecs.md +277 -0
- package/rispecs/stc.rispecs.md +138 -0
- package/rispecs/unifier.rispecs.md +317 -0
- package/scripts/LAUNCH--mcp-mia-code--testing--2603141315--ac705a66-2c15-4a1c-a26d-9491018c5ba8.sh +2 -0
- package/scripts/RESUME--mia-code--mcps--260313--ac705a66-2c15-4a1c-a26d-9491018c5ba8.sh +1 -0
- package/scripts/install-widget-in-home-pi-agent-extensions.sh +4 -0
- package/scripts/sample-decompose--2604011535-prompt.sh +1 -0
- package/skills/deep-search/AGENTS.md +17 -0
- package/skills/deep-search/SKILL.md +281 -0
- package/skills/deep-search/agent-templates.md +224 -0
- package/skills/deep-search/orchestration-patterns.md +95 -0
- package/skills/miaco-pde-inquiry-routing-deep-search/AGENTS.md +13 -0
- package/skills/miaco-pde-inquiry-routing-deep-search/SKILL.md +136 -0
- package/skills/miaco-pde-inquiry-routing-internal-external-relationship/AGENTS.md +4 -0
- package/skills/miaco-pde-inquiry-routing-internal-external-relationship/SKILL.md +157 -0
- package/skills/miaco-pde-inquiry-routing-local-qmd/AGENTS.md +42 -0
- package/skills/miaco-pde-inquiry-routing-local-qmd/SKILL.md +135 -0
- package/skills/qmd/AGENTS.md +3 -0
- package/skills/qmd/SKILL.md +144 -0
- package/skills/qmd/references/mcp-setup.md +102 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/SKILL.md +234 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/agent-templates.md +436 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/orchestration-patterns.md +197 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/references/ceremonial-technology.md +102 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/references/creative-orientation.md +99 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/references/prompt-decomposition.md +73 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/references/rise-framework.md +74 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/references/structural-tension.md +82 -0
- package/src/cli.ts +35 -11
- package/src/geminiHeadless.ts +7 -2
- package/src/index.ts +2 -1
- package/src/mcp/miaco-server.ts +13 -1
- package/src/mcp/miatel-server.ts +13 -1
- package/src/mcp/miawa-server.ts +13 -1
- package/src/mcp/utils.ts +41 -8
- package/src/sessionStore.ts +44 -4
- package/src/types.ts +2 -1
- package/widget/mia-ceremony/README.md +36 -0
- package/widget/mia-ceremony/index.ts +143 -0
- package/widget/mia-interceptor/README.md +39 -0
- package/widget/mia-interceptor/index.ts +221 -0
- package/widget/mia-tools/README.md +37 -0
- package/widget/mia-tools/index.ts +569 -0
- package/widget/miette-echo/README.md +44 -0
- package/widget/miette-echo/index.ts +164 -0
- package/.claude/settings.local.json +0 -9
- package/.hch/issue_.env +0 -4
- package/.hch/issue_add__2601211715.json +0 -77
- package/.hch/issue_add__2601211715.md +0 -4
- package/.hch/issue_add__2602242020.json +0 -78
- package/.hch/issue_add__2602242020.md +0 -7
- package/.hch/issues.json +0 -2312
- package/.hch/issues.md +0 -30
- package/WS__mia-code__260214__IAIP_PDE.code-workspace +0 -29
- package/WS__mia-code__src332__260122.code-workspace +0 -23
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/checkpoints/index.md +0 -6
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/events.jsonl +0 -213
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/plan.md +0 -243
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/workspace.yaml +0 -5
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# RISE-036: Tool Output Truncation
|
|
2
|
+
|
|
3
|
+
> RISE Framework Specification — Borrowed from OpenCode for mia-code
|
|
4
|
+
> Document: rispecs/borrowed_from_opencode/036-tool-output-truncation.rispec.md
|
|
5
|
+
|
|
6
|
+
## Creative Intent
|
|
7
|
+
|
|
8
|
+
mia-code automatically truncates tool outputs that exceed configurable size limits, preventing context window overflow while preserving the most useful information. When a tool produces output larger than the threshold, the system saves the full output to a reference file and inserts a truncated version — first lines, last lines, and a pointer to the full content — into the conversation. The agent retains enough signal to reason about the output and can read the full file if deeper inspection is needed. This turns unbounded tool output from a context-destroying hazard into a managed, referential resource.
|
|
9
|
+
|
|
10
|
+
## Structural Tension Analysis
|
|
11
|
+
|
|
12
|
+
**Current Reality:**
|
|
13
|
+
- Tool outputs flow directly into the conversation context with no size management
|
|
14
|
+
- A single `grep` across a large codebase can produce megabytes of output, consuming the entire context window
|
|
15
|
+
- Once the context window overflows, the agent loses coherence — earlier messages are silently dropped
|
|
16
|
+
- There is no mechanism to save large outputs for later reference
|
|
17
|
+
- The developer must manually truncate commands (adding `| head -50`) to prevent context overflow
|
|
18
|
+
- Different output types (JSON, logs, code) are all truncated identically — no structural awareness
|
|
19
|
+
|
|
20
|
+
**Desired State:**
|
|
21
|
+
- Tool outputs exceeding a configurable limit (default: 20KB) are automatically truncated
|
|
22
|
+
- Full output is saved to `.mia-code/outputs/{hash}.txt` for later reference
|
|
23
|
+
- Truncated output shows: first N lines, `... truncated ({original_size}) ...`, last M lines, and a file reference
|
|
24
|
+
- Per-tool configurable limits allow fine-tuning (e.g., search results get 10KB, file reads get 30KB)
|
|
25
|
+
- Smart truncation adapts to content type: JSON arrays truncate inner elements, logs keep first/last sections, code preserves structure
|
|
26
|
+
- Truncation metadata (original size, truncated size, output file path) is attached to the result
|
|
27
|
+
|
|
28
|
+
## Desired Outcome Definition
|
|
29
|
+
|
|
30
|
+
The agent runs a grep that matches 2,000 lines across 150 files. Instead of injecting 180KB into the context, the truncation system saves the full output to `.mia-code/outputs/a7f3c2.txt`, injects the first 30 lines and last 20 lines with a reference note, and the agent reasons over the visible subset. If the agent needs line 847, it reads the output file directly.
|
|
31
|
+
|
|
32
|
+
## Natural Language Functional Description
|
|
33
|
+
|
|
34
|
+
### Truncation Pipeline
|
|
35
|
+
|
|
36
|
+
When a tool returns its result, the output passes through the truncation pipeline before entering the conversation:
|
|
37
|
+
|
|
38
|
+
1. **Size check** — measure the output in bytes (UTF-8 encoded)
|
|
39
|
+
2. **Threshold comparison** — compare against the tool's configured limit or the global default (20KB)
|
|
40
|
+
3. **If under limit** — pass through unchanged
|
|
41
|
+
4. **If over limit** — save full output to file, generate truncated version, attach metadata
|
|
42
|
+
|
|
43
|
+
### Output File Storage
|
|
44
|
+
|
|
45
|
+
Full outputs are saved to `.mia-code/outputs/` with content-hash filenames:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
.mia-code/outputs/a7f3c2e9.txt # hash of content for deduplication
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Files are named by a truncated SHA-256 hash of the content, ensuring identical outputs share the same file. An index file `.mia-code/outputs/index.json` maps hashes to metadata:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"a7f3c2e9": {
|
|
56
|
+
"tool": "bash",
|
|
57
|
+
"sessionId": "sess_abc123",
|
|
58
|
+
"timestamp": "2026-03-01T14:30:00Z",
|
|
59
|
+
"originalSize": 184320,
|
|
60
|
+
"lineCount": 2047
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Truncated Output Format
|
|
66
|
+
|
|
67
|
+
The truncated output preserves the most informative parts:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
[first 30 lines of output]
|
|
71
|
+
|
|
72
|
+
... truncated (180KB, 2047 lines) — full output: .mia-code/outputs/a7f3c2e9.txt ...
|
|
73
|
+
|
|
74
|
+
[last 20 lines of output]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The first/last line counts are configurable. Defaults: 30 lines from the top, 20 from the bottom.
|
|
78
|
+
|
|
79
|
+
### Smart Truncation by Content Type
|
|
80
|
+
|
|
81
|
+
The truncation engine detects content type and applies type-appropriate strategies:
|
|
82
|
+
|
|
83
|
+
- **JSON** — parse the JSON, truncate large arrays by keeping first 5 and last 5 elements with a count note, re-serialize. Object keys are never truncated — only array values.
|
|
84
|
+
- **Log output** — keep first section (often headers and initial entries) and last section (most recent entries). Middle section replaced with line count.
|
|
85
|
+
- **Code / source files** — preserve the file's opening declarations (imports, class definitions) and closing sections. Middle body truncated with line range note.
|
|
86
|
+
- **Tabular data** — keep header row plus first N and last M data rows. Column alignment preserved.
|
|
87
|
+
- **Plain text** — simple first/last line truncation with byte count.
|
|
88
|
+
|
|
89
|
+
Content type is inferred from the tool ID and output content heuristics (leading `{` or `[` for JSON, timestamp patterns for logs, etc.).
|
|
90
|
+
|
|
91
|
+
### Per-Tool Configuration
|
|
92
|
+
|
|
93
|
+
Each tool can specify its own truncation limit:
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
{
|
|
97
|
+
id: "file_read",
|
|
98
|
+
truncation: { maxBytes: 30720, firstLines: 50, lastLines: 30 }
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Tools that produce inherently large output (like search) can have lower limits, while tools that produce high-value output (like file reads) can have higher ones.
|
|
103
|
+
|
|
104
|
+
### Truncation Metadata
|
|
105
|
+
|
|
106
|
+
Every truncated result includes metadata attached via `context.metadata()` (RISE-035):
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
{
|
|
110
|
+
truncated: true,
|
|
111
|
+
originalSize: 184320,
|
|
112
|
+
truncatedSize: 4096,
|
|
113
|
+
outputFile: ".mia-code/outputs/a7f3c2e9.txt",
|
|
114
|
+
lineCount: { original: 2047, kept: 50 }
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Supporting Structures
|
|
119
|
+
|
|
120
|
+
- **Tool Registry (RISE-034)** applies truncation after tool execution and before result injection
|
|
121
|
+
- **Tool Context Injection (RISE-035)** provides `metadata()` for attaching truncation info
|
|
122
|
+
- **Managed Config Directory (RISE-070)** hosts the `.mia-code/outputs/` directory
|
|
123
|
+
- **File Read/Write Tools (RISE-048)** allow the agent to read full output files when needed
|
|
124
|
+
- **Multi-Level Config (RISE-064)** allows per-project truncation limit overrides
|
|
125
|
+
|
|
126
|
+
## Creative Advancement Scenarios
|
|
127
|
+
|
|
128
|
+
**Scenario 1 — Grep Safety Net:**
|
|
129
|
+
The agent runs `grep -r "TODO" .` on a large project. The result is 3,400 lines. Truncation saves the full output, injects the first 30 and last 20 lines, and notes "3,400 lines total." The agent sees enough to identify patterns and tells the user: "Found TODOs across 89 files — the most frequent are in src/legacy/. Full results saved to .mia-code/outputs/b4e1f2.txt."
|
|
130
|
+
|
|
131
|
+
**Scenario 2 — JSON Array Truncation:**
|
|
132
|
+
A tool returns a 500-element JSON array of test results. Smart truncation keeps the array structure but reduces it to the first 5 and last 5 elements with `"... 490 more items ..."`. The agent can still see the schema of each element and the total count without consuming 200KB of context.
|
|
133
|
+
|
|
134
|
+
**Scenario 3 — Agent Self-Service:**
|
|
135
|
+
After seeing truncated search results, the agent decides it needs line 200-250 specifically. It reads the output file with `file_read` using a line range, getting exactly the data it needs. The truncation system enabled a two-step retrieval pattern: overview first, detail on demand.
|
|
136
|
+
|
|
137
|
+
**Scenario 4 — Configurable Limits:**
|
|
138
|
+
A project with huge generated files sets `.mia-code/config.json` to increase `file_read` truncation to 50KB. Another project with tight context budgets sets the global default to 10KB. Both projects get appropriate behavior without code changes.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# RISE-037: Batch File Operations Tool
|
|
2
|
+
|
|
3
|
+
> RISE Framework Specification — Borrowed from OpenCode for mia-code
|
|
4
|
+
> Document: rispecs/borrowed_from_opencode/037-batch-tool.rispec.md
|
|
5
|
+
|
|
6
|
+
## Creative Intent
|
|
7
|
+
|
|
8
|
+
mia-code provides a batch tool that executes multiple file operations — create, edit, delete — as a single atomic transaction. All operations succeed together or all roll back, eliminating the partial-failure state that plagues multi-file refactoring. The agent describes all intended changes in one tool call, the batch tool validates them, takes a snapshot, executes them, and reports results. When a rename touches an import in 12 files, either all 12 are updated or none are — the codebase is never left in an inconsistent state.
|
|
9
|
+
|
|
10
|
+
## Structural Tension Analysis
|
|
11
|
+
|
|
12
|
+
**Current Reality:**
|
|
13
|
+
- mia-code performs file operations one at a time through the underlying CLI's tools
|
|
14
|
+
- A refactoring that touches 8 files requires 8 separate tool calls — if the 5th fails, the first 4 are already committed
|
|
15
|
+
- There is no rollback mechanism — partial failures leave the codebase in an inconsistent state
|
|
16
|
+
- The agent must reason about operation ordering to avoid conflicts (e.g., don't delete a file before copying its content)
|
|
17
|
+
- Validation happens at execution time — an invalid path in operation 7 is discovered only after operations 1-6 have completed
|
|
18
|
+
- The LLM's context is consumed by 8 separate tool call/result cycles instead of one
|
|
19
|
+
|
|
20
|
+
**Desired State:**
|
|
21
|
+
- A single `batch` tool call accepts an array of file operations
|
|
22
|
+
- All operations are validated before any execute — invalid paths, missing files, and conflicts detected upfront
|
|
23
|
+
- A filesystem snapshot is taken before execution for rollback capability
|
|
24
|
+
- Operations execute in order; if any fails, all previous operations are rolled back from the snapshot
|
|
25
|
+
- A dry-run mode validates and reports what would happen without executing
|
|
26
|
+
- One tool call, one result — reduced context consumption for multi-file changes
|
|
27
|
+
|
|
28
|
+
## Desired Outcome Definition
|
|
29
|
+
|
|
30
|
+
The agent needs to rename a React component from `UserList` to `TeamMembers` across 6 files. It issues a single batch tool call with 6 edit operations. The batch tool validates all 6, snapshots the affected files, executes them sequentially, and returns a summary: "6/6 operations succeeded." If the 4th edit fails (target string not found), operations 1-3 are rolled back and the error identifies exactly which operation failed and why.
|
|
31
|
+
|
|
32
|
+
## Natural Language Functional Description
|
|
33
|
+
|
|
34
|
+
### Input Format
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
interface BatchInput {
|
|
38
|
+
operations: BatchOperation[];
|
|
39
|
+
dryRun?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type BatchOperation =
|
|
43
|
+
| { type: "create"; path: string; content: string }
|
|
44
|
+
| { type: "edit"; path: string; old: string; new: string }
|
|
45
|
+
| { type: "delete"; path: string };
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Execution Pipeline
|
|
49
|
+
|
|
50
|
+
1. **Parse** — validate the input structure against the Zod schema
|
|
51
|
+
2. **Pre-validate** — for each operation:
|
|
52
|
+
- `create`: verify file does not already exist, verify parent directory exists or can be created
|
|
53
|
+
- `edit`: verify file exists, verify `old` string appears exactly once in the file
|
|
54
|
+
- `delete`: verify file exists
|
|
55
|
+
3. **Snapshot** — copy affected files to a temporary snapshot directory (RISE-076)
|
|
56
|
+
4. **Execute** — apply operations in order:
|
|
57
|
+
- `create`: write file with content, creating parent directories as needed
|
|
58
|
+
- `edit`: replace `old` with `new` in the file content
|
|
59
|
+
- `delete`: remove the file
|
|
60
|
+
5. **Rollback on failure** — if any operation fails during execution, restore all files from snapshot
|
|
61
|
+
6. **Report** — return a summary of all operations with their status
|
|
62
|
+
|
|
63
|
+
### Dry-Run Mode
|
|
64
|
+
|
|
65
|
+
When `dryRun: true`, the tool runs steps 1-2 (parse and validate) but skips steps 3-5 (snapshot and execute). The output reports what would happen:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"dryRun": true,
|
|
70
|
+
"valid": true,
|
|
71
|
+
"operations": [
|
|
72
|
+
{"type": "create", "path": "src/TeamMembers.tsx", "status": "would_create"},
|
|
73
|
+
{"type": "edit", "path": "src/App.tsx", "status": "would_edit", "matchFound": true},
|
|
74
|
+
{"type": "delete", "path": "src/UserList.tsx", "status": "would_delete"}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Conflict Detection
|
|
80
|
+
|
|
81
|
+
The validation phase detects conflicts between operations:
|
|
82
|
+
|
|
83
|
+
- Two `create` operations targeting the same path
|
|
84
|
+
- An `edit` followed by a `delete` of the same file (the edit is wasted)
|
|
85
|
+
- A `delete` followed by a `create` of the same path (flag as intentional replace or error)
|
|
86
|
+
- An `edit` targeting a file that a previous `create` just made (allowed — the edit applies to the new content)
|
|
87
|
+
|
|
88
|
+
Conflicts are reported with explanations before any execution begins.
|
|
89
|
+
|
|
90
|
+
### Output Format
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"success": true,
|
|
95
|
+
"operationsCount": 6,
|
|
96
|
+
"operations": [
|
|
97
|
+
{"type": "edit", "path": "src/App.tsx", "status": "completed"},
|
|
98
|
+
{"type": "edit", "path": "src/routes.tsx", "status": "completed"},
|
|
99
|
+
{"type": "create", "path": "src/TeamMembers.tsx", "status": "completed"},
|
|
100
|
+
{"type": "delete", "path": "src/UserList.tsx", "status": "completed"}
|
|
101
|
+
],
|
|
102
|
+
"snapshotId": "snap_20260301_143022"
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
On failure, the output includes the failing operation, the error, and confirmation that rollback was performed.
|
|
107
|
+
|
|
108
|
+
## Supporting Structures
|
|
109
|
+
|
|
110
|
+
- **Tool Registry (RISE-034)** registers the batch tool with id `batch`
|
|
111
|
+
- **Tool Context Injection (RISE-035)** provides session context and abort signal for cancellation
|
|
112
|
+
- **File Snapshot System (RISE-076)** handles pre-execution snapshots for rollback
|
|
113
|
+
- **Zod Schema Validation (RISE-005)** validates the operations array structure
|
|
114
|
+
- **Agent Permission Rulesets (RISE-011)** enforces per-operation permission checks (create/edit/delete)
|
|
115
|
+
- **Named Error System (RISE-006)** provides BatchValidationError, BatchRollbackError
|
|
116
|
+
|
|
117
|
+
## Creative Advancement Scenarios
|
|
118
|
+
|
|
119
|
+
**Scenario 1 — Safe Refactoring:**
|
|
120
|
+
The agent renames a function across 12 files. A single batch call validates all 12 edits upfront — discovering that file 9 has been modified since the agent last read it and the old string no longer matches. The entire batch is rejected before any changes are made. The agent re-reads file 9, adjusts the edit, and retries the full batch successfully.
|
|
121
|
+
|
|
122
|
+
**Scenario 2 — Component Migration:**
|
|
123
|
+
The developer asks to move a component from `components/old/` to `components/new/` with updated imports. The agent issues one batch: create the new file, edit 4 import statements, delete the old file. All 6 operations execute atomically. If the import in `routes.tsx` fails, everything rolls back — the old component is never deleted without its imports being updated first.
|
|
124
|
+
|
|
125
|
+
**Scenario 3 — Dry-Run Preview:**
|
|
126
|
+
Before a large refactoring, the agent runs the batch with `dryRun: true`. It reports: "Would edit 8 files, create 2 files, delete 3 files. All operations valid." The developer reviews, confirms, and the agent reruns without dry-run. Confidence before commitment.
|
|
127
|
+
|
|
128
|
+
**Scenario 4 — Context Efficiency:**
|
|
129
|
+
Instead of 15 separate tool calls consuming 15 context round-trips, the agent makes 1 batch call. The result is a single compact summary. The saved context budget allows the agent to reason about the next steps without hitting context limits.
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# RISE-038: Multi-Edit Tool
|
|
2
|
+
|
|
3
|
+
> RISE Framework Specification — Borrowed from OpenCode for mia-code
|
|
4
|
+
> Document: rispecs/borrowed_from_opencode/038-multi-edit-tool.rispec.md
|
|
5
|
+
|
|
6
|
+
## Creative Intent
|
|
7
|
+
|
|
8
|
+
mia-code provides a multi-edit tool that applies multiple find-and-replace edits across one or more files in a single tool invocation. Where the batch tool (RISE-037) handles mixed operation types (create, edit, delete), the multi-edit tool specializes in surgical text replacements — the most common operation an agent performs. Each edit specifies a file path, an exact string to find, and its replacement. Edits are validated collectively, applied in order, and reported with before/after context. The result is fewer tool calls, consistent multi-file refactoring, and clear visibility into every change made.
|
|
9
|
+
|
|
10
|
+
## Structural Tension Analysis
|
|
11
|
+
|
|
12
|
+
**Current Reality:**
|
|
13
|
+
- Each file edit requires a separate tool call — renaming a variable in 5 files means 5 tool calls
|
|
14
|
+
- Sequential editing consumes context rapidly: each call adds input and output to the conversation
|
|
15
|
+
- If the agent's reasoning drifts between tool calls, later edits may be inconsistent with earlier ones
|
|
16
|
+
- There is no way to validate all edits before committing the first one
|
|
17
|
+
- Failed edits provide no context about which specific replacement failed or why
|
|
18
|
+
|
|
19
|
+
**Desired State:**
|
|
20
|
+
- A single `multi_edit` tool call accepts an array of `{path, old_string, new_string}` edits
|
|
21
|
+
- All edits are validated before any are applied — each `old_string` must match exactly once in its target file
|
|
22
|
+
- Edits are applied in order within each file, accounting for offset shifts from earlier edits
|
|
23
|
+
- The output shows each edit with before/after context lines for verification
|
|
24
|
+
- Failed edits report the specific edit index, file, and failure reason
|
|
25
|
+
- Optional regex support for pattern-based replacements
|
|
26
|
+
|
|
27
|
+
## Desired Outcome Definition
|
|
28
|
+
|
|
29
|
+
The agent renames a type from `UserID` to `AccountID` across 7 files. It issues one `multi_edit` call with 11 edits (some files have multiple occurrences). Each edit is validated — the tool confirms all 11 `old_string` values match exactly once. The edits apply in order, and the result shows 11 successful replacements with 2 lines of context around each change.
|
|
30
|
+
|
|
31
|
+
## Natural Language Functional Description
|
|
32
|
+
|
|
33
|
+
### Input Format
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
interface MultiEditInput {
|
|
37
|
+
edits: EditOperation[];
|
|
38
|
+
regex?: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface EditOperation {
|
|
42
|
+
path: string;
|
|
43
|
+
old_string: string;
|
|
44
|
+
new_string: string;
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Validation Rules
|
|
49
|
+
|
|
50
|
+
Before any edit is applied, all edits are validated:
|
|
51
|
+
|
|
52
|
+
1. Each `path` must refer to an existing file within the project root
|
|
53
|
+
2. Each `old_string` must appear exactly once in the target file's current content
|
|
54
|
+
3. When multiple edits target the same file, validation accounts for earlier edits' effects — edit 2's `old_string` is searched in the file as modified by edit 1
|
|
55
|
+
4. Empty `old_string` is rejected — use the file write tool for full-file operations
|
|
56
|
+
5. If `regex: true`, each `old_string` is compiled as a regular expression and must match exactly once
|
|
57
|
+
|
|
58
|
+
If any edit fails validation, the entire operation is rejected with a detailed error listing every invalid edit.
|
|
59
|
+
|
|
60
|
+
### Application Order
|
|
61
|
+
|
|
62
|
+
Edits are grouped by file and applied sequentially within each file:
|
|
63
|
+
|
|
64
|
+
1. Group edits by target file path
|
|
65
|
+
2. For each file, read the current content
|
|
66
|
+
3. Apply edits in the order they appear in the input array
|
|
67
|
+
4. After each edit, update the working content for subsequent edits in the same file
|
|
68
|
+
5. After all edits for a file are applied, write the final content back
|
|
69
|
+
|
|
70
|
+
This ordering means later edits can depend on earlier edits' changes within the same file.
|
|
71
|
+
|
|
72
|
+
### Output Format
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"success": true,
|
|
77
|
+
"editCount": 11,
|
|
78
|
+
"filesModified": 7,
|
|
79
|
+
"edits": [
|
|
80
|
+
{
|
|
81
|
+
"path": "src/types.ts",
|
|
82
|
+
"status": "applied",
|
|
83
|
+
"context": {
|
|
84
|
+
"before": "export type UserID = string;",
|
|
85
|
+
"after": "export type AccountID = string;"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"path": "src/api.ts",
|
|
90
|
+
"status": "applied",
|
|
91
|
+
"context": {
|
|
92
|
+
"before": "function getUser(id: UserID): Promise<User>",
|
|
93
|
+
"after": "function getUser(id: AccountID): Promise<User>"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Each edit result includes the before and after text with surrounding context lines, enabling the developer to verify correctness at a glance.
|
|
101
|
+
|
|
102
|
+
### Error Reporting
|
|
103
|
+
|
|
104
|
+
When validation fails, the error identifies every problematic edit:
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"success": false,
|
|
109
|
+
"errors": [
|
|
110
|
+
{
|
|
111
|
+
"editIndex": 3,
|
|
112
|
+
"path": "src/utils.ts",
|
|
113
|
+
"old_string": "UserID",
|
|
114
|
+
"error": "Found 3 matches — expected exactly 1. Include more context to disambiguate."
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"editIndex": 7,
|
|
118
|
+
"path": "src/deleted.ts",
|
|
119
|
+
"error": "File does not exist."
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The error message for multiple matches suggests including more surrounding context in `old_string` to make the match unique.
|
|
126
|
+
|
|
127
|
+
### Regex Mode
|
|
128
|
+
|
|
129
|
+
When `regex: true`, `old_string` values are interpreted as regular expressions:
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"edits": [
|
|
134
|
+
{
|
|
135
|
+
"path": "src/config.ts",
|
|
136
|
+
"old_string": "version:\\s*\"\\d+\\.\\d+\\.\\d+\"",
|
|
137
|
+
"new_string": "version: \"2.0.0\""
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
"regex": true
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Regex mode supports capture groups in `new_string` via `$1`, `$2` syntax. The same uniqueness constraint applies — the regex must match exactly once per file.
|
|
145
|
+
|
|
146
|
+
## Supporting Structures
|
|
147
|
+
|
|
148
|
+
- **Tool Registry (RISE-034)** registers the multi-edit tool with id `multi_edit`
|
|
149
|
+
- **Tool Context Injection (RISE-035)** provides session context and abort signal
|
|
150
|
+
- **Zod Schema Validation (RISE-005)** validates the edits array structure
|
|
151
|
+
- **File Snapshot System (RISE-076)** takes pre-edit snapshots for undo capability
|
|
152
|
+
- **Agent Permission Rulesets (RISE-011)** enforces write permissions on each target file path
|
|
153
|
+
- **Tool Output Truncation (RISE-036)** truncates output when many edits produce verbose results
|
|
154
|
+
|
|
155
|
+
## Creative Advancement Scenarios
|
|
156
|
+
|
|
157
|
+
**Scenario 1 — Variable Rename:**
|
|
158
|
+
The developer asks to rename `userEmail` to `contactEmail` everywhere. The agent finds 14 occurrences across 6 files, constructs 14 edits each with enough surrounding context for unique matching, and submits one `multi_edit` call. All 14 apply cleanly. The developer sees a compact summary with before/after for each change.
|
|
159
|
+
|
|
160
|
+
**Scenario 2 — Disambiguation Feedback:**
|
|
161
|
+
The agent tries to replace `id` in a file but the `multi_edit` tool rejects it: "Found 12 matches — include more context." The agent retries with `old_string: "const id = user.id"` — now unique. The tool's error message guided the agent to a successful edit without developer intervention.
|
|
162
|
+
|
|
163
|
+
**Scenario 3 — Import Path Migration:**
|
|
164
|
+
A team moves from `@/lib/` to `@/utils/` import paths. The agent constructs 30 edits across 20 files, all in one `multi_edit` call. The operation completes in one round-trip. Without multi-edit, this would be 30 separate tool calls consuming 30x the context.
|
|
165
|
+
|
|
166
|
+
**Scenario 4 — Regex Version Bump:**
|
|
167
|
+
Using regex mode, the agent updates all version strings matching `"version": "\d+\.\d+\.\d+"` across package.json files in a monorepo. One call, one regex pattern, consistent updates everywhere.
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# RISE-039: Apply Patch Tool
|
|
2
|
+
|
|
3
|
+
> RISE Framework Specification — Borrowed from OpenCode for mia-code
|
|
4
|
+
> Document: rispecs/borrowed_from_opencode/039-apply-patch-tool.rispec.md
|
|
5
|
+
|
|
6
|
+
## Creative Intent
|
|
7
|
+
|
|
8
|
+
mia-code provides a tool that applies unified diff patches directly to files — the same format produced by `git diff`. The agent can express complex, multi-hunk, multi-file changes as a single patch and apply them in one operation. This bridges the gap between human-readable diffs (which LLMs generate naturally) and actual file modifications. When an AI produces a diff showing exactly what to change, mia-code can apply it directly rather than decomposing it into individual find-and-replace operations.
|
|
9
|
+
|
|
10
|
+
## Structural Tension Analysis
|
|
11
|
+
|
|
12
|
+
**Current Reality:**
|
|
13
|
+
- mia-code can only modify files through individual find-and-replace edits via the CLI's built-in tools
|
|
14
|
+
- LLMs naturally produce unified diffs when describing changes, but these cannot be applied directly
|
|
15
|
+
- The agent must translate a conceptual diff into multiple `edit` tool calls — losing fidelity and consuming context
|
|
16
|
+
- External patches (from code reviews, PRs, or other AI tools) cannot be applied within a mia-code session
|
|
17
|
+
- There is no support for hunk-level context matching, which unified diffs rely on for precise positioning
|
|
18
|
+
- Applying a 200-line diff requires decomposing it into dozens of individual edits — error-prone and slow
|
|
19
|
+
|
|
20
|
+
**Desired State:**
|
|
21
|
+
- A single `apply_patch` tool accepts unified diff text and applies all hunks to target files
|
|
22
|
+
- Both `---/+++` standard format and git extended diff format are supported
|
|
23
|
+
- Context lines in hunks enable fuzzy matching when exact line numbers have shifted
|
|
24
|
+
- The tool handles file creation (new file patches), file deletion, and multi-hunk modifications
|
|
25
|
+
- Fuzz factor is configurable — allowing context lines to match with small offsets
|
|
26
|
+
- Failed hunks report exactly which hunk didn't match and show the expected vs actual context
|
|
27
|
+
|
|
28
|
+
## Desired Outcome Definition
|
|
29
|
+
|
|
30
|
+
The agent generates a unified diff with 4 hunks across 2 files. It passes this diff text to the `apply_patch` tool. The tool parses the patch, matches each hunk's context against the target files (with up to 3 lines of fuzz), applies the changes, and reports: "Applied 4 hunks to 2 files (2 hunks applied with offset)."
|
|
31
|
+
|
|
32
|
+
## Natural Language Functional Description
|
|
33
|
+
|
|
34
|
+
### Input Format
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
interface ApplyPatchInput {
|
|
38
|
+
patch: string; // unified diff text
|
|
39
|
+
fuzzFactor?: number; // context matching tolerance (default: 3 lines)
|
|
40
|
+
dryRun?: boolean; // validate without applying
|
|
41
|
+
stripPrefix?: number; // strip N leading path components (like patch -p)
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Patch Parsing
|
|
46
|
+
|
|
47
|
+
The tool parses standard unified diff format:
|
|
48
|
+
|
|
49
|
+
```diff
|
|
50
|
+
--- a/src/auth.ts
|
|
51
|
+
+++ b/src/auth.ts
|
|
52
|
+
@@ -15,7 +15,8 @@ import { hash } from './crypto';
|
|
53
|
+
export async function authenticate(
|
|
54
|
+
username: string,
|
|
55
|
+
password: string,
|
|
56
|
+
+ mfaToken?: string,
|
|
57
|
+
): Promise<AuthResult> {
|
|
58
|
+
- const user = await findUser(username);
|
|
59
|
+
+ const user = await findUserByName(username);
|
|
60
|
+
if (!user) throw new AuthError('not_found');
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The parser extracts:
|
|
64
|
+
- File paths from `---` and `+++` headers
|
|
65
|
+
- Hunk ranges from `@@` markers
|
|
66
|
+
- Context lines (space-prefixed), removed lines (`-` prefixed), added lines (`+` prefixed)
|
|
67
|
+
|
|
68
|
+
### Hunk Application with Fuzz
|
|
69
|
+
|
|
70
|
+
Each hunk is applied by matching its context lines against the target file:
|
|
71
|
+
|
|
72
|
+
1. Start at the line number specified in the hunk header
|
|
73
|
+
2. If context lines match exactly at that position, apply the hunk
|
|
74
|
+
3. If not, search within `fuzzFactor` lines above and below the specified position
|
|
75
|
+
4. If a match is found at an offset, apply the hunk and note the offset in the result
|
|
76
|
+
5. If no match is found within the fuzz range, the hunk fails
|
|
77
|
+
|
|
78
|
+
Fuzz matching uses the context lines (unchanged lines in the diff) as anchors. All context lines must match for the hunk to apply — only the position can vary.
|
|
79
|
+
|
|
80
|
+
### File Operations
|
|
81
|
+
|
|
82
|
+
The patch tool handles three file operation types:
|
|
83
|
+
|
|
84
|
+
- **Modification** — standard `---/+++` with existing file paths, applies hunks to modify content
|
|
85
|
+
- **Creation** — `--- /dev/null` with `+++ b/new-file.ts`, creates the file with the added content
|
|
86
|
+
- **Deletion** — `--- a/old-file.ts` with `+++ /dev/null`, deletes the file after verifying current content matches
|
|
87
|
+
|
|
88
|
+
### Git Extended Format
|
|
89
|
+
|
|
90
|
+
The tool also supports git's extended diff headers:
|
|
91
|
+
|
|
92
|
+
```diff
|
|
93
|
+
diff --git a/src/auth.ts b/src/auth.ts
|
|
94
|
+
index 1a2b3c4..5e6f7g8 100644
|
|
95
|
+
--- a/src/auth.ts
|
|
96
|
+
+++ b/src/auth.ts
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The `diff --git` header, `index` line, and file mode are parsed for metadata but not required for hunk application.
|
|
100
|
+
|
|
101
|
+
### Output Format
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"success": true,
|
|
106
|
+
"filesModified": 2,
|
|
107
|
+
"filesCreated": 1,
|
|
108
|
+
"filesDeleted": 0,
|
|
109
|
+
"hunks": [
|
|
110
|
+
{"file": "src/auth.ts", "hunk": 1, "status": "applied", "offset": 0},
|
|
111
|
+
{"file": "src/auth.ts", "hunk": 2, "status": "applied", "offset": 3},
|
|
112
|
+
{"file": "src/routes.ts", "hunk": 1, "status": "applied", "offset": 0},
|
|
113
|
+
{"file": "src/mfa.ts", "hunk": 1, "status": "created"}
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Error Handling
|
|
119
|
+
|
|
120
|
+
When a hunk fails to apply:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"success": false,
|
|
125
|
+
"error": "Hunk 2 of src/auth.ts failed to apply",
|
|
126
|
+
"detail": {
|
|
127
|
+
"file": "src/auth.ts",
|
|
128
|
+
"hunk": 2,
|
|
129
|
+
"expectedContext": [" const user = await findUser(username);"],
|
|
130
|
+
"actualContent": [" const user = await lookupUser(username);"],
|
|
131
|
+
"searchRange": "lines 18-24"
|
|
132
|
+
},
|
|
133
|
+
"appliedBefore": ["hunk 1 of src/auth.ts"],
|
|
134
|
+
"rolledBack": true
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
When any hunk fails, previously applied hunks within the same file are rolled back. Cross-file rollback is managed by the snapshot system.
|
|
139
|
+
|
|
140
|
+
## Supporting Structures
|
|
141
|
+
|
|
142
|
+
- **Tool Registry (RISE-034)** registers the apply_patch tool with id `apply_patch`
|
|
143
|
+
- **Tool Context Injection (RISE-035)** provides session context and cancellation
|
|
144
|
+
- **File Snapshot System (RISE-076)** enables rollback when hunks fail
|
|
145
|
+
- **Zod Schema Validation (RISE-005)** validates the patch input structure
|
|
146
|
+
- **Agent Permission Rulesets (RISE-011)** enforces write permissions on target file paths
|
|
147
|
+
- **Batch Tool (RISE-037)** provides complementary file operations for non-diff changes
|
|
148
|
+
|
|
149
|
+
## Creative Advancement Scenarios
|
|
150
|
+
|
|
151
|
+
**Scenario 1 — AI-Generated Diff Application:**
|
|
152
|
+
The agent produces a 150-line diff describing a refactoring. Instead of decomposing it into 20 individual edits, it passes the entire diff to `apply_patch`. One tool call, one result, and the refactoring is complete. The LLM's natural diff-generation ability is leveraged directly.
|
|
153
|
+
|
|
154
|
+
**Scenario 2 — External Patch Replay:**
|
|
155
|
+
A developer pastes a patch from a code review comment: "Apply this fix." The agent passes the patch text directly to the tool. The fuzz factor handles the fact that the developer's version has 2 extra lines compared to the patch's context — the hunk applies at offset +2. Seamless integration with external workflows.
|
|
156
|
+
|
|
157
|
+
**Scenario 3 — Dry-Run Validation:**
|
|
158
|
+
Before applying a large patch from an untrusted source, the agent runs `dryRun: true`. The tool reports: "4 of 5 hunks would apply. Hunk 3 fails: context mismatch at line 42." The agent adjusts hunk 3 manually and retries. Safety before commitment.
|
|
159
|
+
|
|
160
|
+
**Scenario 4 — New File Creation via Patch:**
|
|
161
|
+
The agent generates a diff creating a new test file (`--- /dev/null`, `+++ b/tests/auth.test.ts`). The `apply_patch` tool creates the file with the specified content. This is more natural for the LLM than using a separate create tool — the diff is a unified representation of all changes.
|