mirab 0.0.0 → 0.2.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.
Files changed (106) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +223 -3
  3. package/package.json +56 -7
  4. package/src/agent/approved.ts +261 -0
  5. package/src/agent/define.ts +235 -0
  6. package/src/agent/guest.ts +138 -0
  7. package/src/agent/init.ts +150 -0
  8. package/src/agent/manifest.ts +141 -0
  9. package/src/agent/modules.ts +23 -0
  10. package/src/agent/runtime.ts +239 -0
  11. package/src/agent-profiles.ts +327 -0
  12. package/src/api/bootstrap-contract.ts +95 -0
  13. package/src/api/channel-contract.ts +19 -0
  14. package/src/api/client.ts +100 -0
  15. package/src/api/contract.ts +2454 -0
  16. package/src/api/events-contract.ts +103 -0
  17. package/src/api/import-contract.ts +22 -0
  18. package/src/api/orchestrator-contract.ts +73 -0
  19. package/src/api/runner-contract.ts +25 -0
  20. package/src/api/scopes.ts +41 -0
  21. package/src/api/sessions-contract.ts +71 -0
  22. package/src/api/settings-contract.ts +50 -0
  23. package/src/channel/bridge.ts +97 -0
  24. package/src/channel/local.ts +154 -0
  25. package/src/channel/state.ts +11 -0
  26. package/src/channel/wire.ts +104 -0
  27. package/src/dev-sync.ts +206 -0
  28. package/src/dev.ts +453 -0
  29. package/src/events-tail.ts +75 -0
  30. package/src/images.ts +498 -0
  31. package/src/index.ts +21 -0
  32. package/src/invocation.ts +34 -0
  33. package/src/isolation/anchored-fs.ts +284 -0
  34. package/src/isolation/colima.ts +159 -0
  35. package/src/isolation/container.ts +189 -0
  36. package/src/isolation/firecracker.ts +414 -0
  37. package/src/isolation/guest-protocol.json +1 -0
  38. package/src/isolation/host-user.ts +247 -0
  39. package/src/isolation/image.ts +336 -0
  40. package/src/isolation/index.ts +477 -0
  41. package/src/isolation/multipass.ts +541 -0
  42. package/src/isolation/network.ts +167 -0
  43. package/src/isolation/policy.ts +86 -0
  44. package/src/isolation/session.ts +385 -0
  45. package/src/isolation/sync.ts +329 -0
  46. package/src/isolation/vz-network-setup.ts +247 -0
  47. package/src/isolation/vz.ts +312 -0
  48. package/src/mirab-main.ts +536 -0
  49. package/src/mirab.ts +13 -0
  50. package/src/runner/define.ts +187 -0
  51. package/src/runner/image.ts +239 -0
  52. package/src/runner/index.ts +37 -0
  53. package/src/runner/serve.ts +491 -0
  54. package/src/runner/toolsets.ts +205 -0
  55. package/src/spawn-adapters/claude.ts +112 -0
  56. package/src/spawn-adapters/codex-logs.ts +130 -0
  57. package/src/spawn-adapters/codex-notify.ts +73 -0
  58. package/src/spawn-adapters/codex.ts +89 -0
  59. package/src/spawn-adapters/index.ts +40 -0
  60. package/src/spawn-adapters/types.ts +55 -0
  61. package/src/spawn-attach.ts +243 -0
  62. package/src/spawn-binary.ts +90 -0
  63. package/src/spawn-bridge.ts +504 -0
  64. package/src/spawn-bundle.ts +16 -0
  65. package/src/spawn-detach.ts +301 -0
  66. package/src/spawn-events.ts +35 -0
  67. package/src/spawn-hook.ts +86 -0
  68. package/src/spawn-input.ts +107 -0
  69. package/src/spawn-native.ts +49 -0
  70. package/src/spawn-nudge-worker.ts +61 -0
  71. package/src/spawn-nudge.ts +446 -0
  72. package/src/spawn-output.ts +45 -0
  73. package/src/spawn-queue.ts +135 -0
  74. package/src/spawn-quiet.ts +69 -0
  75. package/src/spawn-report.ts +114 -0
  76. package/src/spawn-sessions.ts +166 -0
  77. package/src/spawn-vm.ts +356 -0
  78. package/src/spawn-worker.ts +766 -0
  79. package/src/spawn.ts +468 -0
  80. package/src/station/config.ts +89 -0
  81. package/src/station/gateway.ts +94 -0
  82. package/src/station/vault.ts +96 -0
  83. package/src/test-cli.ts +90 -0
  84. package/src/tools.ts +3 -0
  85. package/types/agent/define.d.ts +76 -0
  86. package/types/agent/manifest.d.ts +53 -0
  87. package/types/agent/modules.d.ts +1 -0
  88. package/types/images.d.ts +124 -0
  89. package/types/index.d.ts +6 -0
  90. package/types/isolation/colima.d.ts +37 -0
  91. package/types/isolation/container.d.ts +25 -0
  92. package/types/isolation/firecracker.d.ts +55 -0
  93. package/types/isolation/host-user.d.ts +47 -0
  94. package/types/isolation/image.d.ts +158 -0
  95. package/types/isolation/index.d.ts +128 -0
  96. package/types/isolation/network.d.ts +33 -0
  97. package/types/isolation/policy.d.ts +29 -0
  98. package/types/isolation/session.d.ts +99 -0
  99. package/types/isolation/vz.d.ts +63 -0
  100. package/types/runner/define.d.ts +101 -0
  101. package/types/runner/image.d.ts +52 -0
  102. package/types/runner/index.d.ts +13 -0
  103. package/types/runner/serve.d.ts +69 -0
  104. package/types/runner/toolsets.d.ts +35 -0
  105. package/types/tools.d.ts +2 -0
  106. package/index.js +0 -1
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,7 +1,227 @@
1
1
  # mirab
