@agentproto/adapter-mastracode 0.2.0 → 0.2.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/LICENSE CHANGED
@@ -1,21 +1,202 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 agentproto contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/MASTRACODE.md CHANGED
@@ -30,3 +30,24 @@ npx -y mastracode --prompt "Fix the bug" --output jsonl
30
30
 
31
31
  As of 2026-06-30, `mastracode acp --help` prints the top-level CLI help rather
32
32
  than ACP-specific usage, so this adapter is intentionally not marked as ACP.
33
+
34
+ ## No `lean` mode (yet)
35
+
36
+ Investigated declaring a `lean` mode (drop skill/memory/subagent scaffolding
37
+ to cut input-token overhead) but found no lever that actually reaches this
38
+ adapter's headless invocation:
39
+
40
+ - The headless CLI (`--prompt ...`, what `protocol: print` drives here) has
41
+ no flag for it — `mastracode --help` lists only
42
+ `--continue/--thread/--title/--clone-thread/--resource-id/--timeout/
43
+ --max-turns/--permission-mode/--output/--model/--mode/--thinking-level/
44
+ --settings`.
45
+ - `MASTRACODE_DISABLE_MCP` / `MASTRACODE_DISABLE_HOOKS` /
46
+ `MASTRACODE_DISABLE_MEMORY` exist in the installed package but are only
47
+ read by the interactive TUI entrypoint (`tuiMain`); the headless entrypoint
48
+ (`runMCCli`) this adapter spawns never reads them, so declaring them as
49
+ `env` here would silently do nothing.
50
+ - `--settings <path>` can point at a leaner `settings.json` (fewer model
51
+ packs / no subagents / OM off), but that requires shipping and maintaining
52
+ an actual settings file alongside the adapter, not just a manifest flag —
53
+ out of scope here. Revisit if that's worth doing.
package/dist/index.mjs CHANGED
@@ -46,13 +46,15 @@ var mastracode = defineAgentCli({
46
46
  },
47
47
  models: {
48
48
  default: "anthropic/claude-sonnet-4-5",
49
+ // Anthropic is no longer advertised as a pickable escalation — only the
50
+ // adapter's own default Claude model stays listed (repointing the default
51
+ // is out of scope). The extra Sonnet + gateway dupe are dropped from the
52
+ // menu; the free-form `model` option still accepts any id.
49
53
  allowed: [
50
54
  "anthropic/claude-sonnet-4-5",
51
- "anthropic/claude-sonnet-4-6",
52
55
  "openai/gpt-5.1",
53
56
  "openai/gpt-5.1-mini",
54
- "google/gemini-2.5-flash",
55
- "openrouter/anthropic/claude-sonnet-4-6"
57
+ "google/gemini-2.5-flash"
56
58
  ],
57
59
  env: {
58
60
  anthropic: "ANTHROPIC_API_KEY",
@@ -125,6 +127,10 @@ var mastracode = defineAgentCli({
125
127
  acp: {
126
128
  checked: "2026-06-30",
127
129
  result: "`mastracode acp --help` prints top-level Mastra Code help; no ACP subcommand is currently discoverable."
130
+ },
131
+ lean: {
132
+ checked: "2026-07-03",
133
+ result: "No `lean` mode declared. The headless entrypoint this adapter spawns (runMCCli, driven by `--prompt`) has no flag to drop skill/subagent/OM scaffolding, and does not read the MASTRACODE_DISABLE_MCP / MASTRACODE_DISABLE_HOOKS / MASTRACODE_DISABLE_MEMORY env vars \u2014 those are wired only into the interactive TUI entrypoint (tuiMain), so declaring them here would silently do nothing. `--settings <path>` could point at a leaner packaged settings.json, but that means shipping and maintaining an actual settings file, not just a manifest patch \u2014 revisit if worth doing."
128
134
  }
129
135
  },
130
136
  tags: ["mastracode", "mastra", "print", "agent-runtime", "coding"]
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;AAuBO,IAAM,aAA6B,cAAA,CAAe;AAAA,EACvD,IAAA,EAAM,YAAA;AAAA,EACN,EAAA,EAAI,YAAA;AAAA,EACJ,WAAA,EACE,kNAAA;AAAA,EACF,OAAA,EAAS,OAAA;AAAA,EACT,GAAA,EAAK,KAAA;AAAA,EACL,QAAA,EAAU,CAAC,IAAA,EAAM,YAAY,CAAA;AAAA,EAC7B,OAAA,EAAS,CAAC,EAAE,MAAA,EAAQ,OAAO,OAAA,EAAS,YAAA,EAAc,MAAA,EAAQ,IAAA,EAAM,CAAA;AAAA,EAChE,aAAA,EAAe;AAAA,IACb,GAAA,EAAK,6BAAA;AAAA,IACL,KAAA,EAAO,sBAAA;AAAA,IACP,KAAA,EAAO,UAAA;AAAA,IACP,UAAA,EAAY;AAAA,GACd;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,GAAA,EAAK,cAAA;AAAA,IACL,KAAA,EAAO;AAAA,MACL,GAAA,EAAK;AAAA,QACH,mBAAA;AAAA,QACA,gBAAA;AAAA,QACA,oBAAA;AAAA,QACA;AAAA;AACF;AACF,GACF;AAAA,EACA,OAAA,EAAS,cAAA;AAAA,EACT,QAAA,EAAU,OAAA;AAAA,EACV,KAAA,EAAO;AAAA,IACL,WAAA,EAAa,UAAA;AAAA,IACb,aAAA,EAAe,CAAC,UAAA,EAAY,OAAO,CAAA;AAAA,IACnC,YAAY,EAAC;AAAA,IACb,MAAA,EAAQ,EAAE,IAAA,EAAM,UAAA,EAAY,M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,QAAA,EAAU,MAAM;AAAA;AACpC,GACF;AAAA,EACA,OAAA,EAAS;AAAA,IACP;AAAA,MACE,EAAA,EAAI,OAAA;AAAA,MACJ,IAAA,EAAM,QAAA;AAAA,MACN,WAAA,EACE,yFAAA;AAAA,MACF,iBAAA,EAAmB,CAAC,SAAA,EAAW,SAAS;AAAA,KAC1C;AAAA,IACA;AAAA,MACE,EAAA,EAAI,gBAAA;AAAA,MACJ,IAAA,EAAM,MAAA;AAAA,MACN,MAAM,CAAC,KAAA,EAAO,KAAA,EAAO,QAAA,EAAU,QAAQ,OAAO,CAAA;AAAA,MAC9C,WAAA,EAAa,uCAAA;AAAA,MACb,iBAAA,EAAmB,CAAC,kBAAA,EAAoB,SAAS;AAAA,KACnD;AAAA,IACA;AAAA,MACE,EAAA,EAAI,SAAA;AAAA,MACJ,IAAA,EAAM,SAAA;AAAA,MACN,GAAA,EAAK,CAAA;AAAA,MACL,GAAA,EAAK,KAAA;AAAA,MACL,WAAA,EAAa,2CAAA;AAAA,MACb,iBAAA,EAAmB,CAAC,WAAA,EAAa,SAAS;AAAA;AAC5C,GACF;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,OAAA,EAAS,MAAA;AAAA,IACT,SAAA,EAAW,CAAC,MAAA,EAAQ,YAAA,EAAc,eAAe;AAAA,GACnD;AAAA,EACA,QAAA,EAAU;AAAA,IACR,GAAA,EAAK;AAAA,MACH,OAAA,EAAS,YAAA;AAAA,MACT,MAAA,EACE;AAAA;AACJ,GACF;AAAA,EACA,MAAM,CAAC,YAAA,EAAc,QAAA,EAAU,OAAA,EAAS,iBAAiB,QAAQ;AACnE,CAAC;AAEM,SAAS,iBAAA,GAAqC;AACnD,EAAA,OAAO,sBAAsB,UAAU,CAAA;AACzC","file":"index.mjs","sourcesContent":["/**\n * @agentproto/adapter-mastracode — AIP-45 adapter for Mastra Code.\n *\n * Mastra Code does not currently expose a discoverable ACP subcommand\n * (`mastracode acp --help` prints the top-level CLI help). We spawn\n * its documented headless CLI via `npx -y mastracode` and mark this\n * adapter as a print/headless protocol arm rather than claiming ACP.\n *\n * import { mastracode, mastracodeRuntime } from \"@agentproto/adapter-mastracode\"\n * const session = await mastracodeRuntime().start()\n * for await (const evt of session.send({ role: \"user\", content: \"...\" })) {\n * console.log(evt)\n * }\n * await session.close()\n */\n\nimport {\n createAgentCliRuntime,\n defineAgentCli,\n type AgentCliHandle,\n type AgentCliRuntime,\n} from \"@agentproto/driver-agent-cli\"\n\nexport const mastracode: AgentCliHandle = defineAgentCli({\n name: \"mastracode\",\n id: \"mastracode\",\n description:\n \"Mastra Code — terminal-based AI coding agent with persistent threads, tools, modes, and multi-provider model support. Current CLI exposes TUI/headless operation, not ACP; spawned via `npx -y mastracode`.\",\n version: \"0.1.0\",\n bin: \"npx\",\n bin_args: [\"-y\", \"mastracode\"],\n install: [{ method: \"npm\", package: \"mastracode\", global: true }],\n version_check: {\n cmd: \"npm view mastracode version\",\n parse: \"(\\\\d+\\\\.\\\\d+\\\\.\\\\d+)\",\n range: \">=0.26.0\",\n timeout_ms: 15_000,\n },\n auth: {\n ref: \"./SECRETS.md\",\n state: {\n env: [\n \"ANTHROPIC_API_KEY\",\n \"OPENAI_API_KEY\",\n \"OPENROUTER_API_KEY\",\n \"GOOGLE_GENERATIVE_AI_API_KEY\",\n ],\n },\n },\n sandbox: \"./SANDBOX.md\",\n protocol: \"print\",\n print: {\n prompt_flag: \"--prompt\",\n output_format: [\"--output\", \"jsonl\"],\n pre_prompt: [],\n resume: { flag: \"--thread\", kind: \"value\" },\n event_schema: \"mastra-jsonl\",\n },\n session: {\n mode: \"ephemeral\",\n idle_timeout_ms: 1_800_000,\n context_carryover: false,\n },\n models: {\n default: \"anthropic/claude-sonnet-4-5\",\n allowed: [\n \"anthropic/claude-sonnet-4-5\",\n \"anthropic/claude-sonnet-4-6\",\n \"openai/gpt-5.1\",\n \"openai/gpt-5.1-mini\",\n \"google/gemini-2.5-flash\",\n \"openrouter/anthropic/claude-sonnet-4-6\",\n ],\n env: {\n anthropic: \"ANTHROPIC_API_KEY\",\n openai: \"OPENAI_API_KEY\",\n openrouter: \"OPENROUTER_API_KEY\",\n google: \"GOOGLE_GENERATIVE_AI_API_KEY\",\n },\n },\n capabilities: {\n streaming: true,\n tool_calls: true,\n sub_agents: true,\n file_io: true,\n multimodal: false,\n // `mastracode --thread <id>` reattaches to a prior thread with real\n // persisted memory (confirmed cross-process: separate spawn, same\n // thread id, correct continuity). `print.resume` below drives this.\n resumable: true,\n bidirectional: false,\n },\n modes: [\n {\n id: \"default\",\n description:\n \"Default headless mode. Mastra Code defaults to build mode when omitted.\",\n },\n {\n id: \"plan\",\n description:\n \"Plan-only mode — analyze architecture and propose implementation plans before writing code.\",\n bin_args_append: [\"--mode\", \"plan\"],\n },\n {\n id: \"build\",\n description:\n \"Build mode — file edits and shell commands use Mastra Code's configured permissions.\",\n bin_args_append: [\"--mode\", \"build\"],\n },\n {\n id: \"fast\",\n description: \"Fast mode — lower-latency answers and small edits.\",\n bin_args_append: [\"--mode\", \"fast\"],\n },\n ],\n options: [\n {\n id: \"model\",\n type: \"string\",\n description:\n \"Provider/model override for this operator binding (e.g. `anthropic/claude-sonnet-4-5`).\",\n bin_args_template: [\"--model\", \"{value}\"],\n },\n {\n id: \"thinking_level\",\n type: \"enum\",\n enum: [\"off\", \"low\", \"medium\", \"high\", \"xhigh\"],\n description: \"Thinking level passed to Mastra Code.\",\n bin_args_template: [\"--thinking-level\", \"{value}\"],\n },\n {\n id: \"timeout\",\n type: \"integer\",\n min: 1,\n max: 86_400,\n description: \"Maximum headless run duration in seconds.\",\n bin_args_template: [\"--timeout\", \"{value}\"],\n },\n ],\n continuation: {\n default: \"none\",\n supported: [\"none\", \"transcript\", \"native-resume\"],\n },\n metadata: {\n acp: {\n checked: \"2026-06-30\",\n result:\n \"`mastracode acp --help` prints top-level Mastra Code help; no ACP subcommand is currently discoverable.\",\n },\n },\n tags: [\"mastracode\", \"mastra\", \"print\", \"agent-runtime\", \"coding\"],\n})\n\nexport function mastracodeRuntime(): AgentCliRuntime {\n return createAgentCliRuntime(mastracode)\n}\n\nexport type { AgentCliHandle, AgentCliRuntime }\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;AAuBO,IAAM,aAA6B,cAAA,CAAe;AAAA,EACvD,IAAA,EAAM,YAAA;AAAA,EACN,EAAA,EAAI,YAAA;AAAA,EACJ,WAAA,EACE,kNAAA;AAAA,EACF,OAAA,EAAS,OAAA;AAAA,EACT,GAAA,EAAK,KAAA;AAAA,EACL,QAAA,EAAU,CAAC,IAAA,EAAM,YAAY,CAAA;AAAA,EAC7B,OAAA,EAAS,CAAC,EAAE,MAAA,EAAQ,OAAO,OAAA,EAAS,YAAA,EAAc,MAAA,EAAQ,IAAA,EAAM,CAAA;AAAA,EAChE,aAAA,EAAe;AAAA,IACb,GAAA,EAAK,6BAAA;AAAA,IACL,KAAA,EAAO,sBAAA;AAAA,IACP,KAAA,EAAO,UAAA;AAAA,IACP,UAAA,EAAY;AAAA,GACd;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,GAAA,EAAK,cAAA;AAAA,IACL,KAAA,EAAO;AAAA,MACL,GAAA,EAAK;AAAA,QACH,mBAAA;AAAA,QACA,gBAAA;AAAA,QACA,oBAAA;AAAA,QACA;AAAA;AACF;AACF,GACF;AAAA,EACA,OAAA,EAAS,cAAA;AAAA,EACT,QAAA,EAAU,OAAA;AAAA,EACV,KAAA,EAAO;AAAA,IACL,WAAA,EAAa,UAAA;AAAA,IACb,aAAA,EAAe,CAAC,UAAA,EAAY,OAAO,CAAA;AAAA,IACnC,YAAY,EAAC;AAAA,IACb,MAAA,EAAQ,EAAE,IAAA,EAAM,UAAA,EAAY,MAAM,OAAA,EAAQ;AAAA,IAC1C,YAAA,EAAc;AAAA,GAChB;AAAA,EACA,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,WAAA;AAAA,IACN,eAAA,EAAiB,IAAA;AAAA,IACjB,iBAAA,EAAm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AA,EAAmB,CAAC,SAAA,EAAW,SAAS;AAAA,KAC1C;AAAA,IACA;AAAA,MACE,EAAA,EAAI,gBAAA;AAAA,MACJ,IAAA,EAAM,MAAA;AAAA,MACN,MAAM,CAAC,KAAA,EAAO,KAAA,EAAO,QAAA,EAAU,QAAQ,OAAO,CAAA;AAAA,MAC9C,WAAA,EAAa,uCAAA;AAAA,MACb,iBAAA,EAAmB,CAAC,kBAAA,EAAoB,SAAS;AAAA,KACnD;AAAA,IACA;AAAA,MACE,EAAA,EAAI,SAAA;AAAA,MACJ,IAAA,EAAM,SAAA;AAAA,MACN,GAAA,EAAK,CAAA;AAAA,MACL,GAAA,EAAK,KAAA;AAAA,MACL,WAAA,EAAa,2CAAA;AAAA,MACb,iBAAA,EAAmB,CAAC,WAAA,EAAa,SAAS;AAAA;AAC5C,GACF;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,OAAA,EAAS,MAAA;AAAA,IACT,SAAA,EAAW,CAAC,MAAA,EAAQ,YAAA,EAAc,eAAe;AAAA,GACnD;AAAA,EACA,QAAA,EAAU;AAAA,IACR,GAAA,EAAK;AAAA,MACH,OAAA,EAAS,YAAA;AAAA,MACT,MAAA,EACE;AAAA,KACJ;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,OAAA,EAAS,YAAA;AAAA,MACT,MAAA,EACE;AAAA;AAQJ,GACF;AAAA,EACA,MAAM,CAAC,YAAA,EAAc,QAAA,EAAU,OAAA,EAAS,iBAAiB,QAAQ;AACnE,CAAC;AAEM,SAAS,iBAAA,GAAqC;AACnD,EAAA,OAAO,sBAAsB,UAAU,CAAA;AACzC","file":"index.mjs","sourcesContent":["/**\n * @agentproto/adapter-mastracode — AIP-45 adapter for Mastra Code.\n *\n * Mastra Code does not currently expose a discoverable ACP subcommand\n * (`mastracode acp --help` prints the top-level CLI help). We spawn\n * its documented headless CLI via `npx -y mastracode` and mark this\n * adapter as a print/headless protocol arm rather than claiming ACP.\n *\n * import { mastracode, mastracodeRuntime } from \"@agentproto/adapter-mastracode\"\n * const session = await mastracodeRuntime().start()\n * for await (const evt of session.send({ role: \"user\", content: \"...\" })) {\n * console.log(evt)\n * }\n * await session.close()\n */\n\nimport {\n createAgentCliRuntime,\n defineAgentCli,\n type AgentCliHandle,\n type AgentCliRuntime,\n} from \"@agentproto/driver-agent-cli\"\n\nexport const mastracode: AgentCliHandle = defineAgentCli({\n name: \"mastracode\",\n id: \"mastracode\",\n description:\n \"Mastra Code — terminal-based AI coding agent with persistent threads, tools, modes, and multi-provider model support. Current CLI exposes TUI/headless operation, not ACP; spawned via `npx -y mastracode`.\",\n version: \"0.1.0\",\n bin: \"npx\",\n bin_args: [\"-y\", \"mastracode\"],\n install: [{ method: \"npm\", package: \"mastracode\", global: true }],\n version_check: {\n cmd: \"npm view mastracode version\",\n parse: \"(\\\\d+\\\\.\\\\d+\\\\.\\\\d+)\",\n range: \">=0.26.0\",\n timeout_ms: 15_000,\n },\n auth: {\n ref: \"./SECRETS.md\",\n state: {\n env: [\n \"ANTHROPIC_API_KEY\",\n \"OPENAI_API_KEY\",\n \"OPENROUTER_API_KEY\",\n \"GOOGLE_GENERATIVE_AI_API_KEY\",\n ],\n },\n },\n sandbox: \"./SANDBOX.md\",\n protocol: \"print\",\n print: {\n prompt_flag: \"--prompt\",\n output_format: [\"--output\", \"jsonl\"],\n pre_prompt: [],\n resume: { flag: \"--thread\", kind: \"value\" },\n event_schema: \"mastra-jsonl\",\n },\n session: {\n mode: \"ephemeral\",\n idle_timeout_ms: 1_800_000,\n context_carryover: false,\n },\n models: {\n default: \"anthropic/claude-sonnet-4-5\",\n // Anthropic is no longer advertised as a pickable escalation — only the\n // adapter's own default Claude model stays listed (repointing the default\n // is out of scope). The extra Sonnet + gateway dupe are dropped from the\n // menu; the free-form `model` option still accepts any id.\n allowed: [\n \"anthropic/claude-sonnet-4-5\",\n \"openai/gpt-5.1\",\n \"openai/gpt-5.1-mini\",\n \"google/gemini-2.5-flash\",\n ],\n env: {\n anthropic: \"ANTHROPIC_API_KEY\",\n openai: \"OPENAI_API_KEY\",\n openrouter: \"OPENROUTER_API_KEY\",\n google: \"GOOGLE_GENERATIVE_AI_API_KEY\",\n },\n },\n capabilities: {\n streaming: true,\n tool_calls: true,\n sub_agents: true,\n file_io: true,\n multimodal: false,\n // `mastracode --thread <id>` reattaches to a prior thread with real\n // persisted memory (confirmed cross-process: separate spawn, same\n // thread id, correct continuity). `print.resume` below drives this.\n resumable: true,\n bidirectional: false,\n },\n modes: [\n {\n id: \"default\",\n description:\n \"Default headless mode. Mastra Code defaults to build mode when omitted.\",\n },\n {\n id: \"plan\",\n description:\n \"Plan-only mode — analyze architecture and propose implementation plans before writing code.\",\n bin_args_append: [\"--mode\", \"plan\"],\n },\n {\n id: \"build\",\n description:\n \"Build mode — file edits and shell commands use Mastra Code's configured permissions.\",\n bin_args_append: [\"--mode\", \"build\"],\n },\n {\n id: \"fast\",\n description: \"Fast mode — lower-latency answers and small edits.\",\n bin_args_append: [\"--mode\", \"fast\"],\n },\n ],\n options: [\n {\n id: \"model\",\n type: \"string\",\n description:\n \"Provider/model override for this operator binding (e.g. `anthropic/claude-sonnet-4-5`).\",\n bin_args_template: [\"--model\", \"{value}\"],\n },\n {\n id: \"thinking_level\",\n type: \"enum\",\n enum: [\"off\", \"low\", \"medium\", \"high\", \"xhigh\"],\n description: \"Thinking level passed to Mastra Code.\",\n bin_args_template: [\"--thinking-level\", \"{value}\"],\n },\n {\n id: \"timeout\",\n type: \"integer\",\n min: 1,\n max: 86_400,\n description: \"Maximum headless run duration in seconds.\",\n bin_args_template: [\"--timeout\", \"{value}\"],\n },\n ],\n continuation: {\n default: \"none\",\n supported: [\"none\", \"transcript\", \"native-resume\"],\n },\n metadata: {\n acp: {\n checked: \"2026-06-30\",\n result:\n \"`mastracode acp --help` prints top-level Mastra Code help; no ACP subcommand is currently discoverable.\",\n },\n lean: {\n checked: \"2026-07-03\",\n result:\n \"No `lean` mode declared. The headless entrypoint this adapter spawns \" +\n \"(runMCCli, driven by `--prompt`) has no flag to drop skill/subagent/OM \" +\n \"scaffolding, and does not read the MASTRACODE_DISABLE_MCP / \" +\n \"MASTRACODE_DISABLE_HOOKS / MASTRACODE_DISABLE_MEMORY env vars — those \" +\n \"are wired only into the interactive TUI entrypoint (tuiMain), so declaring \" +\n \"them here would silently do nothing. `--settings <path>` could point at a \" +\n \"leaner packaged settings.json, but that means shipping and maintaining an \" +\n \"actual settings file, not just a manifest patch — revisit if worth doing.\",\n },\n },\n tags: [\"mastracode\", \"mastra\", \"print\", \"agent-runtime\", \"coding\"],\n})\n\nexport function mastracodeRuntime(): AgentCliRuntime {\n return createAgentCliRuntime(mastracode)\n}\n\nexport type { AgentCliHandle, AgentCliRuntime }\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentproto/adapter-mastracode",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "@agentproto/adapter-mastracode — AIP-45 AGENT-CLI adapter for Mastra Code. Spawns the documented headless CLI via `npx -y mastracode`; current Mastra Code does not expose a discoverable ACP subcommand.",
5
5
  "keywords": [
6
6
  "agentproto",
@@ -17,7 +17,7 @@
17
17
  "url": "https://github.com/agentproto/ts",
18
18
  "directory": "adapters/mastracode"
19
19
  },
20
- "license": "MIT",
20
+ "license": "Apache-2.0",
21
21
  "type": "module",
22
22
  "main": "dist/index.mjs",
23
23
  "module": "dist/index.mjs",
@@ -41,7 +41,7 @@
41
41
  "access": "public"
42
42
  },
43
43
  "dependencies": {
44
- "@agentproto/driver-agent-cli": "0.3.0"
44
+ "@agentproto/driver-agent-cli": "1.0.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "^25.6.2",