balladeer 0.0.4 → 1.0.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 (60) hide show
  1. package/LICENSE +200 -5
  2. package/README.md +154 -68
  3. package/dist/agent.d.ts +126 -0
  4. package/dist/agent.js +209 -0
  5. package/dist/cli.d.ts +34 -0
  6. package/dist/cli.js +392 -0
  7. package/dist/client.d.ts +44 -0
  8. package/dist/client.js +114 -0
  9. package/dist/commands/affected.d.ts +22 -0
  10. package/dist/commands/affected.js +122 -0
  11. package/dist/commands/check-seals.d.ts +37 -0
  12. package/dist/commands/check-seals.js +289 -0
  13. package/dist/commands/discover.d.ts +68 -0
  14. package/dist/commands/discover.js +395 -0
  15. package/dist/commands/explain.d.ts +35 -0
  16. package/dist/commands/explain.js +90 -0
  17. package/dist/commands/invite.d.ts +24 -0
  18. package/dist/commands/invite.js +197 -0
  19. package/dist/commands/mcp.d.ts +65 -0
  20. package/dist/commands/mcp.js +202 -0
  21. package/dist/commands/propose.d.ts +59 -0
  22. package/dist/commands/propose.js +262 -0
  23. package/dist/commands/repositories.d.ts +18 -0
  24. package/dist/commands/repositories.js +185 -0
  25. package/dist/commands/setup.d.ts +75 -0
  26. package/dist/commands/setup.js +1471 -0
  27. package/dist/commands/status.d.ts +35 -0
  28. package/dist/commands/status.js +482 -0
  29. package/dist/commands/touch-map.d.ts +42 -0
  30. package/dist/commands/touch-map.js +251 -0
  31. package/dist/commands/whoami.d.ts +8 -0
  32. package/dist/commands/whoami.js +79 -0
  33. package/dist/conventions.d.ts +69 -0
  34. package/dist/conventions.js +175 -0
  35. package/dist/copy.d.ts +148 -0
  36. package/dist/copy.js +459 -0
  37. package/dist/currency.d.ts +31 -0
  38. package/dist/currency.js +72 -0
  39. package/dist/gh.d.ts +80 -0
  40. package/dist/gh.js +188 -0
  41. package/dist/git.d.ts +76 -0
  42. package/dist/git.js +203 -0
  43. package/dist/markers.d.ts +76 -0
  44. package/dist/markers.js +125 -0
  45. package/dist/mcp-config.d.ts +99 -0
  46. package/dist/mcp-config.js +230 -0
  47. package/dist/release.d.ts +55 -0
  48. package/dist/release.js +67 -0
  49. package/dist/repository.d.ts +8 -0
  50. package/dist/repository.js +32 -0
  51. package/dist/seals.d.ts +48 -0
  52. package/dist/seals.js +112 -0
  53. package/dist/store.d.ts +98 -0
  54. package/dist/store.js +225 -0
  55. package/dist/touch-map.d.ts +241 -0
  56. package/dist/touch-map.js +487 -0
  57. package/dist/wire.d.ts +588 -0
  58. package/dist/wire.js +20 -0
  59. package/package.json +19 -10
  60. package/bin/balladeer.js +0 -136
package/LICENSE CHANGED
@@ -1,7 +1,202 @@
1
- Copyright (c) 2026 Balladeer
2
1
 
3
- All rights reserved.
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
4
5
 
