@agentproto/adapter-mastra-agent 0.2.1 → 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/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -45,6 +45,10 @@ var mastraAgent = defineAgentCli({
|
|
|
45
45
|
idle_timeout_ms: 18e5,
|
|
46
46
|
context_carryover: true
|
|
47
47
|
},
|
|
48
|
+
// Mastra's model router reads the provider off each id's OWN first segment
|
|
49
|
+
// (`providerOf` in model-resolver.ts), no adapter mode — so the route falls
|
|
50
|
+
// out of the chosen model → derived-from-model.
|
|
51
|
+
routeSelection: "derived-from-model",
|
|
48
52
|
models: {
|
|
49
53
|
// Cheap OpenRouter coder by default — this is the budget first-party arm.
|
|
50
54
|
// Anthropic models are not advertised here (this arm shouldn't be steered
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAwBA,IAAM,WAAW,aAAA,CAAc,IAAI,IAAI,WAAA,EAAa,MAAA,CAAA,IAAA,CAAY,GAAG,CAAC,CAAA;AAE7D,IAAM,cAA8B,cAAA,CAAe;AAAA,EACxD,IAAA,EAAM,cAAA;AAAA,EACN,EAAA,EAAI,cAAA;AAAA,EACJ,WAAA,EACE,mUAAA;AAAA,EACF,OAAA,EAAS,OAAA;AAAA,EACT,GAAA,EAAK,MAAA;AAAA,EACL,QAAA,EAAU,CAAC,QAAA,EAAU,KAAK,CAAA;AAAA,EAC1B,OAAA,EAAS;AAAA,IACP;AAAA,MACE,MAAA,EAAQ,KAAA;AAAA,MACR,OAAA,EAAS,kCAAA;AAAA,MACT,MAAA,EAAQ;AAAA;AACV,GACF;AAAA;AAAA;AAAA,EAGA,aAAA,EAAe;AAAA,IACb,GAAA,EAAK,gBAAA;AAAA,IACL,KAAA,EAAO,sBAAA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AW,SAAS;AAAA,KAC1C;AAAA,IACA;AAAA,MACE,EAAA,EAAI,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMJ,IAAA,EAAM,QAAA;AAAA,MACN,WAAA,EACE,4LAAA;AAAA,MAGF,iBAAA,EAAmB,CAAC,SAAA,EAAW,SAAS;AAAA;AAC1C,GACF;AAAA,EACA,MAAM,CAAC,QAAA,EAAU,YAAA,EAAc,KAAA,EAAO,iBAAiB,aAAa;AACtE,CAAC;AAEM,SAAS,kBAAA,GAAsC;AACpD,EAAA,OAAO,sBAAsB,WAAW,CAAA;AAC1C","file":"index.mjs","sourcesContent":["/**\n * @agentproto/adapter-mastra-agent — the first-party agentproto agent.\n *\n * Unlike the codex/hermes/claude-code adapters (which wrap an external agent\n * CLI), this adapter IS the agent: an AIP-42 AGENT.md is run as a live Mastra\n * agent behind an AIP-44 ACP server (see ./acp-host.ts), shipped as a CLI bin\n * (`agentproto-mastra acp`). The daemon spawns it like any other arm; a user\n * can launch it standalone. Our loop, our models — no external CLI.\n *\n * import { mastraAgent, mastraAgentRuntime } from \"@agentproto/adapter-mastra-agent\"\n */\n\nimport { fileURLToPath } from \"node:url\"\nimport {\n createAgentCliRuntime,\n defineAgentCli,\n type AgentCliHandle,\n type AgentCliRuntime,\n} from \"@agentproto/driver-agent-cli\"\n\n// Self-locating: the built handle spawns `node <this-dist>/cli.mjs acp`.\n// import.meta.url resolves into dist/ at runtime, where cli.mjs sits next to\n// index.mjs — so the same build works whether the daemon spawns it (resolved\n// from node_modules) or a user runs the published bin.\nconst cliEntry = fileURLToPath(new URL(\"./cli.mjs\", import.meta.url))\n\nexport const mastraAgent: AgentCliHandle = defineAgentCli({\n name: \"mastra-agent\",\n id: \"mastra-agent\",\n description:\n \"First-party agentproto agent — an AIP-42 AGENT.md run as a live Mastra agent behind an AIP-44 ACP server. No external agent CLI: our own loop, our own models (routed via Mastra's model gateway from the spawn env). Spawned as `node cli.mjs acp` over stdio JSON-RPC, or launched standalone via `agentproto-mastra acp`.\",\n version: \"0.1.0\",\n bin: \"node\",\n bin_args: [cliEntry, \"acp\"],\n install: [\n {\n method: \"npm\",\n package: \"@agentproto/adapter-mastra-agent\",\n global: true,\n },\n ],\n // No external runtime to probe — the agent runs in the spawned node process.\n // A node version gate is enough to mark the arm ready.\n version_check: {\n cmd: \"node --version\",\n parse: \"(\\\\d+\\\\.\\\\d+\\\\.\\\\d+)\",\n range: \">=20.9.0\",\n timeout_ms: 5000,\n },\n auth: {\n ref: \"./mastra-agent.ACP.md\",\n // The chosen model's provider key is read from the spawn env by Mastra's\n // model gateway. Any one of these covers the common providers.\n state: {\n env: [\"OPENROUTER_API_KEY\", \"ANTHROPIC_API_KEY\", \"OPENAI_API_KEY\"],\n },\n },\n sandbox:\n \"In-process: the agent runs inside the spawned node process. Tool-level sandboxing is the responsibility of the tools the AGENT.md grants.\",\n protocol: \"acp\",\n acp: \"./mastra-agent.ACP.md\",\n session: {\n mode: \"persistent\",\n idle_timeout_ms: 1_800_000,\n context_carryover: true,\n },\n // Mastra's model router reads the provider off each id's OWN first segment\n // (`providerOf` in model-resolver.ts), no adapter mode — so the route falls\n // out of the chosen model → derived-from-model.\n routeSelection: \"derived-from-model\",\n models: {\n // Cheap OpenRouter coder by default — this is the budget first-party arm.\n // Anthropic models are not advertised here (this arm shouldn't be steered\n // onto premium Anthropic spend); the free-form `model` option still\n // accepts any Mastra-routable id. `provider` is this id's OWN first\n // segment (see providerOf in model-resolver.ts) — Mastra's model router\n // reads it directly, no adapter mode needed. Note the double prefix on\n // the OpenRouter entries: \"openrouter/\" (provider) + the upstream id\n // OpenRouter itself expects (which happens to contain another \"/\").\n default: \"openrouter/z-ai/glm-5.2\",\n allowed: [\n { id: \"openrouter/z-ai/glm-5.2\", provider: \"openrouter\" },\n { id: \"openrouter/deepseek/deepseek-v4-pro\", provider: \"openrouter\" },\n { id: \"openai/gpt-5\", provider: \"openai\" },\n ],\n env: {\n anthropic: \"ANTHROPIC_API_KEY\",\n openrouter: \"OPENROUTER_API_KEY\",\n openai: \"OPENAI_API_KEY\",\n },\n },\n capabilities: {\n streaming: true,\n // Tool calls run inside Mastra and are relayed to the host as ACP\n // tool_call / tool_call_update session updates (see acp-host.ts +\n // tool-call-map.ts). The built-in default agent ships the workspace\n // toolset (read/edit/run), so this is on.\n tool_calls: true,\n sub_agents: false,\n file_io: false,\n multimodal: false,\n resumable: false,\n bidirectional: true,\n },\n options: [\n {\n id: \"model\",\n // string (not enum) so any Mastra-routable `provider/model` id works\n // without a code change. Applied as a `--model <id>` spawn arg.\n type: \"string\" as const,\n description:\n \"Model id routed via Mastra's model gateway (e.g. \" +\n \"'openrouter/z-ai/glm-5.2', 'openrouter/deepseek/deepseek-v4-pro'). \" +\n \"Applied as a `--model` arg at spawn. Omit for the default.\",\n bin_args_template: [\"--model\", \"{value}\"],\n },\n {\n id: \"agent\",\n // Path to an AIP-42 AGENT.md. Lets `agent_start` pick WHICH agent this\n // arm runs — e.g. an emitted `.agentproto/agents/<id>/AGENT.md` from an\n // @agentproto/app-kit app. Without it the built-in default agent runs.\n // The CLI already reads `--agent` (see cli.ts); this exposes it through\n // the manifest so the daemon can pass it.\n type: \"string\" as const,\n description:\n \"Path to an AIP-42 AGENT.md to run as this agent (e.g. an emitted \" +\n \"'.agentproto/agents/<id>/AGENT.md'). Applied as an `--agent <path>` \" +\n \"arg at spawn. Omit to run the built-in default agent.\",\n bin_args_template: [\"--agent\", \"{value}\"],\n },\n ],\n tags: [\"mastra\", \"agentproto\", \"acp\", \"agent-runtime\", \"first-party\"],\n})\n\nexport function mastraAgentRuntime(): AgentCliRuntime {\n return createAgentCliRuntime(mastraAgent)\n}\n\nexport {\n makeAgentFactory,\n defaultAgentManifest,\n DEFAULT_MODEL,\n DEFAULT_TOOL_IDS,\n} from \"./default-agent.js\"\nexport { MastraAcpAgent, promptText, type MastraLike } from \"./acp-host.js\"\nexport { resolveMastraModel, modelRefToString, providerOf } from \"./model-resolver.js\"\nexport { makeWorkspaceTools, resolveInCwd } from \"./workspace-tools.js\"\nexport { buildSqliteMemory, resolveMemoryDbPath } from \"./memory.js\"\nexport {\n chunkToSessionUpdate,\n toolKindFor,\n toolCallTitle,\n type MastraStreamChunk,\n} from \"./tool-call-map.js\"\nexport { runAcpOverStdio } from \"./run.js\"\nexport type { AgentCliHandle, AgentCliRuntime }\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentproto/adapter-mastra-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "@agentproto/adapter-mastra-agent — first-party agentproto agent. An AIP-42 AGENT.md run as a live Mastra agent behind an AIP-44 ACP server, spawnable by the daemon like any other AGENT-CLI arm AND launchable standalone via `agentproto-mastra acp`. Our own loop, our own models — no external CLI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentproto",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@agentclientprotocol/sdk": "^0.21.0",
|
|
51
|
-
"@mastra/core": "^1.
|
|
52
|
-
"@mastra/
|
|
53
|
-
"@mastra/
|
|
51
|
+
"@mastra/core": "^1.52.1",
|
|
52
|
+
"@mastra/libsql": "~1.17.0",
|
|
53
|
+
"@mastra/memory": "^1.23.1",
|
|
54
54
|
"zod": "^4.4.3",
|
|
55
55
|
"@agentproto/agent": "0.2.1",
|
|
56
|
-
"@agentproto/driver-agent-cli": "2.0
|
|
57
|
-
"@agentproto/mastra": "0.2.
|
|
56
|
+
"@agentproto/driver-agent-cli": "2.1.0",
|
|
57
|
+
"@agentproto/mastra": "0.2.3"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/node": "^25.6.2",
|