airi/package.json
刘梓恒 3aa466f98c
feat: integrate computer-use MCP, terminal approval, and conversation compact (#3496)
## Summary

Ships Host-owned Computer Use and Terminal for Stage Tamagotchi, plus
conversation Compact and a Context Inspector for send projections.

- Bundled MCP runs under Main approval and Turbo.
- Compact schedules when the soft budget is crossed.
- Context Inspector shows the last projected send by section.

This PR also carries related analytics and dependency sync from earlier
rebase work. Those are not the review focus.

## Context

- Request: Land Computer Use MCP, Terminal approval, Compact, and
Context Inspector on current `main`, clear review findings that block
honest execution state, and keep the PR reviewable.
- Scenario: Tamagotchi chat can observe and change the desktop or run
Terminal commands through the Host, with approval or Turbo.
- Scope: Do not treat this as ready for merge yet. Known product limits
stay documented below. Follow-up can harden budgets and Linux executors.
- Source: https://github.com/moeru-ai/airi/pull/3496

## Known limits

These are current product limits on this branch. They are recorded for
review clarity. They are not a demand that maintainers accept them as
final product policy.

| Limit | Behavior now |
| --- | --- |
| Conversation Compact | Soft limit only. Crossing it schedules Compact.
Sends are not hard-rejected. |
| MCP session budget | Default `maxOperations` is 80. The session
counter does not renew. |
| Turbo | No TTL. It stays on for that chat window and session until the
user turns it off. |
| Linux bundled executor | Non-Windows, non-macOS hosts use `dry-run`.
Actions report `performed: false` and do not touch the desktop. |

## Change map

| Module | Before | After | Description |
| --- | --- | --- | --- |
| `services/computer-use-mcp` | Separate service surface | Bundled Host
tools with policy and Terminal lanes | Owns prepare, approve, execute,
and session budget |
| `apps/stage-tamagotchi` Main MCP host | External Terminal assumptions
| Bundled Terminal plus Computer Use approval | Picks platform executor,
binds approvals, returns `doNotReplay` after dispatch failures |
| `packages/stage-ui` chat / tools | Send-only Host admission | Rerun
hooks and MCP exposure defaults | Host can admit a rerun under a fresh
turn id |
| `packages/core-agent` Compact | Soft budget helpers | Soft Compact
scheduling kept | Hard reject is out of scope for this PR |
| Context Inspector | None | Last-send projection breakdown | Tamagotchi
chat can inspect projected sections |

## Verification

- Head `06da0320c` CI run
https://github.com/moeru-ai/airi/actions/runs/44509127823: Lint, Type
Check, Unit Test, Build, and Human Attestation passed.
- Local: `pnpm -F @proj-airi/stage-tamagotchi exec vitest run
src/main/services/airi/mcp-servers/index.test.ts` → 36 passed.
- Local: `pnpm -F @proj-airi/stage-ui exec vitest run
src/tools/mcp.test.ts` → 19 passed.
- Host post-dispatch failures return `status: unknown` with
`doNotReplay: true`. Pre-dispatch cancel returns `cancelled` without
`doNotReplay`. `createMcpTools` preserves that structured content.
`MCP_AGENT_EXECUTION_PROMPT` tells the model not to repeat a lost or
unclear result.

## UI evidence

<img width="951" height="1225" alt="image"
src="https://github.com/user-attachments/assets/0c9092ad-1969-4dbf-bcf6-392205c6e661"
/>

<img width="951" height="1225" alt="image"
src="https://github.com/user-attachments/assets/2dda6f95-6bfc-4eab-9fa5-f080dfa73016"
/>

<img width="576" height="508" alt="image"
src="https://github.com/user-attachments/assets/0d3a061e-6f07-49b2-85e0-fe8c48d2f624"
/>

## Agent

- Harness: Cursor
- Model: Composer

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-20 03:08:09 +08:00

119 lines
4.8 KiB
JSON

{
"name": "@proj-airi/root",
"type": "module",
"version": "0.15.4",
"private": true,
"packageManager": "pnpm@11.24.0",
"description": "LLM powered virtual character",
"author": {
"name": "Moeru AI Project AIRI Team",
"email": "airi@moeru.ai",
"url": "https://github.com/moeru-ai"
},
"license": "MIT",
"scripts": {
"postinstall": "pnpm exec simple-git-hooks && pnpm run build:packages",
"dev": "pnpm -r -F @proj-airi/stage-web dev",
"dev:ui": "pnpm -rF @proj-airi/stage-ui run story:dev",
"dev:web": "pnpm -rF @proj-airi/stage-web run dev",
"dev:web:https": "pnpm -rF @proj-airi/stage-web run dev:https",
"dev:server-auth": "pnpm -rF @proj-airi/ui-server-auth run dev",
"dev:backend": "docker compose -f server/docker-compose.yaml up --build",
"dev:pocket:ios": "pnpm -rF @proj-airi/stage-pocket run dev:ios",
"dev:pocket:android": "pnpm -rF @proj-airi/stage-pocket run dev:android",
"dev:server": "pnpm -rF @proj-airi/server-runtime run dev",
"dev:tamagotchi": "pnpm -rF @proj-airi/stage-tamagotchi run dev",
"dev:tamagotchi:xwayland": "pnpm -rF @proj-airi/stage-tamagotchi run dev:xwayland",
"dev:apps": "pnpm -rF=\"./apps/*\" run --parallel dev",
"dev:packages": "pnpm -rF=\"./packages/*\" --parallel run dev",
"build": "turbo run build -F=\"./packages/*\" -F=\"./apps/*\" -F=\"./server/**\"",
"build:web": "turbo run build -F @proj-airi/stage-web",
"build:tamagotchi": "pnpm -rF @proj-airi/stage-tamagotchi run app:build",
"build:apps": "turbo run build -F=\"./apps/*\"",
"build:packages": "turbo run build -F=\"./packages/*\" -F=\"@proj-airi/stage-tamagotchi^...\"",
"build:engines": "turbo run build -F=\"./engines/*\"",
"test": "vitest --coverage",
"test:run": "turbo run test:run --concurrency=2",
"test:root": "vitest run",
"lint": "moeru-lint .",
"lint:fix": "moeru-lint --fix .",
"lint:prune-suppressions": "eslint . --prune-suppressions",
"lint:swift": "pnpm -rF @proj-airi/stage-pocket run lint:swift",
"i18n:check": "x18n check",
"capture:tamagotchi": "APP_IGNORE_FOCUS=${APP_IGNORE_FOCUS:-1} pnpm exec vishot capture --target electron ./packages/scenarios-stage-tamagotchi-electron/src/scenarios/demo-controls-settings-chat-websocket/index.ts --app-entrypoint ./apps/stage-tamagotchi --cwd . --output-dir ./packages/scenarios-stage-tamagotchi-browser/artifacts/raw --format avif",
"sponsors:generate": "sponsorkit --output-dir docs/assets/sponsors",
"typecheck": "turbo run typecheck -F=\"./packages/*\" -F=\"./apps/*\" -F=\"./server/**\" -F=\"./services/*\"",
"typecheck:engines": "pnpm -rF=\"./engines/*\" --parallel typecheck",
"up": "taze -w -r -I && pnpm prune && pnpm dedupe",
"nolyfill": "pnpm dlx nolyfill",
"open:ios": "pnpm -rF @proj-airi/stage-pocket run open:ios",
"knip": "knip"
},
"devDependencies": {
"@alint-js/cli": "catalog:",
"@alint-js/plugin-js": "catalog:",
"@antfu/eslint-config": "catalog:",
"@arethetypeswrong/core": "catalog:",
"@electron-toolkit/eslint-config-ts": "catalog:",
"@iconify/utils": "catalog:",
"@moeru/eslint-config": "catalog:",
"@proj-airi/unocss-preset-chromatic": "catalog:",
"@types/node": "catalog:",
"@unocss/eslint-config": "catalog:",
"@unocss/eslint-plugin": "catalog:",
"@unocss/preset-mini": "catalog:",
"@unocss/preset-web-fonts": "catalog:",
"@vishot/cli": "catalog:",
"@vitest/browser-playwright": "catalog:vitest",
"@vitest/coverage-v8": "catalog:vitest",
"@x18n/cli": "catalog:",
"bumpp": "catalog:",
"eslint": "catalog:",
"eslint-plugin-format": "catalog:",
"eslint-plugin-oxlint": "catalog:",
"eslint-plugin-perfectionist": "catalog:",
"eslint-plugin-slop": "catalog:",
"knip": "catalog:",
"nano-staged": "catalog:",
"oxc-minify": "catalog:",
"oxlint": "catalog:",
"playwright": "catalog:",
"publint": "catalog:",
"rollup": "catalog:",
"simple-git-hooks": "catalog:",
"sponsorkit": "catalog:",
"taze": "catalog:",
"tinyexec": "catalog:",
"tsdown": "catalog:",
"tsx": "catalog:",
"turbo": "catalog:",
"typescript": "catalog:",
"uncrypto": "catalog:",
"unocss": "catalog:",
"unocss-preset-scrollbar": "catalog:",
"unplugin-lightningcss": "catalog:",
"unplugin-raw": "catalog:",
"unplugin-unused": "catalog:",
"vite": "catalog:",
"vite-plugin-inspect": "catalog:",
"vitest": "catalog:vitest",
"vitest-browser-vue": "catalog:",
"yaml": "catalog:"
},
"workspaces": [
"packages/**",
"plugins/**",
"integrations/**",
"services/**",
"examples/**",
"engines/**",
"apps/**",
"server/**"
],
"simple-git-hooks": {
"pre-commit": "pnpm nano-staged"
},
"nano-staged": {
"*": "moeru-lint --fix"
}
}