5
- This package reserves the "balladeer" package name and points at the official
6
- installer. It grants no rights to Balladeer's software or services. Use of the
7
- Balladeer service is governed by Balladeer's Terms of Service.
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 2026 Balladeer Labs
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/README.md CHANGED
@@ -1,77 +1,163 @@
1
- # Balladeer
2
-
3
- Balladeer makes your AI agents work like they have been on your team for years. It is
4
- decision memory for engineering teams and their agents: it captures the decisions your
5
- team makes while building (the question, the call, the why, the rejected options) and
6
- returns them at the moment they matter: before an agent builds, when a choice comes up,
7
- and when a new plan contradicts a settled call.
8
-
9
- A real serving from Balladeer's own brain (2026-07-14, trimmed). The agent asked before
10
- touching a webhook receiver, and the team's settled call came back with its certainty
11
- and its why:
12
-
13
- ```text
14
- ⟢ balladeer · 2 decisions for "Add a rate limiter to the webhook receiver…"
15
-
16
- decision decision_1a4cdf8b-f92: The remote-MCP per-org RPM cap is enforced FLEET-WIDE
17
- via a shared DB counter (mcp_rate_counters: one row per (org, minute bucket), single
18
- atomic INSERT ... ON CONFLICT ... SET hits=hits+1 RETURNING), replacing the per-process
19
- Map that would have enforced N x the limit across N machines. […]
20
- certainty: confirmed by a human
21
- question it settles: How should the remote-MCP rate limit be enforced across multiple
22
- Fly machines, and which parts of the guard should stay per-process?
23
- ```
24
-
25
- When the agent then makes a new call of its own, the decision is recorded back
26
- (unconfirmed until a human confirms it) and surfaces to every future session that
27
- touches it.
1
+ # balladeer
28
2
 
29
- ## What it does mechanically
3
+ Balladeer holds the behaviors your team has agreed the software keeps, and reports whether each one
4
+ is still being kept. Somebody on your team writes down a behavior in plain language, a named person
5
+ reads it and agrees to it, and from then on your own CI runs your own tests against it and reports
6
+ the outcome. What you get back is a catalog that separates the three states people usually blur
7
+ together: promises a person has agreed to and CI is proving, promises a person has agreed to that
8
+ nothing is proving yet, and promises whose last run says nothing usable, which read as unknown
9
+ rather than green. This package is the command that connects one repository to that, and it never
10
+ receives your code.
30
11
 
31
- - Your agent gains three habits over MCP: `get_context` before non-trivial work,
32
- `consult` at a choice, `propose_decision` when a call gets made. Every decision
33
- carries its certainty (human-confirmed vs machine-captured) and its receipts.
34
- - Your team's decisions live on a shared central server; the `balladeer` CLI and the
35
- hosted MCP connector read from and write to it directly, with no local database to
36
- manage.
37
- - Humans stay in charge: `balladeer recent` and the status line show what accumulated;
38
- confirm or dismiss from the terminal. `balladeer uninstall` removes everything the
39
- setup installed (your data directory is backed up, not deleted).
40
- - Decisions cluster into initiatives: cite a decision id in the PR body that delivers
41
- it and its definition of done checks off on merge, so initiative progress is derived
42
- from merged work, not status updates.
12
+ ## Getting set up
43
13
 
44
- ## Install
14
+ Open your coding agent in the repository you want to protect and say:
45
15
 
46
- ```sh
47
- npm install -g balladeer
48
- balladeer
49
- ```
16
+ > get Balladeer set up
50
17
 
51
- This package is a thin installer. On your consent (one prompt; `--yes` to skip), it
52
- downloads the current Balladeer client from `get.balladeer.ai`, verifies the published
53
- sha256 checksum, and installs the verified file globally, replacing this installer with
54
- the real client (the everyday `balladeer` CLI).
55
- Equivalent, without npm:
18
+ The agent reads the setup instructions, runs the command, and hands you the two things only you can
19
+ do. To run it yourself instead:
56
20
 
57
21
  ```sh
58
- curl -fsSL https://get.balladeer.ai | sh
22
+ npx balladeer@1.0.0 setup
59
23
  ```
60
24
 
