{"_id":"@best-agent/engine","_rev":"3-334c1706dfbfc63f1ddc4acb8dbdffb7","name":"@best-agent/engine","dist-tags":{"latest":"0.0.2-beta.8","beta":"0.0.2-beta.2"},"versions":{"0.0.1-beta.1":{"name":"@best-agent/engine","version":"0.0.1-beta.1","_id":"@best-agent/engine@0.0.1-beta.1","maintainers":[{"name":"simon_he","email":"13917107469@163.com"}],"dist":{"shasum":"189e3b4f1d57807d8f836ecfbb26d10aded58915","tarball":"https://registry.npmjs.org/@best-agent/engine/-/engine-0.0.1-beta.1.tgz","fileCount":896,"integrity":"sha512-wMiV6btFRjRXDrRoRg7DZoZw7KDFHD8IAu6NB9jpZZOfZSmrfbbbu6VTfQZLS89Ro/AABZNf20NBTA8lW6UxKQ==","signatures":[{"sig":"MEYCIQDCm9jElXma6TgVY+YLnXJRfCXV9jIucPVcKhuoV3NBhgIhAO6/zUL4S+vsLoq9poq+zqZyUAwWDE3ZbbPotathByAp","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7908725},"main":"./dist/index.js","type":"module","_from":"file:best-agent-engine-0.0.1-beta.1.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"release":"pnpm -w build && pnpm publish --access public --no-git-checks"},"_npmUser":{"name":"simon_he","email":"13917107469@163.com"},"_resolved":"/private/var/folders/z8/w1qvd0cd46z6k8_swl1n33d00000gn/T/8ad740542ec869106f77a45b94c33c8b/best-agent-engine-0.0.1-beta.1.tgz","_integrity":"sha512-wMiV6btFRjRXDrRoRg7DZoZw7KDFHD8IAu6NB9jpZZOfZSmrfbbbu6VTfQZLS89Ro/AABZNf20NBTA8lW6UxKQ==","_npmVersion":"10.9.2","description":"Runtime core for `best-agent`.","directories":{},"_nodeVersion":"23.11.0","dependencies":{"ai":"^6.0.184","typescript":"^5.9.3","@ai-sdk/google":"^2.0.73","@ai-sdk/openai":"^3.0.64","@ai-sdk/anthropic":"^2.0.79","@best-agent/protocol":"0.0.1-beta.1","@best-agent/foundation":"0.0.1-beta.1","@ai-sdk/openai-compatible":"^2.0.47"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/engine_0.0.1-beta.1_1779708576327_0.6773327079017186","host":"s3://npm-registry-packages-npm-production"}},"0.0.2-beta.2":{"name":"@best-agent/engine","version":"0.0.2-beta.2","_id":"@best-agent/engine@0.0.2-beta.2","maintainers":[{"name":"simon_he","email":"13917107469@163.com"}],"dist":{"shasum":"d5f209f6a90a04476ac8c8833eaa80bc8cd46d4a","tarball":"https://registry.npmjs.org/@best-agent/engine/-/engine-0.0.2-beta.2.tgz","fileCount":896,"integrity":"sha512-QoHaLjUjzELwHEKL25DqaSEHFxEKX7F16BiwfUOKk4lN3DafsqcBQ2yjcSx/3NKe3yOV1BBBKKaXbs7tiPrTDQ==","signatures":[{"sig":"MEUCIQD2XyRGnJuHnWVD29+ZBp2ZTjoiAynuyU0LOMiK3hl3SwIgcNF6z0HNpEUCcQPi5RUORCCsnu8RPq2Xf+BZeRzcBBg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7908725},"main":"./dist/index.js","type":"module","_from":"file:best-agent-engine-0.0.2-beta.2.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"release":"pnpm -w build && pnpm publish --access public --no-git-checks"},"_npmUser":{"name":"simon_he","email":"13917107469@163.com"},"_resolved":"/private/var/folders/z8/w1qvd0cd46z6k8_swl1n33d00000gn/T/97e8f442ffb72c22f6d83ba0c2bb4b4d/best-agent-engine-0.0.2-beta.2.tgz","_integrity":"sha512-QoHaLjUjzELwHEKL25DqaSEHFxEKX7F16BiwfUOKk4lN3DafsqcBQ2yjcSx/3NKe3yOV1BBBKKaXbs7tiPrTDQ==","_npmVersion":"10.9.2","description":"Runtime core for `best-agent`.","directories":{},"_nodeVersion":"23.11.0","dependencies":{"ai":"^6.0.184","typescript":"^5.9.3","@ai-sdk/google":"^2.0.73","@ai-sdk/openai":"^3.0.64","@ai-sdk/anthropic":"^2.0.79","@best-agent/protocol":"0.0.2-beta.2","@best-agent/foundation":"0.0.2-beta.2","@ai-sdk/openai-compatible":"^2.0.47"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/engine_0.0.2-beta.2_1779794960420_0.3062232390425048","host":"s3://npm-registry-packages-npm-production"}},"0.0.2-beta.8":{"name":"@best-agent/engine","version":"0.0.2-beta.8","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"dependencies":{"@ai-sdk/anthropic":"^2.0.79","@ai-sdk/google":"^2.0.73","@ai-sdk/openai":"^3.0.64","@ai-sdk/openai-compatible":"^2.0.47","ai":"^6.0.184","typescript":"^5.9.3","@best-agent/foundation":"0.0.2-beta.8","@best-agent/protocol":"0.0.2-beta.8"},"scripts":{"release":"pnpm -w build && pnpm publish --access public --no-git-checks"},"_id":"@best-agent/engine@0.0.2-beta.8","description":"Runtime core for `best-agent`.","_integrity":"sha512-ShOJD+qYBWi6HE484xjqFksLxnU8jh1IfWAlW5gWOlW7Pwt704Y8OdzBn6YiAABlIKf5qYxN13XLD/RSXUyO1Q==","_resolved":"/private/var/folders/z8/w1qvd0cd46z6k8_swl1n33d00000gn/T/e1e1aaa4fdde4b7af614c4febc41536f/best-agent-engine-0.0.2-beta.8.tgz","_from":"file:best-agent-engine-0.0.2-beta.8.tgz","_nodeVersion":"23.11.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-ShOJD+qYBWi6HE484xjqFksLxnU8jh1IfWAlW5gWOlW7Pwt704Y8OdzBn6YiAABlIKf5qYxN13XLD/RSXUyO1Q==","shasum":"d9349810c433c104757706954001e6381bb4e8d6","tarball":"https://registry.npmjs.org/@best-agent/engine/-/engine-0.0.2-beta.8.tgz","fileCount":926,"unpackedSize":8024589,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDoepc7RuhKzpkK44AqpbtvuhsgIxP5RhrFeLqLCt4oZQIgGyMzfxikeb97H9uqCw7FFkRGygnYPIkmabafGPPHftw="}]},"_npmUser":{"name":"simon_he","email":"13917107469@163.com"},"directories":{},"maintainers":[{"name":"simon_he","email":"13917107469@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/engine_0.0.2-beta.8_1780387081885_0.30847841915256935"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-25T11:29:36.162Z","modified":"2026-06-02T07:58:02.279Z","0.0.1-beta.1":"2026-05-25T11:29:36.499Z","0.0.2-beta.2":"2026-05-26T11:29:20.655Z","0.0.2-beta.8":"2026-06-02T07:58:02.122Z"},"description":"Runtime core for `best-agent`.","maintainers":[{"name":"simon_he","email":"13917107469@163.com"}],"readme":"# @best-agent/engine\n\nRuntime core for `best-agent`.\n\n## Main Exports\n\nRuntime:\n\n- `AgentRuntime`\n- `createAgentProfileRegistry()`\n- `AgentProfileInput`\n\nStorage and memory:\n\n- `LocalThreadStore`\n- `LocalThreadMemory`\n- `resolveWorkspaceStorageRoot()`\n- `DEFAULT_STORAGE_DIRECTORY_NAME`\n\nTools, skills, and hosted contributions:\n\n- `ToolRegistry`\n- `createDefaultToolRegistry()`\n- `createCommandToolDefinition()`\n- `createMcpToolDefinition()`\n- `SkillRegistry`\n- `createHostedContributionBundle()`\n- `defineTool(...)`\n- `defineSkill(...)`\n\nPolicy, sandbox, and provider:\n\n- `RuntimePolicy`\n- `createDefaultRuntimePolicy()`\n- `DEFAULT_ALLOWED_TOOLS`\n- `LocalSandbox`\n- `createModelProvider()`\n- `OpenAiSdkProvider`\n- `AnthropicSdkProvider`\n- `GoogleSdkProvider`\n\nPrompting:\n\n- `compilePrompt()`\n\n## Features\n\n- persisted thread lifecycle with SQLite-backed storage\n- thread modes:\n  - `default`\n  - `plan`\n- approvals, queue/steer controls, sandboxing, and workspace grounding\n- segmented memory, compaction, handoff snapshots, and diagnostics\n- project-scoped cross-session memory injection via authoritative `memory.md`, next-session candidate consolidation, generated-section freshness metadata, and a stale-memory eval gate\n- built-in workflows and deep research\n- built-in lightweight LSP tools for `TypeScript/JavaScript` navigation plus `Python` diagnostics and symbol search, with soft fallback for unsupported files\n- `fetch-url(format:\"rich\")`, `web-search` with native OpenAI or runtime-provided adapter execution, deep-research workflow budgeting, soft-unavailable fallback, and prompt-cache diagnostics/benchmarking in the shared tool/runtime path\n- provider-backed turns plus runtime-owned tool execution\n- hosted-contribution, skill, extension, and MCP normalization into one runtime\n- hosted `PreToolUse` / `PostToolUse` hooks and Guardian-backed model-assisted approval assessments with an offline eval corpus\n- composable-runtime primitives:\n  - `AgentDefinition` inputs normalized through `createAgentProfileRegistry()`\n  - `ToolRegistry` conflict strategies\n  - `createDefaultToolRegistry({ excludeBuiltIns, noBuiltIns, extraTools })`\n  - `AgentDefinition.loopKind = \"advanced\"` for custom advanced-phase runs\n  - `AgentDefinition.maxToolSteps` for per-agent provider loop limits\n  - `AgentDefinition.modelStrategy` for per-agent routing overrides\n  - `customLoops` and `AgentDefinition.customLoopId` for custom turn-loop replacement\n  - per-agent permission overlays and project `.best-agent/agents` loading\n\n## Example\n\n```ts\nimport { AgentRuntime } from \"@best-agent/engine\";\n\nconst runtime = new AgentRuntime({\n  cwd: process.cwd(),\n  storageRoot: \"/tmp/best-agent-demo\",\n});\n\nconst { thread } = await runtime.startThread({ title: \"Demo\" });\nconst result = await runtime.runTurn({\n  threadId: thread.id,\n  prompt: 'tool:echo {\"text\":\"hello\"}',\n});\n\nconsole.log(result.turn.status);\n```\n\n## Internal Layout\n\n- `agent/`: built-in profiles and routing\n- `core/`: thread, approval, queue, and research stores\n- `memory/`: summaries, working memory, telemetry, compaction, segmented cache\n- `plugin/`: local and hosted plugin normalization\n- `policy/`: capability evaluation\n- `prompt/`: prompt directives and project instructions\n- `provider/`: AI SDK-backed model providers\n- `runtime/`: turn execution and event emission\n- `sandbox/`: filesystem and subprocess enforcement\n- `skill/`: installed skill registry\n- `tool/`: built-in tool registry and structured input handling\n\n## Does Not Own\n\n- transport protocols\n- CLI UX\n- external SDK process management\n","readmeFilename":"README.md"}