2
2
 
3
- Virtual machines and agents for Addis: the VM and agent primitive behind gild.
3
+ Agents in VMs on your own machine.
4
4
 
5
- This version only reserves the name. The first release is coming.
5
+ An agent is a folder: its instructions, tools and skills. mirab runs the
6
+ whole agent (its loop, its tools and every command it picks) inside a VM on
7
+ your hardware, and the agent never holds a credential: model calls and other
8
+ outside requests leave through the station on the host, which adds the key
9
+ from [harar](https://github.com/addiscorp/harar) on the way out. Agents meet
10
+ people in channels, inside the apps they help with.
6
11
 
7
- Siblings: [woreda](https://www.npmjs.com/package/woreda) (Actions runners) and [kebele](https://www.npmjs.com/package/kebele) (containers).
12
+ > **Status: early.** This is mirab's agent system, moved over with its
13
+ > history: VMs through Apple's Virtualization framework (`vz`) and
14
+ > Firecracker, containers, `mirab spawn`, and the Claude and Codex adapters.
15
+ > `mirab init`, `mirab dev` and the station are in; channels come next.
16
+
17
+ ## Install
18
+
19
+ ```sh
20
+ curl -fsSL https://mirab-releases.addis.gg/install.sh | sh
21
+ ```
22
+
23
+ It installs mirab into `~/.mirab` (the release in `~/.mirab/releases/`, the
24
+ `mirab` command in `~/.mirab/bin`), checked against the SHA-256 in the
25
+ release's manifest, with no sudo. It brings its own Bun, and on Linux its own
26
+ Firecracker. The VM image is downloaded on first use. Builds: macOS (Apple
27
+ silicon and Intel) and Linux x86_64. `sh -s -- --canary` installs the newest
28
+ build of `main`.
29
+
30
+ ## Make an agent
31
+
32
+ ```sh
33
+ mkdir ops && cd ops
34
+ mirab # asks for the agent's harar name
35
+ # or: mirab init ops --name gg.addis.agent.ops
36
+ ```
37
+
38
+ It writes `agent/agent.ts`, `agent/instructions.md`, and `tools/`, `skills/`,
39
+ `subagents/`, `schedules/` and `channels/` folders. It never writes a `.env`:
40
+ model access comes from harar.
41
+
42
+ ## Run it
43
+
44
+ ```sh
45
+ mirab dev # in the project: a chat with the agent, in its own VM
46
+ mirab manifest # what mirab reads about the agent, as JSON
47
+ ```
48
+
49
+ The VM has no network of its own. Its only way out is the station on this
50
+ machine, which lets it reach the domains in `agent.ts` (`domains`) and adds
51
+ the model key, sent by harar for that host only, on the way out. Nothing in the VM holds the
52
+ key. `~/.config/mirab/station.json` says where harar is and which secret is
53
+ the key:
54
+
55
+ ```json
56
+ {
57
+ "harar": { "socket": "/var/run/harar.sock" },
58
+ "models": {
59
+ "anthropic": { "key": "personal/anthropic/API_KEY" },
60
+ "claude": { "token": "personal/claude/OAUTH_TOKEN" }
61
+ }
62
+ }
63
+ ```
64
+
65
+ Like any key, harar decides where these go, and records each time:
66
+
67
+ ```sh
68
+ harar hosts allow personal/anthropic/API_KEY api.anthropic.com
69
+ harar hosts allow personal/claude/OAUTH_TOKEN api.anthropic.com
70
+ ```
71
+
72
+ While `mirab dev` runs, what you save reaches the agent's VM, and the agent
73
+ picks up edits to `agent/` before its next turn, keeping the conversation.
74
+ When the session ends, what the agent changed comes back to your project. If
75
+ you both changed the same file, yours stays and the agent's is saved aside,
76
+ never merged and never silently dropped. Your `.git` is never touched. What
77
+ the agent changes about itself (anything under `agent/` and every `.env*`)
78
+ never lands on its own: it's held aside and named when the session ends, for
79
+ you to look at and copy over if you want it.
80
+
81
+ That alone can't stop an agent widening itself (its code may import from
82
+ elsewhere), so what it may reach is approved per project, not taken from its
83
+ code: the first `mirab dev` records the manifest's `domains` and `packages`,
84
+ and if its code later asks for more, by any route, the new ones are left out
85
+ of the session and named. If the change was yours, approve it here:
86
+
87
+ ```sh
88
+ mirab manifest # what the agent asks for (read in its VM), and what's waiting
89
+ mirab manifest approve # yes to what's waiting
90
+ ```
91
+
92
+ What the agent's calls may do is rixse's to decide. A host a key goes to lets
93
+ reads (GET, HEAD) through and holds everything else for you, unless the
94
+ agent's `gateway` section says otherwise:
95
+
96
+ ```ts
97
+ export default defineAgent({
98
+ name: 'gg.addis.agent.ops',
99
+ model: 'anthropic/claude-sonnet-5-5',
100
+ gateway: {
101
+ rules: [
102
+ // apply: goes through; request: held for you; forbidden: never.
103
+ { host: 'github.com', method: 'POST', path: '/acme/repo.git/git-receive-pack', effect: 'apply' },
104
+ { host: 'api.stripe.com', method: 'DELETE', effect: 'forbidden' },
105
+ ],
106
+ // Optional: a separate key used only for sends you approve, so a read key can't write.
107
+ secrets: { 'api.stripe.com': { agent: 'prod/shop/READ', approved: 'prod/shop/WRITE' } },
108
+ },
109
+ })
110
+ ```
111
+
112
+ The section is approved as a whole, like the rest: the first `mirab dev`
113
+ records it, and any change after that, even one that looks narrower, waits
114
+ for `mirab manifest approve`, which shows every rule. Until then the approved
115
+ one stays in force.
116
+
117
+ The chat is a channel the station hosts, between you and the agent, and it
118
+ stays on this machine (`~/.mirab/sessions/channels`, readable only by
119
+ you). `mirab dev` prints its id when it starts. In it you are `station.json`'s
120
+ `human` (your harar name, like `gg.addis.human.sami`), or your login in the
121
+ agent's org until you set one. Later the same chat can live in an app.
122
+
123
+ The agent's files run only in its VM, never on this machine: the manifest is
124
+ read there and checked here. The VM can spend the model key
125
+ on its route (that is what the route is for), but never read it.
126
+
127
+ mirab runs on [Bun](https://bun.sh), and so do the agents it makes (their
128
+ `agent/` files are TypeScript, run as is).
129
+
130
+ ## Claude Code on your own subscription
131
+
132
+ `mirab spawn --vm claude` runs Claude Code in a VM on your Claude
133
+ subscription, and the VM never holds your token. Make a token once with
134
+ `claude setup-token`, keep it in harar
135
+ (`harar put personal/claude/OAUTH_TOKEN`), and name it under `models.claude`
136
+ in `station.json`. In the VM, Claude Code has a placeholder token and the
137
+ station as its API. The station swaps in your token on the way to
138
+ `api.anthropic.com/v1/messages`, and nothing else leaves: Claude Code's
139
+ telemetry and updates are off, and anything else it tries goes through the
140
+ station's whitelist and audit log. One person's token, on their own machine.
141
+
142
+ ## When an agent asks for more
143
+
144
+ A host that isn't in an agent's `domains` is refused, and the station
145
+ records the ask on this machine. You decide in your own terminal, never in
146
+ the agent's VM:
147
+
148
+ ```sh
149
+ mirab escalations # what agents asked for
150
+ mirab allow api.stripe.com # yes: the running station lets it through at once
151
+ mirab dismiss api.stripe.com # no
152
+ mirab revoke api.stripe.com --agent project:$PWD # take a yes back (a project is its folder)
153
+ ```
154
+
155
+ Quote wildcards so the shell leaves them alone: `mirab allow '*.example.com'`.
156
+
157
+ A yes goes into that agent's allow file in `~/.config/mirab/allow/`. To
158
+ keep it, add the host to `domains` in `agent/agent.ts`, so it lives in git.
159
+
160
+ ## Packages
161
+
162
+ An agent's `packages` (apt names, in `agent.ts`) are installed on mirab's
163
+ Ubuntu base image the first time it runs, then cached:
164
+
165
+ ```sh
166
+ mirab image build # build the agent's image now (mirab dev does it on first use)
167
+ mirab image update # boot it, and upgrade it if apt has anything newer
168
+ mirab image list # the images cached on this machine
169
+ mirab image prune # remove ones on an older base, unused 30 days, or left by a stopped build
170
+ ```
171
+
172
+ Building and updating happen in a mirab VM whose only way out is the station, with only
173
+ Ubuntu's mirrors on its whitelist, over HTTPS. An update keeps the image
174
+ before it, for rollback. The same on macOS and Linux.
175
+
176
+ ## Keys for any service
177
+
178
+ Your project's `.env` holds only references (`harar import .env` writes
179
+ them): `STRIPE_KEY=harar://prod/shop/STRIPE_KEY`. harar says where each secret may
180
+ go, and records each time it does:
181
+
182
+ ```sh
183
+ harar hosts allow prod/shop/STRIPE_KEY api.stripe.com
184
+ harar hosts allow personal/github/TOKEN github.com
185
+ harar hosts allow personal/github/TOKEN api.github.com
186
+ ```
187
+
188
+ At a primary, that's a role's `send` permission
189
+ (`harar policy role set <role> --send "prod/shop/STRIPE_KEY api.stripe.com"`),
190
+ approved like any widening. A secret harar lets go nowhere isn't given to the VM.
191
+
192
+ A `.env` comes with whatever repo you cloned, so a reference alone gives an
193
+ agent nothing: you let each project use each secret once, here, never in its
194
+ VM. A project is its folder on this machine, never the name its agent gives.
195
+ `mirab dev` and `mirab spawn --vm` print the exact line when one is missing;
196
+ in the project's folder it's just:
197
+
198
+ ```sh
199
+ mirab secrets allow prod/shop/STRIPE_KEY
200
+ mirab secrets list
201
+ mirab secrets revoke prod/shop/STRIPE_KEY
202
+ ```
203
+
204
+ In the VM, `STRIPE_KEY` is a placeholder, new every session. Programs run
205
+ unchanged (`curl`, `git`, `gh`, SDKs), with the station as their proxy. The
206
+ VM trusts the station's own certificate authority (its key stays in
207
+ `~/.config/mirab/station-ca`). For those hosts only, the station opens the
208
+ request, swaps the placeholder in its headers for the real value from harar,
209
+ and sends it on over its own TLS, checking the host's real certificate. A
210
+ placeholder sent to any other host is refused. Bodies and URLs are never
211
+ rewritten, and every other host stays a sealed tunnel. The model never sees a
212
+ key, because the agent never has one.
213
+
214
+ ## Try it
215
+
216
+ ```sh
217
+ bun install
218
+ bun run src/mirab.ts --help
219
+ ```
220
+
221
+ Run it from source for now: a compiled `bun run build` binary can't start
222
+ agents yet, because it needs the PTY module and Firecracker beside it, which
223
+ mirab's packaging will put there.
224
+
225
+ ## License
226
+
227
+ [Apache-2.0](LICENSE)
package/package.json CHANGED
@@ -1,11 +1,60 @@
1
1
  {
2
2
  "name": "mirab",
3
- "version": "0.0.0",
4
- "description": "Virtual machines and agents for Addis: the VM and agent primitive behind gild. Placeholder; the first release is coming.",
3
+ "version": "0.2.0",
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "bun run src/mirab.ts",
7
+ "build": "bun build --compile --minify src/mirab.ts --outfile dist/mirab",
8
+ "test": "bun test",
9
+ "vm:image": "bun run scripts/build-vm-image.ts",
10
+ "typecheck": "tsc --noEmit",
11
+ "types": "rm -rf types && tsc -p tsconfig.types.json",
12
+ "format": "prettier --write src scripts",
13
+ "format:check": "prettier --check src scripts"
14
+ },
15
+ "dependencies": {
16
+ "@ai-sdk/anthropic": "4.0.78",
17
+ "ai": "7.0.137",
18
+ "chalk": "^5.6.2",
19
+ "commander": "^14.0.1",
20
+ "inquirer": "^12.9.4",
21
+ "node-pty": "1.2.0-beta.15",
22
+ "smol-toml": "^1.9.0",
23
+ "zod": "^4.6.5",
24
+ "rixse": "^0.1.0"
25
+ },
26
+ "devDependencies": {
27
+ "@types/node": "^24.0.0",
28
+ "bun-types": "^1.3.1",
29
+ "prettier": "3.9.9",
30
+ "typescript": "^7.0.2"
31
+ },
32
+ "description": "Agents in VMs on your own machine",
5
33
  "license": "Apache-2.0",
6
- "author": "Addis",
7
- "homepage": "https://addis.gg",
8
- "keywords": ["vm", "microvm", "agents", "firecracker", "sandbox"],
9
- "main": "index.js",
10
- "files": ["index.js", "README.md"]
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/addiscorp/mirab.git"
37
+ },
38
+ "exports": {
39
+ ".": {
40
+ "types": "./types/index.d.ts",
41
+ "default": "./src/index.ts"
42
+ },
43
+ "./tools": {
44
+ "types": "./types/tools.d.ts",
45
+ "default": "./src/tools.ts"
46
+ },
47
+ "./runner": {
48
+ "types": "./types/runner/index.d.ts",
49
+ "default": "./src/runner/index.ts"
50
+ }
51
+ },
52
+ "files": [
53
+ "src",
54
+ "!src/**/*.test.ts",
55
+ "!src/**/*.e2e.test.ts",
56
+ "types",
57
+ "README.md",
58
+ "LICENSE"
59
+ ]
11
60
  }