61
- Then pair the machine to your team:
62
-
63
- ```sh
64
- balladeer login
65
- ```
66
-
67
- You need a Balladeer workspace to pair with; create one at
68
- [app.balladeer.ai](https://app.balladeer.ai).
69
-
70
- Flags: `--yes` installs without prompting; `--download-only` fetches and verifies the
71
- client tarball and prints its path without installing.
72
-
73
- The client is served from Balladeer's own infrastructure so every install gets the
74
- current build; the client package will publish here directly once self-serve install
75
- stabilizes.
76
-
77
- Copyright (c) 2026 Balladeer. All rights reserved.
25
+ Pin the version, every time. Never use an unpinned or `@latest` form. The bare name resolves to an
26
+ unrelated package that installs a different program.
27
+
28
+ Run it inside the repository you want to protect. It prints the boundary explanation below, then one
29
+ step at a time, and it exits within seconds rather than blocking on anything.
30
+
31
+ It performs all five steps: it pairs this session, adds the repository from ids your own `gh` read,
32
+ connects this coding agent, records the CI identity and opens the pull request whose run proves it,
33
+ and hands you the playbook for discovering this repository's own promises. The two things it never
34
+ does are sign you in and agree to a promise; both of those are yours, in a browser.
35
+
36
+ ## Requirements
37
+
38
+ - Node 22 or newer. The command has no runtime dependencies at all: it uses Node builtins and
39
+ nothing else, so installing it pulls nothing else down.
40
+ - `git`, and the GitHub CLI (`gh`) signed in to an account with push access to the repository. Your
41
+ `gh` is how the command reads the repository's ids and opens the pull request that carries the
42
+ workflow. Balladeer itself never holds a GitHub credential.
43
+
44
+ ## What Balladeer can see
45
+
46
+ Balladeer never receives your code. It cannot read your repository: it holds no GitHub token,
47
+ installs no GitHub App, and has no access to your files, tests, fixtures, logs, prompts, or
48
+ transcripts.
49
+
50
+ What it does receive is small and bounded. From you: the text of each promise a named person on your
51
+ team approves, the numeric ids of your repository and its GitHub owner, and the name of its default
52
+ branch. From CI: GitHub's signed statement of which repository, workflow, and run is reporting, and
53
+ for each promise the run checked, the pass or fail outcome, the exact commit it checked, and content
54
+ hashes of the verifier package and its output. Hashes cannot be turned back into your code or your
55
+ test output.
56
+
57
+ The verify job in your CI runs your tests with your checkout and has no Balladeer credential. A
58
+ separate publish job, with no checkout, sends only those outcomes and hashes.
59
+
60
+ This setup creates two credentials, both of which you control. Approving in the browser lets this
61
+ session act as you to add repositories, connect your coding agent, connect CI, and propose promises;
62
+ it cannot approve, activate, or remove anything. That session lasts a day, each use buys it another
63
+ day, and it is gone seven days after you approved it however much you used it. The coding agent's
64
+ own connection has no expiry: it lets the agent read the promises your team has approved, propose
65
+ new ones, and propose replacing, retiring, excepting, or reassigning one you already have; every one
66
+ of those waits for a named person to decide it. It can also carry out one of those acts for you, and
67
+ only this way: you open a Balladeer page in your own browser, read what the act is, sign it off
68
+ there, and read back the one-time code that page gives you. That code covers that one act on that
69
+ one thing, once, and Balladeer records you as the person who took it and the connection as the
70
+ messenger. Without a code you signed, the connection cannot approve, activate, grant, transfer,
71
+ retire, or delete anything. You can revoke either one at any time in Balladeer, and the setup
72
+ session also ends on its own.
73
+
74
+ Adding the workflow puts a check on pull requests into your default branch. That check is advisory
75
+ on Balladeer's side; whether it blocks a merge is your own branch protection.
76
+
77
+ ## What this command sends, and what it never sends
78
+
79
+ The paragraphs above are the product's boundary. This is what this particular program does on your
80
+ machine, so you can check the two against each other.
81
+
82
+ It sends: your repository as `owner/name` and this machine's short hostname, both of them so you can
83
+ recognise your own pairing on the approval page; your repository's numeric id, its GitHub owner's
84
+ numeric id, and the name of its default branch; whether CI should report on pushes, pull requests,
85
+ or both; and the text of any promise you ask it to propose. Nothing else leaves the machine.
86
+
87
+ It never sends: a file from your repository, a test, a fixture, a log, a prompt, a transcript, a
88
+ diff, a commit message, a GitHub token, or anything else read out of your `gh`. The workflow it
89
+ proposes is committed to your repository, not uploaded, and the tests it triggers run in your CI
90
+ with your checkout and no Balladeer credential.
91
+
92
+ It writes, locally and visibly: your credentials to `$XDG_CONFIG_HOME/balladeer/credentials.json`,
93
+ or `~/.config/balladeer/credentials.json`, with mode 600 inside a directory with mode 700, and it
94
+ refuses to write them anywhere a commit could pick them up; a `balladeer` entry in the repository's
95
+ `.mcp.json`, added beside whatever is already there and never over the top of somebody else's entry;
96
+ and a marker-fenced block in the repository's `CLAUDE.md` or `AGENTS.md`, replaced between the
97
+ markers on each run and never outside them. A file whose markers are damaged is left alone and
98
+ reported rather than appended to.
99
+
100
+ It changes, on your GitHub repository and through your own `gh`: the repository variables the
101
+ workflow reads, so the workflow file itself names no host by hand.
102
+
103
+ It opens, for you to review: one branch, `balladeer/connect-ci`, carrying one workflow file, and one
104
+ pull request from it. You read that pull request and merge it, or you do not. The check it adds to
105
+ pull requests into your default branch is advisory on Balladeer's side; whether it blocks a merge is
106
+ your own branch protection.
107
+
108
+ ## Commands
109
+
110
+ | Command | What it does |
111
+ | ------------------------ | ------------------------------------------------------------------------------ |
112
+ | `balladeer setup` | Run all five steps, then report what a person still has to do |
113
+ | `balladeer repositories` | List what this machine could add, marking the one you are in and the ones in |
114
+ | `balladeer invite` | Invite teammates by email, and say per address whether the email went |
115
+ | `balladeer status` | Report this repository over its agent connection, and the workspace |
116
+ | `balladeer status <id>` | Report one promise: whether it is holding, and if not, what the run reported |
117
+ | `balladeer propose` | Propose one promise from a proposal file, over that connection |
118
+ | `balladeer discover` | File a whole catalog, up to ten promises from one file, behind one review link |
119
+ | `balladeer touch-map` | Record which files each promise's verifier runs, on this machine only |
120
+ | `balladeer affected` | Say which promises the files you name touch, out of that record |
121
+ | `balladeer mcp` | Forward one MCP session over stdio using this repository's connection |
122
+ | `balladeer explain` | What Balladeer can and cannot see, where to watch it, and what leaving costs |
123
+ | `balladeer whoami` | Report the stored session's workspace, role, scopes, and expiry |
124
+
125
+ `--json` emits one object per step on stdout and nothing else. `--wait` makes `setup` poll for the
126
+ approval instead of exiting; without it the command exits and a later run finishes the pairing.
127
+
128
+ `setup --repository owner/name` takes the flag more than once. One of the repositories you name has
129
+ to be the one you are standing in, because connecting a coding agent writes files into a working
130
+ tree and connecting CI pushes a branch to a remote. The rest are added to the workspace and nothing
131
+ more, and the run says so for each of them; somebody runs setup in a checkout of each one to finish
132
+ it. `balladeer repositories` is what you read first to decide which ones to name.
133
+
134
+ `invite` takes one or more addresses and `--role contributor|viewer|administrator`, defaulting to
135
+ contributor. It goes over the setup session's `workspace:invite` grant, so it works only for a
136
+ session an administrator approved, and it says so before sending anything rather than after. Every
137
+ address gets its own line: sending four invitations is four things that can each be refused on their
138
+ own.
139
+
140
+ `discover` takes an object with a `promises` array, each entry shaped exactly as one `propose` file.
141
+ Every promise in it is proposed as owned by whoever paired this machine, unless `--owner` names
142
+ another member, and the command prints one link that opens all of them. Every entry is checked here
143
+ before anything is sent, and one bad entry means not one of them is sent.
144
+
145
+ `explain` prints the boundary explanation and touches nothing, which makes it the safe first thing
146
+ to run from a machine you have not used this on before. It also says where to watch your promises
147
+ once they exist, and what stopping costs: your tests are yours, they keep running, and an
148
+ administrator can download everything Balladeer holds at any time.
149
+
150
+ Exit codes: 0 progress reported truthfully, 2 pairing expired or denied or already claimed, 3 this
151
+ copy is too old for the server, 4 usage or credential store problem, 5 transport or server failure.
152
+
153
+ ## Revoking
154
+
155
+ Both credentials are yours to end. Revoke the setup session or the coding agent's connection at any
156
+ time in Balladeer; the setup session also ends on its own. Removing the `balladeer` entry from
157
+ `.mcp.json` disconnects the agent locally, and deleting the credential store leaves this machine
158
+ with nothing of yours on it.
159
+
160
+ ## Licence
161
+
162
+ Apache License 2.0. The full text ships in this package as `LICENSE`, so you can read the rights you
163
+ have from the copy on your own machine rather than taking a field in a manifest on trust.
@@ -0,0 +1,126 @@
1
+ import { type StoredAgent } from "./store.js";
2
+ /**
3
+ * The repository's own agent connection, and the one way this program talks over
4
+ * it.
5
+ *
6
+ * Three commands reach Balladeer with this credential rather than with the setup
7
+ * session: `mcp` forwards a host's frames over it, `propose` sends one tool call
8
+ * over it, and `status` reads this repository's setup over it. They select the
9
+ * same credential by the same rule and send the same frames to the same
10
+ * endpoint, so there is one authorization body to reason about: whatever an
11
+ * agent connection may do, these commands may do, and nothing else.
12
+ */
13
+ export type AgentSelection = Readonly<{
14
+ kind: "agent";
15
+ agent: StoredAgent;
16
+ }> | Readonly<{
17
+ kind: "refused";
18
+ reason: string;
19
+ /**
20
+ * The repository this machine holds no credential for, named the way the
21
+ * caller named it. Present on that refusal and on no other, because it is
22
+ * the one a person can fix by running setup here: an endpoint on the wrong
23
+ * origin and a directory with no remote are different failures with
24
+ * different remedies, and a command that answered all three with "run
25
+ * setup" would be sending people to repeat a step that already worked.
26
+ */
27
+ missingFor?: string;
28
+ }>;
29
+ /**
30
+ * Which stored credential a command uses, or a refusal saying why none.
31
+ *
32
+ * There are exactly two ways to be right about this, and taking whichever entry
33
+ * comes first is neither. Either the caller named a repository, in which case
34
+ * only that repository's credential will do, or it did not, in which case the
35
+ * only defensible answer is the credential belonging to the repository this
36
+ * process was started in. A machine set up for two repositories otherwise binds
37
+ * an agent working in one of them to the other one's promises, silently, and
38
+ * everything that agent then reads and proposes is about the wrong repository.
39
+ *
40
+ * The bearer is never written to stdout or stderr, and an entry whose MCP URL
41
+ * points somewhere other than the control plane it belongs to is refused: a
42
+ * server response must not be able to send this credential to a new host.
43
+ */
44
+ export declare function selectAgent(agents: readonly StoredAgent[], controlPlane: string, repositoryId: string | undefined, currentRepository: string): AgentSelection;
45
+ /**
46
+ * What a command says when this machine holds no credential for the repository.
47
+ *
48
+ * A credential belongs to the machine it was issued on. A repository can be
49
+ * connected in a browser, or from a colleague's laptop, and this machine still
50
+ * hold nothing: the bearer is shown once, to whoever was there. Saying
51
+ * "Balladeer refused this workspace, run setup to pair again" in that state sent
52
+ * the founder to re-pair a machine whose pairing was never the problem, and a
53
+ * new setup session would not have helped, because these commands do not run
54
+ * over one.
55
+ *
56
+ * The invocation named is the checkout form, which is the one this copy was run
57
+ * as: nothing here has read the server's answer about publication yet.
58
+ */
59
+ export declare function noAgentCredentialSentence(repository: string): string;
60
+ export declare function withSafeEndpoint(agent: StoredAgent): AgentSelection;
61
+ /**
62
+ * The headers every frame this program sends over an agent connection carries,
63
+ * and the one place they are written.
64
+ *
65
+ * `accept` names both media types because the Streamable HTTP transport refuses
66
+ * a POST that does not: a request accepting only JSON is answered 406 by the
67
+ * server before any tool runs. Nothing in this repository noticed, because every
68
+ * test that drove the endpoint wrote its own headers rather than the ones the
69
+ * forwarder sends. The setup probe now sends its one real call through this same
70
+ * constant, so a forwarder that cannot talk to the server is a failed setup step
71
+ * rather than a connection reported as working.
72
+ *
73
+ * `x-balladeer-client` is what lets the server refuse a copy of this program
74
+ * that is too old to talk to it, and answer with the line that updates it.
75
+ */
76
+ export declare function forwarderHeaders(token: string): Readonly<Record<string, string>>;
77
+ /**
78
+ * What one tool call over an agent connection came back as.
79
+ *
80
+ * Every outcome the server can produce is named here, so each caller writes the
81
+ * sentence its own person needs rather than guessing from a status code. A tool
82
+ * that refused (`tool_refusal`) is the connection working and this one tool
83
+ * being unavailable to it; `unauthorized` is the connection itself being gone.
84
+ * Nothing collapses those two together, because the remedies are different and
85
+ * only one of them is a person's.
86
+ */
87
+ export type AgentToolCall = Readonly<{
88
+ kind: "result";
89
+ structured: unknown;
90
+ }> | Readonly<{
91
+ kind: "tool_refusal";
92
+ text: string;
93
+ structured: unknown;
94
+ }> | Readonly<{
95
+ kind: "endpoint_refused";
96
+ reason: string;
97
+ }> | Readonly<{
98
+ kind: "unreachable";
99
+ }> | Readonly<{
100
+ kind: "client_too_old";
101
+ update: string;
102
+ }> | Readonly<{
103
+ kind: "unauthorized";
104
+ }> | Readonly<{
105
+ kind: "http";
106
+ status: number;
107
+ }> | Readonly<{
108
+ kind: "malformed";
109
+ }>;
110
+ /**
111
+ * One JSON-RPC tool call to the endpoint the forwarder would use, with the
112
+ * headers the forwarder sends and the same refusal of an endpoint on another
113
+ * origin. Nothing here reads the bearer back out or writes it anywhere.
114
+ */
115
+ export declare function callAgentTool(agent: StoredAgent, name: string, argumentsValue: Readonly<Record<string, unknown>>, timeoutMs?: number): Promise<AgentToolCall>;
116
+ export declare function safeJson(response: Response): Promise<unknown>;
117
+ /**
118
+ * The server's own remedy, read from the 426 body.
119
+ *
120
+ * Never a literal written here. Only the control plane knows whether this
121
+ * program is published, and a remedy naming a specifier the registry cannot
122
+ * serve leaves the person worse off than the refusal did.
123
+ */
124
+ export declare function updateLine(payload: unknown): string;
125
+ /** One field of a tool result, when it is a string. Never a guess. */
126
+ export declare function structuredString(structured: unknown, field: string): string | undefined;